Really fix #122. This was due to a complete misunderstanding of what the user was really saying.

This commit is contained in:
SuPaH sPii committed 2012-12-31 19:59:30 -06:00
1 parent 600fee0036
commit 46aeb9971e
1 file changed
+14 -10
@@ -403,12 +403,14 @@ public class Backend {
} else { } else {
if (y1 > lastYcoord.get(name) && yAxisViolations.get(name) > magic.Y_MAXVIOLATIONS && (System.currentTimeMillis() - yAxisLastViolation.get(name)) < magic.Y_MAXVIOTIME) { if (y1 > lastYcoord.get(name) && yAxisViolations.get(name) > magic.Y_MAXVIOLATIONS && (System.currentTimeMillis() - yAxisLastViolation.get(name)) < magic.Y_MAXVIOTIME) {
Location g = player.getLocation(); Location g = player.getLocation();
g.setY(lastYcoord.get(name));
player.sendMessage(ChatColor.RED + "[AntiCheat] Fly hacking on the y-axis detected. Please wait 5 seconds to prevent getting damage.");
yAxisViolations.put(name, yAxisViolations.get(name) + 1); yAxisViolations.put(name, yAxisViolations.get(name) + 1);
yAxisLastViolation.put(name, System.currentTimeMillis()); yAxisLastViolation.put(name, System.currentTimeMillis());
if (g.getBlock().getTypeId() == 0) { if (!micromanage.getConfiguration().silentMode()) {
player.teleport(g); g.setY(lastYcoord.get(name));
player.sendMessage(ChatColor.RED + "[AntiCheat] Fly hacking on the y-axis detected. Please wait 5 seconds to prevent getting damage.");
if (g.getBlock().getTypeId() == 0) {
player.teleport(g);
}
} }
return true; return true;
} else { } else {
@@ -419,11 +421,13 @@ public class Backend {
} }
if ((y1 - lastYcoord.get(name)) > magic.Y_MAXDIFF && (System.currentTimeMillis() - lastYtime.get(name)) < magic.Y_TIME) { if ((y1 - lastYcoord.get(name)) > magic.Y_MAXDIFF && (System.currentTimeMillis() - lastYtime.get(name)) < magic.Y_TIME) {
Location g = player.getLocation(); Location g = player.getLocation();
g.setY(lastYcoord.get(name));
yAxisViolations.put(name, yAxisViolations.get(name) + 1); yAxisViolations.put(name, yAxisViolations.get(name) + 1);
yAxisLastViolation.put(name, System.currentTimeMillis()); yAxisLastViolation.put(name, System.currentTimeMillis());
if (g.getBlock().getTypeId() == 0) { if (!micromanage.getConfiguration().silentMode()) {
player.teleport(g); g.setY(lastYcoord.get(name));
if (g.getBlock().getTypeId() == 0) {
player.teleport(g);
}
} }
return true; return true;
} else { } else {
@@ -596,7 +600,7 @@ public class Backend {
Long math = System.currentTimeMillis() - lastBlockBroken.get(name); Long math = System.currentTimeMillis() - lastBlockBroken.get(name);
if (fastBreakViolation.get(name) > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME) { if (fastBreakViolation.get(name) > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME) {
lastBlockBroken.put(name, System.currentTimeMillis()); lastBlockBroken.put(name, System.currentTimeMillis());
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks."); if (!micromanage.getConfiguration().silentMode()) player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
return true; return true;
} else if (fastBreakViolation.get(name) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME) { } else if (fastBreakViolation.get(name) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME) {
fastBreakViolation.put(name, 0); fastBreakViolation.put(name, 0);
@@ -648,7 +652,7 @@ public class Backend {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String name = player.getName(); String name = player.getName();
if (!lastBlockPlaceTime.containsKey(name) || !fastPlaceViolation.containsKey(name)) { if (!lastBlockPlaceTime.containsKey(name) || !fastPlaceViolation.containsKey(name)) {
lastBlockPlaceTime.put(name, Long.parseLong("0")); lastBlockPlaceTime.put(name, 0L);
if (!fastPlaceViolation.containsKey(name)) { if (!fastPlaceViolation.containsKey(name)) {
fastPlaceViolation.put(name, 0); fastPlaceViolation.put(name, 0);
} }
@@ -656,7 +660,7 @@ public class Backend {
Long math = System.currentTimeMillis() - lastBlockPlaced.get(name); Long math = System.currentTimeMillis() - lastBlockPlaced.get(name);
if (lastBlockPlaced.get(name) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME) { if (lastBlockPlaced.get(name) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME) {
lastBlockPlaced.put(name, time); lastBlockPlaced.put(name, time);
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastplacing detected. Please wait 10 seconds before placing blocks."); if (!micromanage.getConfiguration().silentMode()) player.sendMessage(ChatColor.RED + "[AntiCheat] Fastplacing detected. Please wait 10 seconds before placing blocks.");
return true; return true;
} else if (lastBlockPlaced.get(name) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME) { } else if (lastBlockPlaced.get(name) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME) {
fastPlaceViolation.put(name, 0); fastPlaceViolation.put(name, 0);