By default the player-class hook is disabled from now on.

It was mostly used for Citizens 1.
This commit is contained in:
asofold 2013-03-03 13:39:50 +01:00
parent aaede8c4e3
commit 58436abf35

View File

@ -18,6 +18,8 @@ import fr.neatmonster.nocheatplus.hooks.NCPHook;
public final class HookPlayerClass extends AbstractHook implements ConfigurableHook { public final class HookPlayerClass extends AbstractHook implements ConfigurableHook {
private static final boolean defaultEnabled = false;
protected final Set<String> classNames = new HashSet<String>(); protected final Set<String> classNames = new HashSet<String>();
protected boolean exemptAll = true; protected boolean exemptAll = true;
@ -26,7 +28,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
protected Object ncpHook = null; protected Object ncpHook = null;
protected boolean enabled = true; protected boolean enabled = defaultEnabled;
/** /**
* Normal class name. * Normal class name.
@ -92,7 +94,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
@Override @Override
public void applyConfig(CompatConfig cfg, String prefix) { public void applyConfig(CompatConfig cfg, String prefix) {
enabled = cfg.getBoolean(prefix + "player-class.enabled", true); enabled = cfg.getBoolean(prefix + "player-class.enabled", defaultEnabled);
ConfigUtil.readStringSetFromList(cfg, prefix + "player-class.exempt-names", classNames, true, true, false); ConfigUtil.readStringSetFromList(cfg, prefix + "player-class.exempt-names", classNames, true, true, false);
exemptAll = cfg.getBoolean(prefix + "player-class.exempt-all", true); exemptAll = cfg.getBoolean(prefix + "player-class.exempt-all", true);
ConfigUtil.readStringSetFromList(cfg, prefix + "player-class.class-names", playerClassNames, true, true, false); ConfigUtil.readStringSetFromList(cfg, prefix + "player-class.class-names", playerClassNames, true, true, false);
@ -102,7 +104,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
@Override @Override
public boolean updateConfig(CompatConfig cfg, String prefix) { public boolean updateConfig(CompatConfig cfg, String prefix) {
CompatConfig defaults = CompatConfigFactory.getConfig(null); CompatConfig defaults = CompatConfigFactory.getConfig(null);
defaults.set(prefix + "player-class.enabled", true); defaults.set(prefix + "player-class.enabled", defaultEnabled);
defaults.set(prefix + "player-class.exempt-names", new LinkedList<String>()); defaults.set(prefix + "player-class.exempt-names", new LinkedList<String>());
defaults.set(prefix + "player-class.exempt-all", true); defaults.set(prefix + "player-class.exempt-all", true);
defaults.set(prefix + "player-class.class-names", new LinkedList<String>(playerClassNames)); defaults.set(prefix + "player-class.class-names", new LinkedList<String>(playerClassNames));