From c25aa1a34b9fabf19a5feec55b338fec753647a4 Mon Sep 17 00:00:00 2001 From: alexbegt Date: Fri, 26 Apr 2019 21:01:54 -0400 Subject: [PATCH] Add some comments to the code specific for TOML files. --- .../mantle/pulsar/control/PulseManager.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/slimeknights/mantle/pulsar/control/PulseManager.java b/src/main/java/slimeknights/mantle/pulsar/control/PulseManager.java index 3b0dcd0..e510d8f 100644 --- a/src/main/java/slimeknights/mantle/pulsar/control/PulseManager.java +++ b/src/main/java/slimeknights/mantle/pulsar/control/PulseManager.java @@ -303,7 +303,11 @@ public class PulseManager { return "PulseManager[" + id + "]"; } - //TOML Support Start + /** + * If you go and use PulsarConfig, you will need to call this method after you register all your pulses. + * + * This is due to how TOML configs work; If you try to get the value too early; it throws NullPointerException + */ public void enablePulses() { if(usingATomlConfig) { conf.popBuilder(); @@ -325,16 +329,30 @@ public class PulseManager { } } + /** + * Used for getting the config entry from the pulse meta. + * + * @param meta the pulse meta + * + * @return the config entry + */ private BooleanValue getConfigEntryForConfig(PulseMeta meta) { if (meta.isForced() || !useConfig) return null; return conf.getConfigEntry(meta); } + /** + * Used to check if the pulse should be enabled or not. + * + * @param boolValue the config entry + * @param meta the pulse meta + * + * @return Whether the pulse should be enabled. + */ private boolean getEnabledFromConfig(BooleanValue boolValue, PulseMeta meta) { if (meta.isForced() || !useConfig) return true; // Forced or no config set. return conf.isModuleEnabled(boolValue); } - //TOML Support End }