From 8d1ee85d9d94dbb3e3bf468706a39d3a76917653 Mon Sep 17 00:00:00 2001 From: asofold Date: Mon, 21 Jan 2013 05:59:52 +0100 Subject: [PATCH] Add compatibility option to set blocks as instantly breakable. --- .../fr/neatmonster/nocheatplus/config/RootConfPaths.java | 1 + .../nocheatplus/utilities/BlockProperties.java | 9 +++++++++ .../fr/neatmonster/nocheatplus/config/DefaultConfig.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/config/RootConfPaths.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/config/RootConfPaths.java index 854e3992..f3ae7c81 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/config/RootConfPaths.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/config/RootConfPaths.java @@ -10,5 +10,6 @@ public class RootConfPaths { // Sub-paths that are used with different path prefixes potentially. public static final String SUB_IGNOREPASSABLE = "ignorepassable"; + public static final String SUB_ALLOWINSTANTBREAK = "allowinstantbreak"; } diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java index ae0e7b30..bce8d052 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java @@ -1029,6 +1029,15 @@ public class BlockProperties { if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + RootConfPaths.SUB_IGNOREPASSABLE + "): " + input); else blockFlags[id] |= F_IGN_PASSABLE; } + + // Allow instant breaking. + for (final String input : config.getStringList(pathPrefix + RootConfPaths.SUB_ALLOWINSTANTBREAK)){ + final Integer id = RawConfigFile.parseTypeId(input); + if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + RootConfPaths.SUB_ALLOWINSTANTBREAK + "): " + input); + else { + setBlockProps(id, instantType); + } + } } // /** diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java index 84350977..7ddf566c 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -25,7 +25,7 @@ public class DefaultConfig extends ConfigFile { * NCP build needed for this config. * (Should only increment with changing or removing paths.) */ - public static final int buildNumber = 322; + public static final int buildNumber = 326; // TODO: auto input full version or null to an extra variable or several [fail safe for other syntax checking]?