mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2025-01-23 21:41:20 +01:00
- (change) Set speed is disabled by default and needs to be anabled by
the config flag. - (add) Enable flags for the built in generic hooks.
This commit is contained in:
parent
2cd9c9f0a2
commit
827617eeb6
@ -25,6 +25,10 @@ STACK
|
|||||||
VERSION HISTORY
|
VERSION HISTORY
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
(5.3.0)
|
||||||
|
- (change) Set speed is disabled by default and needs to be anabled by the config flag.
|
||||||
|
- (add) Enable flags for the built in generic hooks.
|
||||||
|
|
||||||
(5.2.0)
|
(5.2.0)
|
||||||
- (add) Add hook to set player speed (simple).
|
- (add) Add hook to set player speed (simple).
|
||||||
|
|
||||||
|
@ -125,19 +125,26 @@ public class CompatNoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
* Add standard hooks if available.
|
* Add standard hooks if available.
|
||||||
*/
|
*/
|
||||||
private void addAvailableHooks() {
|
private void addAvailableHooks() {
|
||||||
try{
|
// Set speed
|
||||||
hookSetSpeed = new me.asofold.bpl.cncp.hooks.generic.HookSetSpeed();
|
if (settings.setSpeedEnabled){
|
||||||
hookSetSpeed.setFlySpeed(settings.flySpeed);
|
try{
|
||||||
hookSetSpeed.setWalkSpeed(settings.walkSpeed);
|
hookSetSpeed = new me.asofold.bpl.cncp.hooks.generic.HookSetSpeed();
|
||||||
hookSetSpeed.init();
|
hookSetSpeed.setFlySpeed(settings.flySpeed);
|
||||||
addHook(hookSetSpeed);
|
hookSetSpeed.setWalkSpeed(settings.walkSpeed);
|
||||||
|
hookSetSpeed.init();
|
||||||
|
addHook(hookSetSpeed);
|
||||||
|
}
|
||||||
|
catch (Throwable t){}
|
||||||
}
|
}
|
||||||
catch (Throwable t){}
|
// Citizens 2
|
||||||
try{
|
try{
|
||||||
addHook(new me.asofold.bpl.cncp.hooks.citizens2.HookCitizens2());
|
addHook(new me.asofold.bpl.cncp.hooks.citizens2.HookCitizens2());
|
||||||
}
|
}
|
||||||
catch (Throwable t){}
|
catch (Throwable t){}
|
||||||
addHook(hookPlayerClass);
|
// Player class (NPCs, Citizens 1)
|
||||||
|
if (settings.playerClassEnabled)
|
||||||
|
addHook(hookPlayerClass);
|
||||||
|
// mcMMO
|
||||||
try{
|
try{
|
||||||
addHook(new me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO());
|
addHook(new me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO());
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,12 @@ public class Settings {
|
|||||||
public Set<String> loadPlugins = new LinkedHashSet<String>();
|
public Set<String> loadPlugins = new LinkedHashSet<String>();
|
||||||
public Set<String> exemptPlayerClassNames = new HashSet<String>();
|
public Set<String> exemptPlayerClassNames = new HashSet<String>();
|
||||||
|
|
||||||
|
public boolean playerClassEnabled = true;
|
||||||
public boolean exemptAllPlayerClassNames = true;
|
public boolean exemptAllPlayerClassNames = true;
|
||||||
public String playerClassName = "CraftPlayer";
|
public String playerClassName = "CraftPlayer";
|
||||||
public boolean exemptSuperClass = true;
|
public boolean exemptSuperClass = true;
|
||||||
|
|
||||||
|
public boolean setSpeedEnabled = false;
|
||||||
public float flySpeed = 1.0f;
|
public float flySpeed = 1.0f;
|
||||||
public float walkSpeed = 1.0f;
|
public float walkSpeed = 1.0f;
|
||||||
|
|
||||||
@ -28,10 +30,12 @@ public class Settings {
|
|||||||
Settings ref = new Settings();
|
Settings ref = new Settings();
|
||||||
cfg.set("plugins.force-enable-later", ConfigUtil.asList(new String[]{ "NoCheatPlus" }));
|
cfg.set("plugins.force-enable-later", ConfigUtil.asList(new String[]{ "NoCheatPlus" }));
|
||||||
cfg.set("plugins.ensure-enable", ConfigUtil.asList(new String[]{ "WorldGuard" }));
|
cfg.set("plugins.ensure-enable", ConfigUtil.asList(new String[]{ "WorldGuard" }));
|
||||||
|
cfg.set("hooks.player-class.enabled", ref.playerClassEnabled);
|
||||||
cfg.set("hooks.player-class.exempt-names", new LinkedList<String>());
|
cfg.set("hooks.player-class.exempt-names", new LinkedList<String>());
|
||||||
cfg.set("hooks.player-class.exempt-all", ref.exemptAllPlayerClassNames);
|
cfg.set("hooks.player-class.exempt-all", ref.exemptAllPlayerClassNames);
|
||||||
cfg.set("hooks.player-class.class-name", ref.playerClassName);
|
cfg.set("hooks.player-class.class-name", ref.playerClassName);
|
||||||
cfg.set("hooks.player-class.super-class", ref.exemptSuperClass);
|
cfg.set("hooks.player-class.super-class", ref.exemptSuperClass);
|
||||||
|
cfg.set("hooks.set-speed.enabled", ref.setSpeedEnabled);
|
||||||
cfg.set("hooks.set-speed.fly-speed", ref.flySpeed);
|
cfg.set("hooks.set-speed.fly-speed", ref.flySpeed);
|
||||||
cfg.set("hooks.set-speed.walk-speed", ref.walkSpeed);
|
cfg.set("hooks.set-speed.walk-speed", ref.walkSpeed);
|
||||||
cfg.set("hooks.prevent-add", new LinkedList<String>());
|
cfg.set("hooks.prevent-add", new LinkedList<String>());
|
||||||
@ -48,12 +52,18 @@ public class Settings {
|
|||||||
ConfigUtil.readStringSetFromList(cfg, "plugins.force-enable-later", forceEnableLater, true, true, false);
|
ConfigUtil.readStringSetFromList(cfg, "plugins.force-enable-later", forceEnableLater, true, true, false);
|
||||||
ConfigUtil.readStringSetFromList(cfg, "plugins.ensure-enable", loadPlugins, true, true, false);
|
ConfigUtil.readStringSetFromList(cfg, "plugins.ensure-enable", loadPlugins, true, true, false);
|
||||||
// Generic player class name hook:
|
// Generic player class name hook:
|
||||||
|
playerClassEnabled = cfg.getBoolean("hooks.player-class.enabled", ref.playerClassEnabled);
|
||||||
ConfigUtil.readStringSetFromList(cfg, "hooks.player-class.exempt-names", exemptPlayerClassNames, true, true, false);
|
ConfigUtil.readStringSetFromList(cfg, "hooks.player-class.exempt-names", exemptPlayerClassNames, true, true, false);
|
||||||
exemptAllPlayerClassNames = cfg.getBoolean("hooks.player-class.exempt-all", ref.exemptAllPlayerClassNames);
|
exemptAllPlayerClassNames = cfg.getBoolean("hooks.player-class.exempt-all", ref.exemptAllPlayerClassNames);
|
||||||
playerClassName = cfg.getString("hooks.player-class.class-name", ref.playerClassName);
|
playerClassName = cfg.getString("hooks.player-class.class-name", ref.playerClassName);
|
||||||
exemptSuperClass = cfg.getBoolean("hooks.player-class.super-class", ref.exemptSuperClass);
|
exemptSuperClass = cfg.getBoolean("hooks.player-class.super-class", ref.exemptSuperClass);
|
||||||
|
|
||||||
|
// Set speed hook
|
||||||
|
setSpeedEnabled = cfg.getBoolean("hooks.set-speed.enabled", ref.setSpeedEnabled);
|
||||||
flySpeed = cfg.getDouble("hooks.set-speed.fly-speed", (double) ref.flySpeed).floatValue();
|
flySpeed = cfg.getDouble("hooks.set-speed.fly-speed", (double) ref.flySpeed).floatValue();
|
||||||
walkSpeed = cfg.getDouble("hooks.set-speed.walk-speed", (double) ref.walkSpeed).floatValue();
|
walkSpeed = cfg.getDouble("hooks.set-speed.walk-speed", (double) ref.walkSpeed).floatValue();
|
||||||
|
|
||||||
|
// General
|
||||||
ConfigUtil.readStringSetFromList(cfg, "hooks.prevent-add", preventAddHooks, true, true, false);
|
ConfigUtil.readStringSetFromList(cfg, "hooks.prevent-add", preventAddHooks, true, true, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user