From 8f1873e3ebf66f2f84e47972c6dc61e876cbb2ba Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 8 Jan 2022 13:39:46 +0000 Subject: [PATCH] Added EnchantmentConfig#save --- .../config/configs/EnchantmentConfig.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java index 3b6b25d5..cb08e034 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java @@ -120,13 +120,24 @@ public class EnchantmentConfig extends ConfigWrapper { this.getPlugin().getLangYml().set("enchantments." + this.getEnchant().getKey().getKey(), null); try { - if (this.getHandle() instanceof LoadableConfig loadableConfig) { - loadableConfig.save(); - } + this.save(); this.getPlugin().getLangYml().save(); this.getPlugin().getLangYml().clearCache(); } catch (IOException e) { e.printStackTrace(); } } + + /** + * Save if savable config. + */ + public void save() { + try { + if (this.getHandle() instanceof LoadableConfig loadableConfig) { + loadableConfig.save(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } }