Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex

Conflicts:
	Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
This commit is contained in:
Jonathan Williams 2013-10-17 00:40:06 -07:00
commit 43b42f771a

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -38,7 +39,7 @@ public class AntiHack extends MiniPlugin
private HashMap<Player, HashMap<String, Integer>> _offenses = new HashMap<Player, HashMap<String, Integer>>(); private HashMap<Player, HashMap<String, Integer>> _offenses = new HashMap<Player, HashMap<String, Integer>>();
//Ignore Player //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>(); private HashMap<Player, Long> _ignore = new HashMap<Player, Long>();
//Hack Data //Hack Data
@ -52,10 +53,10 @@ public class AntiHack extends MiniPlugin
private HashMap<Player, Entry<Integer, Long>> _speedTicks = new HashMap<Player, Entry<Integer, Long>>(); //Ticks, PrevY private HashMap<Player, Entry<Integer, Long>> _speedTicks = new HashMap<Player, Entry<Integer, Long>>(); //Ticks, PrevY
//Hack Requirements //Hack Requirements
private int _floatHackTicks = 4; private int _floatHackTicks = 6;
private int _hoverHackTicks = 4; private int _hoverHackTicks = 4;
private int _riseHackTicks = 8; private int _riseHackTicks = 6;
private int _speedHackTicks = 4; private int _speedHackTicks = 6;
private int _freecamTime = 8000; private int _freecamTime = 8000;
protected AntiHack(JavaPlugin plugin) protected AntiHack(JavaPlugin plugin)
@ -74,7 +75,8 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void PlayerVelocity(PlayerVelocityEvent event) public void PlayerVelocity(PlayerVelocityEvent event)
{ {
_ignoreStart.add(event.getPlayer()); _ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000);
_ignoreSecondary.add(event.getPlayer());
} }
@EventHandler @EventHandler
@ -91,10 +93,10 @@ public class AntiHack extends MiniPlugin
_lastMove.put(player, System.currentTimeMillis()); _lastMove.put(player, System.currentTimeMillis());
//Start Ignore //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); _ignore.put(player, System.currentTimeMillis() + 2000);
_ignoreStart.remove(player); _ignoreSecondary.remove(player);
} }
//Allowed 'cheaty' movement //Allowed 'cheaty' movement
@ -141,8 +143,8 @@ public class AntiHack extends MiniPlugin
if (!UtilTime.elapsed(_lastMove.get(player), _freecamTime)) if (!UtilTime.elapsed(_lastMove.get(player), _freecamTime))
continue; continue;
//player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Hack " + C.cWhite + "Kicked for Lagging / Free Cam."); AddOffense(player, "Lagging / Fly (Idle) / FreeCam");
AddOffense(player, "Free Cam / Lag / Float"); //player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Hack " + C.cWhite + "Kicked for Lagging / Fly (Idle) / Free Cam.");
} }
} }
@ -152,10 +154,10 @@ public class AntiHack extends MiniPlugin
Player player = event.getPlayer(); Player player = event.getPlayer();
//Start Ignore //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); _ignore.put(player, System.currentTimeMillis() + 2000);
_ignoreStart.remove(player); _ignoreSecondary.remove(player);
} }
//Allowed 'cheaty' movement //Allowed 'cheaty' movement
@ -313,7 +315,7 @@ public class AntiHack extends MiniPlugin
} }
//Check //Check
if (offset > limit && !UtilTime.elapsed(_speedTicks.get(player).getValue(), 200))//Counters Lag if (offset > limit && !UtilTime.elapsed(_speedTicks.get(player).getValue(), 150))//Counters Lag
{ {
count = _speedTicks.get(player).getKey() + 1; count = _speedTicks.get(player).getKey() + 1;
} }
@ -325,7 +327,7 @@ public class AntiHack extends MiniPlugin
if (count > _speedHackTicks) if (count > _speedHackTicks)
{ {
AddOffense(player, "Speed"); AddOffense(player, "Speed (Fly/Move)");
count = 0; count = 0;
} }
@ -346,6 +348,11 @@ public class AntiHack extends MiniPlugin
_offenses.get(player).put(type, previous + 1); _offenses.get(player).put(type, previous + 1);
} }
//Staff
for (Player other : UtilServer.getPlayers())
if (other.isOp())
UtilPlayer.message(other, C.cGold + C.Bold + player.getName() + " received offense for " + type + ".");
//Print (Debug) //Print (Debug)
System.out.println("[Offense] " + player.getName() + " received offense for " + type + "."); System.out.println("[Offense] " + player.getName() + " received offense for " + type + ".");
} }
@ -367,7 +374,7 @@ public class AntiHack extends MiniPlugin
_speedTicks.remove(player); _speedTicks.remove(player);
_ignore.remove(player); _ignore.remove(player);
_ignoreStart.remove(player); _ignoreSecondary.remove(player);
synchronized (getOffensesSynch()) synchronized (getOffensesSynch())
{ {