diff --git a/pom.xml b/pom.xml
index 47cefa1f..0e84e552 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
cc.co.evenprime.bukkit
NoCheat
- 2.18
+ 2.19
jar
NoCheat
diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java
index 778343d8..5e1d36a5 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheat.java
@@ -13,8 +13,8 @@ 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.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
@@ -134,30 +134,32 @@ public class NoCheat extends JavaPlugin {
// Then print a list of active checks per world
ActiveCheckPrinter.printActiveChecks(this, eventManagers);
- if(mcVersion == MCVersion.MC100) {
-
+ if(mcVersion == MCVersion.MC100 && this.conf.getConfigurationCacheForWorld(null).emergencyfix) {
+
// Tell the server admin that we are activating a workaround
- log.logToConsole(LogLevel.LOW, "[NoCheat] Activating temporary bugfix for broken player death handling of minecraft.");
- // Activate workaround, reset death ticks when a player dies
+ 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 = 0;
+ player.getHandle().deathTicks = 19;
}
}
}, Priority.Monitor, this);
- // Activate workaround, reset death ticks when a player spawns
- getServer().getPluginManager().registerEvent(Type.PLAYER_RESPAWN, new PlayerListener() {
+ // reset death ticks on joins, such that they can go over 20 again
+ getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN, new PlayerListener() {
@Override
- public void onPlayerRespawn(PlayerRespawnEvent event) {
+ public void onPlayerJoin(PlayerJoinEvent event) {
if(event.getPlayer() instanceof CraftPlayer) {
CraftPlayer player = (CraftPlayer) event.getPlayer();
- player.getHandle().deathTicks = 0;
+ if(player.getHealth() <= 0) {
+ player.getHandle().deathTicks = 19;
+ }
}
}
}, Priority.Monitor, this);
diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java b/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java
index fd4908d7..65936345 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/config/Configuration.java
@@ -32,6 +32,9 @@ public abstract class Configuration {
public final static OptionNode DEBUG_SHOWACTIVECHECKS = new OptionNode("showactivechecks", DEBUG, DataType.BOOLEAN);
public static final 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);
+
private final static OptionNode MOVING = new OptionNode("moving", ROOT, DataType.PARENT);
public final static OptionNode MOVING_CHECK = new OptionNode("check", MOVING, DataType.BOOLEAN);
public final static OptionNode MOVING_IDENTIFYCREATIVEMODE = new OptionNode("identifycreativemode", MOVING, 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 50be310b..388ad3ce 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/config/DefaultConfiguration.java
@@ -34,6 +34,11 @@ public class DefaultConfiguration extends Configuration {
setValue(DEBUG_SHOWACTIVECHECKS, false);
setValue(DEBUG_COMPATIBILITY, true);
}
+
+ /*** EMERGENCY_FIX ***/
+ {
+ setValue(EMERGENCYFIX_ENFORCEPLAYERDEATH, true);
+ }
/*** MOVING ***/
{
diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java b/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java
index 787b7dd3..30c6f2f9 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/config/Explainations.java
@@ -26,6 +26,8 @@ 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.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 e49533c0..5eb39d03 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/config/cache/ConfigurationCache.java
@@ -18,6 +18,7 @@ public class ConfigurationCache {
public final CCChat chat;
public final CCDebug debug;
public final CCFight fight;
+ public final boolean emergencyfix;
/**
* Instantiate a config cache and populate it with the data of a
@@ -35,5 +36,6 @@ public class ConfigurationCache {
debug = new CCDebug(data);
fight = new CCFight(data);
+ emergencyfix = data.getBoolean(Configuration.EMERGENCYFIX_ENFORCEPLAYERDEATH);
}
}
diff --git a/src/cc/co/evenprime/bukkit/nocheat/events/MovingEventManager.java b/src/cc/co/evenprime/bukkit/nocheat/events/MovingEventManager.java
index f8d0056a..6a9ca61e 100644
--- a/src/cc/co/evenprime/bukkit/nocheat/events/MovingEventManager.java
+++ b/src/cc/co/evenprime/bukkit/nocheat/events/MovingEventManager.java
@@ -106,7 +106,7 @@ public class MovingEventManager extends EventManagerImpl {
// Get the world-specific configuration that applies here
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
-
+
// Not interested at all in players in vehicles or dead
if(event.getPlayer().isInsideVehicle() || player.isDead()) {
return;