mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
Get rid of godmode-emergency-fix and version detection code (no
longer needed)
This commit is contained in:
parent
7742d5bcfa
commit
37876a946b
11
pom.xml
11
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||
<artifactId>NoCheat</artifactId>
|
||||
<version>2.20b</version>
|
||||
<version>2.21</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>NoCheat</name>
|
||||
<properties>
|
||||
@ -16,10 +16,17 @@
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.0.1-R2-20111212.231953-2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.1-R5-20111119.223146-84</version>
|
||||
<version>1.0.1-R2-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -34,11 +34,6 @@ public class DefaultConfiguration extends Configuration {
|
||||
setValue(DEBUG_SHOWACTIVECHECKS, false);
|
||||
setValue(DEBUG_COMPATIBILITY, true);
|
||||
}
|
||||
|
||||
/*** EMERGENCY_FIX ***/
|
||||
{
|
||||
setValue(EMERGENCYFIX_ENFORCEPLAYERDEATH, true);
|
||||
}
|
||||
|
||||
/*** INVENTORY ***/
|
||||
{
|
||||
|
@ -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.");
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user