diff --git a/pom.xml b/pom.xml index 21431407..82cad5d7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cc.co.evenprime.bukkit NoCheat - 2.20b + 2.21 jar NoCheat @@ -16,10 +16,17 @@ + + org.bukkit + bukkit + 1.0.1-R2-20111212.231953-2 + jar + compile + org.bukkit craftbukkit - 1.8.1-R5-20111119.223146-84 + 1.0.1-R2-SNAPSHOT jar compile diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java index cf388cef..1bcc133f 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java @@ -5,18 +5,10 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.entity.Player; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event.Type; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityListener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; @@ -57,13 +49,7 @@ public class NoCheat extends JavaPlugin { private LagMeasureTask lagMeasureTask; - private int taskId = -1; - - private MCVersion mcVersion = MCVersion.Unknown; - - public enum MCVersion { - MC100, MC181, Unknown, MC101 - } + private int taskId = -1; public NoCheat() { @@ -72,7 +58,7 @@ public class NoCheat extends JavaPlugin { public void onDisable() { PluginDescriptionFile pdfFile = this.getDescription(); - + if(taskId != -1) { getServer().getScheduler().cancelTask(taskId); taskId = -1; @@ -99,18 +85,6 @@ public class NoCheat extends JavaPlugin { // First set up logging this.log = new LogManager(); - // find out Minecraft version - if(Bukkit.getVersion().contains("MC: 1.0.0")) { - this.mcVersion = MCVersion.MC100; - } else if(Bukkit.getVersion().contains("MC: 1.0.1")) { - this.mcVersion = MCVersion.MC101; - } else if(Bukkit.getVersion().contains("MC: 1.8.1")) { - this.mcVersion = MCVersion.MC181; - } else { - this.mcVersion = MCVersion.Unknown; - log.logToConsole(LogLevel.LOW, "[NoCheat] You run an unsupported version of Minecraft. Some parts of NoCheat get disabled for your safety."); - } - // Then set up in memory per player data storage this.players = new PlayerManager(this); @@ -138,36 +112,6 @@ public class NoCheat extends JavaPlugin { // Then print a list of active checks per world ActiveCheckPrinter.printActiveChecks(this, eventManagers); - if((mcVersion == MCVersion.MC100 || mcVersion == MCVersion.MC101) && this.conf.getConfigurationCacheForWorld(null).emergencyfix) { - - // Tell the server admin that we are activating a workaround - log.logToConsole(LogLevel.LOW, "[NoCheat] Activating emergency bugfix for broken player death handling of minecraft."); - // reset death ticks on deaths, such that they can go over 20 again - getServer().getPluginManager().registerEvent(Type.ENTITY_DEATH, new EntityListener() { - - @Override - public void onEntityDeath(EntityDeathEvent event) { - if(event.getEntity() instanceof CraftPlayer) { - CraftPlayer player = (CraftPlayer) event.getEntity(); - player.getHandle().deathTicks = 19; - } - } - }, Priority.Monitor, this); - - // reset death ticks on joins, such that they can go over 20 again - getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN, new PlayerListener() { - - @Override - public void onPlayerJoin(PlayerJoinEvent event) { - if(event.getPlayer() instanceof CraftPlayer) { - CraftPlayer player = (CraftPlayer) event.getPlayer(); - if(player.getHealth() <= 0) { - player.getHandle().deathTicks = 19; - } - } - } - }, Priority.Monitor, this); - } // Tell the server admin that we finished loading NoCheat now log.logToConsole(LogLevel.LOW, "[NoCheat] version [" + this.getDescription().getVersion() + "] is enabled."); } @@ -261,8 +205,4 @@ public class NoCheat extends JavaPlugin { public NoCheatPlayer getPlayer(Player player) { return players.getPlayer(player); } - - public MCVersion getMCVersion() { - return mcVersion; - } } diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java b/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java index 6af7366b..c00ca9e5 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java @@ -32,9 +32,6 @@ public abstract class Configuration { public final static OptionNode DEBUG_SHOWACTIVECHECKS = new OptionNode("showactivechecks", DEBUG, DataType.BOOLEAN); public final static OptionNode DEBUG_COMPATIBILITY = new OptionNode("compatibility", DEBUG, DataType.BOOLEAN); - private final static OptionNode EMERGENCYFIX = new OptionNode("emergencyfix", ROOT, DataType.PARENT); - public final static OptionNode EMERGENCYFIX_ENFORCEPLAYERDEATH = new OptionNode("enforceplayerdeath", EMERGENCYFIX, DataType.BOOLEAN); - public final static OptionNode INVENTORY = new OptionNode("inventory", ROOT, DataType.PARENT); public final static OptionNode INVENTORY_CLOSEOBEFORETELEPORTS = new OptionNode("closebeforeteleports", INVENTORY, DataType.BOOLEAN); diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java b/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java index 5fa0c8eb..668bfc42 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java @@ -34,11 +34,6 @@ public class DefaultConfiguration extends Configuration { setValue(DEBUG_SHOWACTIVECHECKS, false); setValue(DEBUG_COMPATIBILITY, true); } - - /*** EMERGENCY_FIX ***/ - { - setValue(EMERGENCYFIX_ENFORCEPLAYERDEATH, true); - } /*** INVENTORY ***/ { diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java b/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java index ceb864e0..a3906181 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java @@ -26,11 +26,9 @@ public class Explainations { set(Configuration.DEBUG_SHOWACTIVECHECKS, "Print to the console an overview of all checks that are enabled when NoCheat gets loaded."); set(Configuration.DEBUG_COMPATIBILITY, "Do some voodoo to fix common mistakes of other plugins which interfere with NoCheat."); - - set(Configuration.EMERGENCYFIX_ENFORCEPLAYERDEATH, "Fix a bug that prevents people from really dying, causing them to not drop XP,\n and still being able to fight, place/destroy blocks etc. in an invulnerable state."); set(Configuration.INVENTORY_CLOSEOBEFORETELEPORTS, "Close inventory screens of players before they get teleported, preventing creation of real or fake duplicates."); - + set(Configuration.MOVING_CHECK, "If true, do various checks on PlayerMove events."); set(Configuration.MOVING_IDENTIFYCREATIVEMODE, "If true, NoCheat will automatically identify if players are in creative mode and will allow them to fly, avoid fall damage etc."); diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java b/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java index e5b6e065..89f3e609 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java @@ -18,7 +18,6 @@ public class ConfigurationCache { public final CCChat chat; public final CCDebug debug; public final CCFight fight; - public final boolean emergencyfix; public final CCInventory inventory; /** @@ -35,7 +34,5 @@ public class ConfigurationCache { debug = new CCDebug(data); fight = new CCFight(data); inventory = new CCInventory(data); - - emergencyfix = data.getBoolean(Configuration.EMERGENCYFIX_ENFORCEPLAYERDEATH); } }