Implement anticheat VL and banwave changes

This commit is contained in:
cnr 2017-04-12 23:36:55 -06:00
parent 0dae58a0a7
commit 87f9fe6093
2 changed files with 34 additions and 32 deletions

View File

@ -1,5 +1,6 @@
package mineplex.core.antihack;
import javax.xml.bind.DatatypeConverter;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
@ -9,7 +10,11 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import javax.xml.bind.DatatypeConverter;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -43,6 +48,7 @@ import com.mineplex.anticheat.checks.combat.KillauraTypeF;
import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
import com.mineplex.anticheat.checks.move.Speed;
import com.mineplex.anticheat.checks.move.Toggle;
import com.mineplex.anticheat.checks.player.BadPackets;
import mineplex.core.MiniPlugin;
@ -76,11 +82,6 @@ import mineplex.core.punish.Category;
import mineplex.core.punish.Punish;
import mineplex.core.punish.PunishmentResponse;
import mineplex.serverdata.commands.ServerCommandManager;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ReflectivelyCreateMiniPlugin
public class AntiHack extends MiniPlugin
@ -90,12 +91,13 @@ public class AntiHack extends MiniPlugin
.put(KillauraTypeB.class, new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE))
.put(KillauraTypeC.class, new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE))
.put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500))
.put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 300, 700, 2000))
.put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 150, 250, 350))
.put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 1000, 2000, 5000))
.put(KillauraTypeF.class, new CheckThresholds("Kill Aura", 200, 300, 400))
.put(BadPackets.class, new CheckThresholds("Regen", 500, 1000, 2000))
.put(Glide.class, new CheckThresholds("Flying", 150, 250, 500))
.put(Speed.class, new CheckThresholds("Speed", 150, 250, 500))
.put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 0))
.put(Glide.class, new CheckThresholds("Flying", 1000, 2000, 3500))
.put(Speed.class, new CheckThresholds("Speed", 1000, 2000, 3500))
.put(HeadRoll.class, new CheckThresholds("Illegal Movement", 0, 0, 1000))
.put(Toggle.class, new CheckThresholds("AutoSneak", 100, 200, 300))
.build();
private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
@ -103,9 +105,10 @@ public class AntiHack extends MiniPlugin
private static final Map<Class<? extends Check>, AntiHackAction> ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(KillauraTypeA.class, new ImmediateBanAction(200))
.put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600))
.put(Glide.class, new ImmediateBanAction(10000))
.put(Speed.class, new ImmediateBanAction(10000))
// .put(HeadRoll.class, new ImmediateBanAction(200))
.put(HeadRoll.class, new ImmediateBanAction(2000))
.put(HeadRoll.class, new GEPBanAction(1))
.put(BadPackets.class, new GEPBanAction(300))
.put(KillauraTypeB.class, new GEPBanAction(100))
@ -368,26 +371,23 @@ public class AntiHack extends MiniPlugin
ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event);
if (event.shouldTellStaff())
CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD);
CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations());
if (severity == CheckThresholds.Severity.NONE)
{
CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD);
CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations());
return;
}
if (severity == CheckThresholds.Severity.NONE)
{
return;
}
String key = event.getPlayer().getName() + "." + event.getHackType() + "." + severity.toString();
String key = event.getPlayer().getName() + "." + event.getHackType() + "." + severity.toString();
Integer pastVl = this._cooldown.getIfPresent(key);
if (pastVl == null)
{
MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage());
ServerCommandManager.getInstance().publishCommand(command);
Integer pastVl = this._cooldown.getIfPresent(key);
if (pastVl == null)
{
MajorViolationCommand command = new MajorViolationCommand(_thisServer, event.getPlayer().getName(), CheckManager.getCheckSimpleName(event.getCheckClass()), event.getViolations(), event.getMessage());
ServerCommandManager.getInstance().publishCommand(command);
this._cooldown.put(key, event.getViolations());
}
this._cooldown.put(key, event.getViolations());
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.antihack.actions;
import java.util.concurrent.TimeUnit;
import com.mineplex.anticheat.api.PlayerViolationEvent;
import mineplex.core.Managers;
@ -10,8 +12,8 @@ import mineplex.core.common.util.UtilServer;
public class BanwaveAction extends AntiHackAction
{
private static final int BAN_DELAY_AVERAGE = 6 * 60 * 60 * 1000; // 6 hours
private static final int BAN_DELAY_VARIANCE_SPAN = 4 * 60 * 60 * 1000; // 4 hours total; 2 on either side
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
public BanwaveAction(int vl)
{
@ -28,8 +30,8 @@ public class BanwaveAction extends AntiHackAction
}
if (event.getViolations() >= this.getMinVl())
{
// Delay bans by 6 hours +/- 2 hours for fuzzing
long banTime = System.currentTimeMillis() + BAN_DELAY_AVERAGE + (UtilMath.r(BAN_DELAY_VARIANCE_SPAN) - (BAN_DELAY_VARIANCE_SPAN / 2));
// 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));
Managers.get(BanWaveManager.class).insertBanWaveInfo(
event.getPlayer(),
banTime,