From 971bbe28160bd3e860fcc13dca5b16d63437c9cf Mon Sep 17 00:00:00 2001 From: Reldeam Date: Wed, 2 Mar 2022 09:37:04 +1100 Subject: [PATCH] Reload config on cvtreload/cvtenable command --- .../CustomVillagerTrades.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/online/meinkraft/customvillagertrades/CustomVillagerTrades.java b/src/main/java/online/meinkraft/customvillagertrades/CustomVillagerTrades.java index 922253a..787c4d1 100644 --- a/src/main/java/online/meinkraft/customvillagertrades/CustomVillagerTrades.java +++ b/src/main/java/online/meinkraft/customvillagertrades/CustomVillagerTrades.java @@ -95,11 +95,7 @@ protected CustomVillagerTrades( @Override public void onLoad() { - // create config file if it doesn't exist - createConfig(); - - // load the language config - loadLanguageConfig(); + loadConfig(); // register ConfigurationSerializable classes ConfigurationSerialization.registerClass(VillagerData.class); @@ -147,6 +143,9 @@ public void onLoad() { @Override public void onEnable() { + // ensure config is loaded/reloaded + loadConfig(); + // ensure plugin doesn't get enabled more than once if(loaded) { getLogger().warning(getMessage("pluginAlreadyEnabled")); @@ -274,6 +273,16 @@ public void onDisable() { } + public void loadConfig() { + + // create config file if it doesn't exist + createConfig(); + + // load the language config + loadLanguageConfig(); + + } + @Override public FileConfiguration getTradesConfig() { return tradesConfig;