Clean up 'banwave' logic

This commit is contained in:
cnr 2017-04-16 00:49:12 -06:00
parent 56e15ab2d9
commit dad00171a7

View File

@ -12,8 +12,8 @@ import mineplex.core.common.util.UtilServer;
public class BanwaveAction extends AntiHackAction
{
private static final long BAN_DELAY_AVERAGE = TimeUnit.HOURS.convert(1, TimeUnit.MILLISECONDS) + TimeUnit.MINUTES.convert(15, TimeUnit.MILLISECONDS);
private static final long BAN_DELAY_VARIANCE_SPAN = TimeUnit.HOURS.convert(1, TimeUnit.HOURS) + TimeUnit.MINUTES.convert(45, TimeUnit.MILLISECONDS); // 45 minutes on either side
private static final int BAN_DELAY_MINIMUM_MINUTES = 30;
private static final int BAN_DELAY_MAXIMUM_MINUTES = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS);
public BanwaveAction(int vl)
{
@ -31,7 +31,8 @@ public class BanwaveAction extends AntiHackAction
if (event.getViolations() >= this.getMinVl())
{
// Delay bans by 1.25 hours +/- .75 hours for fuzzing
long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r((int)BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2));
long banDelayMinutes = UtilMath.r(BAN_DELAY_MAXIMUM_MINUTES - BAN_DELAY_MINIMUM_MINUTES) + BAN_DELAY_MINIMUM_MINUTES;
long banTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(banDelayMinutes, TimeUnit.MINUTES);
Managers.get(BanWaveManager.class).insertBanWaveInfo(
event.getPlayer(),
banTime,