AH Update
This commit is contained in:
parent
d23f72567a
commit
d9ecbf4037
@ -7,9 +7,11 @@ import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -35,7 +37,7 @@ public class AntiHack extends MiniPlugin
|
||||
private HashMap<Player, HashMap<String, Integer>> _offenses = new HashMap<Player, HashMap<String, Integer>>();
|
||||
|
||||
//Ignore Player
|
||||
private HashSet<Player> _ignoreStart = new HashSet<Player>();
|
||||
private HashSet<Player> _ignoreSecondary = new HashSet<Player>();
|
||||
private HashMap<Player, Long> _ignore = new HashMap<Player, Long>();
|
||||
|
||||
//Hack Data
|
||||
@ -49,10 +51,10 @@ public class AntiHack extends MiniPlugin
|
||||
private HashMap<Player, Entry<Integer, Long>> _speedTicks = new HashMap<Player, Entry<Integer, Long>>(); //Ticks, PrevY
|
||||
|
||||
//Hack Requirements
|
||||
private int _floatHackTicks = 4;
|
||||
private int _floatHackTicks = 6;
|
||||
private int _hoverHackTicks = 4;
|
||||
private int _riseHackTicks = 8;
|
||||
private int _speedHackTicks = 4;
|
||||
private int _riseHackTicks = 6;
|
||||
private int _speedHackTicks = 6;
|
||||
private int _freecamTime = 8000;
|
||||
|
||||
protected AntiHack(JavaPlugin plugin)
|
||||
@ -68,7 +70,8 @@ public class AntiHack extends MiniPlugin
|
||||
@EventHandler
|
||||
public void PlayerVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
_ignoreStart.add(event.getPlayer());
|
||||
_ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000);
|
||||
_ignoreSecondary.add(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -85,10 +88,10 @@ public class AntiHack extends MiniPlugin
|
||||
_lastMove.put(player, System.currentTimeMillis());
|
||||
|
||||
//Start Ignore
|
||||
if (_ignoreStart.contains(player) && event.getTo().getY() > event.getFrom().getY())
|
||||
if (_ignoreSecondary.contains(player) && event.getTo().getY() > event.getFrom().getY())
|
||||
{
|
||||
_ignore.put(player, System.currentTimeMillis() + 2000);
|
||||
_ignoreStart.remove(player);
|
||||
_ignoreSecondary.remove(player);
|
||||
}
|
||||
|
||||
//Allowed 'cheaty' movement
|
||||
@ -135,7 +138,7 @@ public class AntiHack extends MiniPlugin
|
||||
if (!UtilTime.elapsed(_lastMove.get(player), _freecamTime))
|
||||
continue;
|
||||
|
||||
player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Hack " + C.cWhite + "Kicked for Lagging / Free Cam.");
|
||||
player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Hack " + C.cWhite + "Kicked for Lagging / Fly (Idle) / Free Cam.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,10 +148,10 @@ public class AntiHack extends MiniPlugin
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Start Ignore
|
||||
if (_ignoreStart.contains(player) && event.getTo().getY() > event.getFrom().getY())
|
||||
if (_ignoreSecondary.contains(player) && event.getTo().getY() > event.getFrom().getY())
|
||||
{
|
||||
_ignore.put(player, System.currentTimeMillis() + 2000);
|
||||
_ignoreStart.remove(player);
|
||||
_ignoreSecondary.remove(player);
|
||||
}
|
||||
|
||||
//Allowed 'cheaty' movement
|
||||
@ -297,7 +300,7 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
if (count > _speedHackTicks)
|
||||
{
|
||||
AddOffense(player, "Speed");
|
||||
AddOffense(player, "Speed (Fly/Move)");
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@ -315,6 +318,11 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
_offenses.get(player).put(type, previous + 1);
|
||||
|
||||
//Staff
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (other.isOp())
|
||||
UtilPlayer.message(other, F.main("AntiHack", F.elem(player.getName()) + " received offense for " + F.elem(type + ".")));
|
||||
|
||||
//Print (Debug)
|
||||
System.out.println("[Offense] " + player.getName() + " received offense for " + type + ".");
|
||||
}
|
||||
@ -336,7 +344,7 @@ public class AntiHack extends MiniPlugin
|
||||
_speedTicks.remove(player);
|
||||
|
||||
_ignore.remove(player);
|
||||
_ignoreStart.remove(player);
|
||||
_ignoreSecondary.remove(player);
|
||||
_offenses.remove(player);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user