diff --git a/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java index 5be7ece32..8823173be 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java @@ -18,7 +18,7 @@ import java.util.List; public class HookHandler { private final List additionalDataSources; - private final PluginConfigSectionHandler configHandler; + private final PluginsConfigSection configHandler; /** * Class constructor, hooks to plugins. @@ -27,7 +27,7 @@ public class HookHandler { */ public HookHandler(Plan plugin) { additionalDataSources = new ArrayList<>(); - configHandler = new PluginConfigSectionHandler(plugin); + configHandler = new PluginsConfigSection(); try { Bridge.hook(this); } catch (Exception e) { diff --git a/Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginConfigSectionHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginsConfigSection.java similarity index 72% rename from Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginConfigSectionHandler.java rename to Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginsConfigSection.java index 6d118f3ba..669101ea3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginConfigSectionHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/plugin/PluginsConfigSection.java @@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.data.plugin; import com.djrapitops.plugin.api.config.ConfigNode; import com.djrapitops.plugin.api.utility.log.Log; -import main.java.com.djrapitops.plan.Plan; +import main.java.com.djrapitops.plan.systems.store.config.ConfigSystem; import java.io.IOException; @@ -13,25 +13,17 @@ import java.io.IOException; * @author Rsl1122 * @since 3.5.0 */ -public class PluginConfigSectionHandler { - - private final Plan plan; - - public PluginConfigSectionHandler(Plan plan) { - this.plan = plan; - } +public class PluginsConfigSection { public boolean hasSection(PluginData dataSource) { ConfigNode section = getPluginsSection(); String pluginName = dataSource.getSourcePlugin(); - if (!section.getChildren().containsKey(pluginName)) { - return false; - } - return section.getConfigNode(pluginName).getChildren().containsKey("Enabled"); + return section.getChildren().containsKey(pluginName) + && section.getConfigNode(pluginName).getChildren().containsKey("Enabled"); } private ConfigNode getPluginsSection() { - return plan.getMainConfig().getConfigNode("Plugins"); + return ConfigSystem.getInstance().getConfig().getConfigNode("Plugins"); } public void createSection(PluginData dataSource) {