From 9ef5282905b3f035ce1ed972ec90de41013963bb Mon Sep 17 00:00:00 2001 From: Evenprime Date: Mon, 4 Apr 2011 20:44:14 +0200 Subject: [PATCH] Plugin rename from "NoCheatPlugin" to "NoCheat" and configurable speedhack check log message + v0.8 --- plugin.yml | 2 +- src/cc/co/evenprime/bukkit/nocheat/NoCheat.java | 1 + .../co/evenprime/bukkit/nocheat/NoCheatConfiguration.java | 3 +++ .../co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java | 6 ++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin.yml b/plugin.yml index be4553b5..667db227 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: NoCheat author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheat -version: 0.7.8a +version: 0.8 commands: nocheat: diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java index e3733e9f..91b9f2da 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java @@ -251,6 +251,7 @@ public class NoCheat extends JavaPlugin { if(config.chatLevel.intValue() <= l.intValue()) { for(Player player : getServer().getOnlinePlayers()) { if(hasPermission(player, "nocheat.notify")) { + System.out.println("logged to chat"); player.sendMessage("["+l.getName()+"] " + message); } } diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java index 2fe3c42c..d9c908c4 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java @@ -94,6 +94,8 @@ public class NoCheatConfiguration { plugin.speedhackCheck.limits[1] = c.getInt("speedhack.limits.med", plugin.speedhackCheck.limits[1]); plugin.speedhackCheck.limits[2] = c.getInt("speedhack.limits.high", plugin.speedhackCheck.limits[2]); + plugin.speedhackCheck.logMessage = c.getString("speedhack.logmessage", plugin.speedhackCheck.logMessage); + plugin.movingCheck.actions[0] = stringToActions(c.getString("moving.action.low"), plugin.movingCheck.actions[0]); plugin.movingCheck.actions[1] = stringToActions(c.getString("moving.action.med"), plugin.movingCheck.actions[1]); plugin.movingCheck.actions[2] = stringToActions(c.getString("moving.action.high"), plugin.movingCheck.actions[2]); @@ -227,6 +229,7 @@ public class NoCheatConfiguration { w.write(" bedteleport: "+plugin.bedteleportCheck.isActive()); w.newLine(); w.write("# Speedhack specific options"); w.newLine(); w.write("speedhack:"); w.newLine(); + w.write(" logmessage: \"" + plugin.speedhackCheck.logMessage+"\""); w.newLine(); w.write(" limits:"); w.newLine(); w.write(" low: "+plugin.speedhackCheck.limits[0]); w.newLine(); w.write(" med: "+plugin.speedhackCheck.limits[1]); w.newLine(); diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java index fc4f31d2..71cf5222 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/SpeedhackCheck.java @@ -34,6 +34,8 @@ public class SpeedhackCheck extends Check { { LogAction.loglow, CancelAction.cancel }, { LogAction.logmed, CancelAction.cancel }, { LogAction.loghigh, CancelAction.cancel } }; + + public String logMessage = "%1$s sent %2$d move events, but only %3$d were allowed. Speedhack?"; public void check(PlayerMoveEvent event) { @@ -101,11 +103,11 @@ public class SpeedhackCheck extends Check { if(actions == null) return; - String logMessage = event.getPlayer().getName()+" sent "+ data.speedhackEventsSinceLastCheck + " move events, but only "+limits[0]+ " were allowed. Speedhack?"; + String log = String.format(logMessage, event.getPlayer().getName(), data.speedhackEventsSinceLastCheck, limits[0]); for(Action a : actions) { if(a instanceof LogAction) - plugin.log(((LogAction)a).level, logMessage); + plugin.log(((LogAction)a).level, log); else if(a instanceof CancelAction) resetPlayer(event, data); else if(a instanceof CustomAction)