mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-27 14:13:11 +02:00
Remove RootConfPaths.
This commit is contained in:
parent
f7d2d44070
commit
228a6478a8
@ -16,9 +16,9 @@ public abstract class ConfPaths {
|
||||
|
||||
// Sub-paths that are used with different path prefixes potentially.
|
||||
public static final String SUB_DEBUG = "debug";
|
||||
public static final String SUB_IGNOREPASSABLE = RootConfPaths.SUB_IGNOREPASSABLE;
|
||||
public static final String SUB_ALLOWINSTANTBREAK = RootConfPaths.SUB_ALLOWINSTANTBREAK;
|
||||
public static final String SUB_OVERRIDEFLAGS = RootConfPaths.SUB_OVERRIDEFLAGS;
|
||||
public static final String SUB_IGNOREPASSABLE = "ignorepassable";
|
||||
public static final String SUB_ALLOWINSTANTBREAK = "allowinstantbreak";
|
||||
public static final String SUB_OVERRIDEFLAGS = "overrideflags";
|
||||
public static final String SUB_LAG = "lag";
|
||||
|
||||
// General:
|
||||
|
@ -1,16 +0,0 @@
|
||||
package fr.neatmonster.nocheatplus.config;
|
||||
|
||||
/**
|
||||
* Auxiliary for config paths that have to be used in this module. These are likely to be referenced from ConfPaths (plugin module).<br>
|
||||
* Not happy with these, but seem necessary for refactoring.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
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";
|
||||
public static final String SUB_OVERRIDEFLAGS = "overrideflags";
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.vanilla.BlocksMC1_5;
|
||||
import fr.neatmonster.nocheatplus.config.RawConfigFile;
|
||||
import fr.neatmonster.nocheatplus.config.RootConfPaths;
|
||||
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.logging.LogUtil;
|
||||
|
||||
@ -1653,23 +1653,23 @@ public class BlockProperties {
|
||||
*/
|
||||
public static void applyConfig(final RawConfigFile config, final String pathPrefix) {
|
||||
// Ignore passable.
|
||||
for (final String input : config.getStringList(pathPrefix + RootConfPaths.SUB_IGNOREPASSABLE)){
|
||||
for (final String input : config.getStringList(pathPrefix + ConfPaths.SUB_IGNOREPASSABLE)){
|
||||
final Integer id = RawConfigFile.parseTypeId(input);
|
||||
if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + RootConfPaths.SUB_IGNOREPASSABLE + "): " + input);
|
||||
if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + ConfPaths.SUB_IGNOREPASSABLE + "): " + input);
|
||||
else blockFlags[id] |= F_IGN_PASSABLE;
|
||||
}
|
||||
|
||||
// Allow instant breaking.
|
||||
for (final String input : config.getStringList(pathPrefix + RootConfPaths.SUB_ALLOWINSTANTBREAK)){
|
||||
for (final String input : config.getStringList(pathPrefix + ConfPaths.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);
|
||||
if (id == null || id < 0 || id >= 4096) LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + ConfPaths.SUB_ALLOWINSTANTBREAK + "): " + input);
|
||||
else {
|
||||
setBlockProps(id, instantType);
|
||||
}
|
||||
}
|
||||
|
||||
// Override block flags.
|
||||
ConfigurationSection section = config.getConfigurationSection(pathPrefix + RootConfPaths.SUB_OVERRIDEFLAGS);
|
||||
ConfigurationSection section = config.getConfigurationSection(pathPrefix + ConfPaths.SUB_OVERRIDEFLAGS);
|
||||
if (section != null){
|
||||
final Map<String, Object> entries = section.getValues(false);
|
||||
boolean hasErrors = false;
|
||||
@ -1677,12 +1677,12 @@ public class BlockProperties {
|
||||
final String key = entry.getKey();
|
||||
final Integer id = RawConfigFile.parseTypeId(key);
|
||||
if (id == null || id < 0 || id >= 4096){
|
||||
LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + RootConfPaths.SUB_OVERRIDEFLAGS + "): " + key);
|
||||
LogUtil.logWarning("[NoCheatplus] Bad block id (" + pathPrefix + ConfPaths.SUB_OVERRIDEFLAGS + "): " + key);
|
||||
continue;
|
||||
}
|
||||
final Object obj = entry.getValue();
|
||||
if (!(obj instanceof String)){
|
||||
LogUtil.logWarning("[NoCheatplus] Bad flags at " + pathPrefix + RootConfPaths.SUB_OVERRIDEFLAGS + " for key: " + key);
|
||||
LogUtil.logWarning("[NoCheatplus] Bad flags at " + pathPrefix + ConfPaths.SUB_OVERRIDEFLAGS + " for key: " + key);
|
||||
hasErrors = true;
|
||||
continue;
|
||||
}
|
||||
@ -1699,7 +1699,7 @@ public class BlockProperties {
|
||||
try{
|
||||
flags |= parseFlag(input);
|
||||
} catch(InputMismatchException e){
|
||||
LogUtil.logWarning("[NoCheatplus] Bad flag at " + pathPrefix + RootConfPaths.SUB_OVERRIDEFLAGS + " for key " + key + " (skip setting flags for this block): " + input);
|
||||
LogUtil.logWarning("[NoCheatplus] Bad flag at " + pathPrefix + ConfPaths.SUB_OVERRIDEFLAGS + " for key " + key + " (skip setting flags for this block): " + input);
|
||||
error = true;
|
||||
hasErrors = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user