mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Fix custom enchantments max level from supported enchantments reseting every restart
This commit is contained in:
parent
be53cbf5bd
commit
55d3ea8765
2 changed files with 6 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.alexcrea"
|
group = "xyz.alexcrea"
|
||||||
version = "1.6.3-test"
|
version = "1.6.4"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// EcoEnchants
|
// EcoEnchants
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ public class EnchantmentApi {
|
||||||
*/
|
*/
|
||||||
public static boolean writeDefaultConfig(CAEnchantment enchantment, boolean override){
|
public static boolean writeDefaultConfig(CAEnchantment enchantment, boolean override){
|
||||||
FileConfiguration config = ConfigHolder.DEFAULT_CONFIG.getConfig();
|
FileConfiguration config = ConfigHolder.DEFAULT_CONFIG.getConfig();
|
||||||
if(!override && config.contains(enchantment.getName())) return false;
|
if(!override && containEnchantment(config, enchantment)) return false;
|
||||||
|
|
||||||
writeDefaultConfig(config, enchantment);
|
writeDefaultConfig(config, enchantment);
|
||||||
|
|
||||||
|
|
@ -178,6 +178,10 @@ public class EnchantmentApi {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean containEnchantment(FileConfiguration config, CAEnchantment enchantment) {
|
||||||
|
return config.contains(enchantment.getName()) || config.contains(enchantment.getKey().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void writeDefaultConfig(FileConfiguration defaultConfig, CAEnchantment enchantment) {
|
private static void writeDefaultConfig(FileConfiguration defaultConfig, CAEnchantment enchantment) {
|
||||||
defaultConfig.set("enchant_limits." + enchantment.getKey(), enchantment.defaultMaxLevel());
|
defaultConfig.set("enchant_limits." + enchantment.getKey(), enchantment.defaultMaxLevel());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue