mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 22:07:50 +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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||||
<artifactId>NoCheat</artifactId>
|
<artifactId>NoCheat</artifactId>
|
||||||
<version>2.20b</version>
|
<version>2.21</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>NoCheat</name>
|
<name>NoCheat</name>
|
||||||
<properties>
|
<properties>
|
||||||
@ -16,10 +16,17 @@
|
|||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
<dependencies>
|
<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>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.8.1-R5-20111119.223146-84</version>
|
<version>1.0.1-R2-SNAPSHOT</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -5,18 +5,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
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.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -57,13 +49,7 @@ public class NoCheat extends JavaPlugin {
|
|||||||
|
|
||||||
private LagMeasureTask lagMeasureTask;
|
private LagMeasureTask lagMeasureTask;
|
||||||
|
|
||||||
private int taskId = -1;
|
private int taskId = -1;
|
||||||
|
|
||||||
private MCVersion mcVersion = MCVersion.Unknown;
|
|
||||||
|
|
||||||
public enum MCVersion {
|
|
||||||
MC100, MC181, Unknown, MC101
|
|
||||||
}
|
|
||||||
|
|
||||||
public NoCheat() {
|
public NoCheat() {
|
||||||
|
|
||||||
@ -72,7 +58,7 @@ public class NoCheat extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
|
||||||
if(taskId != -1) {
|
if(taskId != -1) {
|
||||||
getServer().getScheduler().cancelTask(taskId);
|
getServer().getScheduler().cancelTask(taskId);
|
||||||
taskId = -1;
|
taskId = -1;
|
||||||
@ -99,18 +85,6 @@ public class NoCheat extends JavaPlugin {
|
|||||||
// First set up logging
|
// First set up logging
|
||||||
this.log = new LogManager();
|
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
|
// Then set up in memory per player data storage
|
||||||
this.players = new PlayerManager(this);
|
this.players = new PlayerManager(this);
|
||||||
|
|
||||||
@ -138,36 +112,6 @@ public class NoCheat extends JavaPlugin {
|
|||||||
// Then print a list of active checks per world
|
// Then print a list of active checks per world
|
||||||
ActiveCheckPrinter.printActiveChecks(this, eventManagers);
|
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
|
// Tell the server admin that we finished loading NoCheat now
|
||||||
log.logToConsole(LogLevel.LOW, "[NoCheat] version [" + this.getDescription().getVersion() + "] is enabled.");
|
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) {
|
public NoCheatPlayer getPlayer(Player player) {
|
||||||
return players.getPlayer(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_SHOWACTIVECHECKS = new OptionNode("showactivechecks", DEBUG, DataType.BOOLEAN);
|
||||||
public final static OptionNode DEBUG_COMPATIBILITY = new OptionNode("compatibility", 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 = new OptionNode("inventory", ROOT, DataType.PARENT);
|
||||||
public final static OptionNode INVENTORY_CLOSEOBEFORETELEPORTS = new OptionNode("closebeforeteleports", INVENTORY, DataType.BOOLEAN);
|
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_SHOWACTIVECHECKS, false);
|
||||||
setValue(DEBUG_COMPATIBILITY, true);
|
setValue(DEBUG_COMPATIBILITY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** EMERGENCY_FIX ***/
|
|
||||||
{
|
|
||||||
setValue(EMERGENCYFIX_ENFORCEPLAYERDEATH, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** INVENTORY ***/
|
/*** 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_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.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.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_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.");
|
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 CCChat chat;
|
||||||
public final CCDebug debug;
|
public final CCDebug debug;
|
||||||
public final CCFight fight;
|
public final CCFight fight;
|
||||||
public final boolean emergencyfix;
|
|
||||||
public final CCInventory inventory;
|
public final CCInventory inventory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +34,5 @@ public class ConfigurationCache {
|
|||||||
debug = new CCDebug(data);
|
debug = new CCDebug(data);
|
||||||
fight = new CCFight(data);
|
fight = new CCFight(data);
|
||||||
inventory = new CCInventory(data);
|
inventory = new CCInventory(data);
|
||||||
|
|
||||||
emergencyfix = data.getBoolean(Configuration.EMERGENCYFIX_ENFORCEPLAYERDEATH);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user