From ea9c5a1b19d29d6f055d842384ea87697851450f Mon Sep 17 00:00:00 2001 From: asofold Date: Sat, 26 Nov 2016 14:52:47 +0100 Subject: [PATCH] FastConsume: disable the instanteat check on reloading the configuration. --- .../nocheatplus/checks/inventory/FastConsume.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/NCPCompatBukkit/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/FastConsume.java b/NCPCompatBukkit/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/FastConsume.java index a58633d9..762aac11 100644 --- a/NCPCompatBukkit/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/FastConsume.java +++ b/NCPCompatBukkit/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/FastConsume.java @@ -28,6 +28,7 @@ import fr.neatmonster.nocheatplus.checks.Check; import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.ViolationData; import fr.neatmonster.nocheatplus.compat.BridgeHealth; +import fr.neatmonster.nocheatplus.components.registry.feature.INotifyReload; import fr.neatmonster.nocheatplus.config.ConfPaths; import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.logging.StaticLog; @@ -42,7 +43,7 @@ import fr.neatmonster.nocheatplus.utilities.TickTask; * @author mc_dev * */ -public class FastConsume extends Check implements Listener{ +public class FastConsume extends Check implements Listener, INotifyReload { @@ -58,6 +59,11 @@ public class FastConsume extends Check implements Listener{ public FastConsume() { super(CheckType.INVENTORY_FASTCONSUME); // Overrides the instant-eat check. + disableInstantEat(); + } + + private void disableInstantEat() { + // TODO: Do this kind of thing via registries later on. ConfigManager.setForAllConfigs(ConfPaths.INVENTORY_INSTANTEAT_CHECK, false); StaticLog.logInfo("Inventory checks: FastConsume is available, disabled InstantEat."); } @@ -147,4 +153,9 @@ public class FastConsume extends Check implements Listener{ return cancel; } + @Override + public void onReload() { + disableInstantEat(); + } + }