From 9fa4587ddea0b883a0f223057e38b8a0821cd0cf Mon Sep 17 00:00:00 2001 From: Intybyte Date: Wed, 4 Dec 2024 21:50:52 +0100 Subject: [PATCH] Move some methods out of config and check properly if movecraft classes are present --- .../main/java/at/pavlov/cannons/Cannons.java | 20 ++++++++++++++++--- .../java/at/pavlov/cannons/config/Config.java | 5 +---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cannons-bukkit/src/main/java/at/pavlov/cannons/Cannons.java b/cannons-bukkit/src/main/java/at/pavlov/cannons/Cannons.java index a9a7b878..0dbdf2c4 100644 --- a/cannons-bukkit/src/main/java/at/pavlov/cannons/Cannons.java +++ b/cannons-bukkit/src/main/java/at/pavlov/cannons/Cannons.java @@ -85,9 +85,19 @@ public static Cannons getPlugin() { public void onLoad() { //must be done in onLoad because "movecraft" + this.config = new Config(this); + + if (!config.isMovecraftEnabled()) { + return; + } + try { - MaxCannonsProperty.register(); - } catch (Exception ignored) {} + Class.forName("net.countercraft.movecraft.craft.type.property.Property"); + } catch (Exception ignored) { + return; + } + + MaxCannonsProperty.register(); } public void onDisable() { @@ -118,10 +128,14 @@ public void onDisable() { public void onEnable() { DesignStorage.initialize(this); - this.config = new Config(this); ProjectileManager.initialize(this); CannonSelector.initialize(this); + DesignStorage.getInstance().loadCannonDesigns(); + config.getProjectileStorage().loadProjectiles(); + config.getCannonManager().updateCannons(); + config.getUserMessage().loadLanguage(); + pm = getServer().getPluginManager(); if (!checkWorldEdit()) { diff --git a/cannons-bukkit/src/main/java/at/pavlov/cannons/config/Config.java b/cannons-bukkit/src/main/java/at/pavlov/cannons/config/Config.java index 0d2fa94f..76187d34 100644 --- a/cannons-bukkit/src/main/java/at/pavlov/cannons/config/Config.java +++ b/cannons-bukkit/src/main/java/at/pavlov/cannons/config/Config.java @@ -211,10 +211,7 @@ public void loadConfig() setCancelItems(ParseUtils.toItemHolderList(config.getStringList("cancelEventForLoadingItem"))); //load other configs - DesignStorage.getInstance().loadCannonDesigns(); - projectileStorage.loadProjectiles(); - cannonManager.updateCannons(); - userMessage.loadLanguage(); + plugin.setDebugMode(debugMode); }