I give up. Determining if a player got pushed horizontally by an

enemy is unreliable/impossible. This is the easy way to mitigate
the problem...
This commit is contained in:
Evenprime 2011-03-15 17:29:33 +01:00
parent 6fd8c775c5
commit 18ccc4c668
6 changed files with 11 additions and 28 deletions

View File

@ -3,7 +3,7 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.6.9a
version: 0.6.9b
commands:
nocheat:

View File

@ -19,6 +19,8 @@ public class NoCheatData {
public int movingMinorViolationsInARow = 0;
public int movingNormalViolationsInARow = 0;
public int movingHeavyViolationsInARow = 0;
public int movingHorizFreeMoves = 4;
public Location movingSetBackPoint = null;
public long speedhackLastCheck = System.currentTimeMillis(); // timestamp of last check for speedhacks

View File

@ -16,7 +16,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatBlockListener;
import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatEntityListener;
import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatPlayerListener;
import com.ensifera.animosity.craftirc.CraftIRC;
@ -37,7 +36,6 @@ public class NoCheatPlugin extends JavaPlugin {
// Various listeners needed for different Checks
private NoCheatPlayerListener playerListener;
private NoCheatBlockListener blockListener;
private NoCheatEntityListener entityListener;
// My main logger
private static Logger consoleLogger;
@ -138,7 +136,6 @@ public class NoCheatPlugin extends JavaPlugin {
// Create our listeners and feed them with neccessary information
playerListener = new NoCheatPlayerListener();
blockListener = new NoCheatBlockListener();
entityListener = new NoCheatEntityListener();
fileLogger = NoCheatConfiguration.logger;
consoleLogger = Logger.getLogger("Minecraft");
@ -148,7 +145,6 @@ public class NoCheatPlugin extends JavaPlugin {
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this); // used to delete old data of users
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Low, this); // used for airbuild check
pm.registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Lowest, this); // used for moving, speedhack and teleportfrombed check
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Lowest, this); // used for moving check to reset jumping phase
PluginDescriptionFile pdfFile = this.getDescription();

View File

@ -175,7 +175,13 @@ public class MovingCheck {
vl = max(vl, Level.WARNING);
}
else if(combined > movingDistanceLow) {
vl = max(vl, Level.INFO);
if(data.movingHorizFreeMoves > 0) {
data.movingHorizFreeMoves--;
}
else vl = max(vl, Level.INFO);
}
else{
data.movingHorizFreeMoves = 4;
}
// pre-calculate boundary values that are needed multiple times in the following checks

View File

@ -1,22 +0,0 @@
package cc.co.evenprime.bukkit.nocheat.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityListener;
import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin;
public class NoCheatEntityListener extends EntityListener {
@Override
public void onEntityDamage(EntityDamageEvent event) {
if(event.getEntity() instanceof Player) {
Player p = (Player)event.getEntity();
NoCheatPlugin.getPlayerData(p).movingJumpPhase = 0;
}
}
}

View File

@ -49,6 +49,7 @@ public class NoCheatPlayerListener extends PlayerListener {
if(!event.isCancelled()) {
NoCheatData data = NoCheatPlugin.getPlayerData(event.getPlayer());
// If it wasn't our plugin that ordered the teleport, forget all our information to start from scratch at the new location
if(!event.getTo().equals(data.movingSetBackPoint) && !event.getTo().equals(data.speedhackSetBackPoint)) {
data.speedhackSetBackPoint = null;
data.movingSetBackPoint = null;