diff --git a/build.gradle b/build.gradle index b697de6a..708bd1b3 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:6.17.1' + compileOnly 'com.willfp:eco:6.19.0' implementation 'com.willfp:libreforge:3.0.0' compileOnly 'org.jetbrains:annotations:19.0.0' diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java index 8a54ca9e..dbcc057d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java @@ -255,7 +255,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche availableFromLoot = config.getBool(EcoEnchants.OBTAINING_LOCATION + "loot"); maxLevel = config.getInt(EcoEnchants.GENERAL_LOCATION + "maximum-level", 1); displayName = config.getFormattedString("name"); - description = config.getString("description", false); + description = config.getString("description"); disabledWorldNames.clear(); disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds")); disabledWorlds.clear(); @@ -273,7 +273,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche flags.clear(); flags.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "flags")); EnchantmentUtils.registerPlaceholders(this); - for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list", false)) { + for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list")) { List split = Arrays.asList(req.split(":")); if (split.size() < 2) { continue; @@ -284,7 +284,7 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche this.requirements.put(requirement, split.subList(1, split.size())); } requirementLore.clear(); - requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore", false)); + requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore")); postUpdate(); this.register(); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java index 009f871d..54f21476 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java @@ -53,7 +53,7 @@ public class Arborist extends EcoEnchant { List materials = new ArrayList<>(); - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items", false)) { + for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) { Material material = Material.getMaterial(materialName.toUpperCase()); if (material != null) { materials.add(material); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java index 36cb5c08..fdbc0268 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java @@ -60,7 +60,7 @@ public class BlastMining extends EcoEnchant { } Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z)); - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) { + if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { continue; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java index 047b0c68..ae305d98 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java @@ -47,7 +47,7 @@ public class Drill extends EcoEnchant { Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified)); block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) { + if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { continue; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java index 5e11a098..06929c3b 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java @@ -45,7 +45,7 @@ public class Instantaneous extends EcoEnchant { List blacklist = new ArrayList<>(); - for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false)) { + for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks")) { blacklist.add(Material.getMaterial(s)); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java index 8fcb934b..b8701637 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java @@ -29,7 +29,7 @@ public class Lumberjack extends EcoEnchant { @Override protected void postUpdate() { materials = new ArrayList<>(); - for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks", false)) { + for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")) { Material match = Material.getMaterial(string.toUpperCase()); if (match != null) { materials.add(match); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java index 16451029..cd3e6ddb 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java @@ -72,7 +72,7 @@ public class Spearfishing extends EcoEnchant { } List potentialDrops = new ArrayList<>(); - this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops", false).forEach(material -> { + this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops").forEach(material -> { potentialDrops.add(Material.getMaterial(material.toUpperCase())); }); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java index c4606467..f2738f61 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java @@ -39,7 +39,7 @@ public class Transfuse extends EcoEnchant { return; } - if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on", false).contains(block.getType().toString().toLowerCase())) { + if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on").contains(block.getType().toString().toLowerCase())) { return; } @@ -47,10 +47,10 @@ public class Transfuse extends EcoEnchant { Material material; double random = NumberUtils.randFloat(0, 1); - double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size(); + double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size(); int selectedIndex = (int) Math.floor(random / band); - selectedIndex = NumberUtils.equalIfOver(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size() - 1); - String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).get(selectedIndex); + selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1); + String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex); material = Material.getMaterial(materialName.toUpperCase()); if (material == null) { material = Material.COBBLESTONE; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java index 22a03cc6..b7da4cc2 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java @@ -40,7 +40,7 @@ public class Vein extends EcoEnchant { List materials = Collections.singletonList(block.getType()); if (!this.getConfig() - .getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks", false) + .getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks") .contains(block.getType().toString().toLowerCase())) { return; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java index 04ed8bb3..d53bdad6 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java @@ -48,10 +48,10 @@ public class WoodSwitcher extends EcoEnchant { Material material; double random = NumberUtils.randFloat(0, 1); - double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size(); + double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size(); int selectedIndex = (int) Math.floor(random / band); - selectedIndex = NumberUtils.equalIfOver(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).size() - 1); - String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false).get(selectedIndex); + selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1); + String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex); material = Material.getMaterial(materialName.toUpperCase()); if (material == null) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java index d970a022..2732a851 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java @@ -55,7 +55,7 @@ public class Dynamite extends Spell { } Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z)); - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks", false).contains(block1.getType().name().toLowerCase())) { + if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { continue; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java index 1782effa..b0e40957 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java @@ -79,7 +79,7 @@ public abstract class Artifact extends EcoEnchant { @NotNull final Block block, final int level, @NotNull final BlockBreakEvent event) { - if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks", false).contains(block.getType().name().toLowerCase())) { + if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks").contains(block.getType().name().toLowerCase())) { return; } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java index cc5a248e..bc5b8229 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java @@ -105,7 +105,7 @@ public class EnchantmentRarity { double lootProbability = rarityYml.getDouble("rarities." + rarity + ".loot-probability"); String customColor = null; if (rarityYml.getBool("rarities." + rarity + ".custom-color.enabled")) { - customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color", false); + customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color"); } new EnchantmentRarity(rarity, probability, minimumLevel, villagerProbability, lootProbability, customColor).register(); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java index 5304743f..02d2ef0e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java @@ -35,7 +35,7 @@ public class EnchantmentType { public static final EnchantmentType NORMAL = new EnchantmentType( "normal", false, - () -> PLUGIN.getLangYml().getString("normal-color", false) + () -> PLUGIN.getLangYml().getString("normal-color") ); /** @@ -46,7 +46,7 @@ public class EnchantmentType { public static final EnchantmentType CURSE = new EnchantmentType( "curse", false, - () -> PLUGIN.getLangYml().getString("curse-color", false) + () -> PLUGIN.getLangYml().getString("curse-color") ); /** @@ -57,7 +57,7 @@ public class EnchantmentType { public static final EnchantmentType SPECIAL = new EnchantmentType( "special", () -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"), - () -> PLUGIN.getLangYml().getString("special-color", false) + () -> PLUGIN.getLangYml().getString("special-color") ); /** @@ -68,7 +68,7 @@ public class EnchantmentType { public static final EnchantmentType ARTIFACT = new EnchantmentType( "artifact", () -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"), - () -> PLUGIN.getLangYml().getString("artifact-color", false), + () -> PLUGIN.getLangYml().getString("artifact-color"), Artifact.class ); @@ -80,7 +80,7 @@ public class EnchantmentType { public static final EnchantmentType SPELL = new EnchantmentType( "spell", true, - () -> PLUGIN.getLangYml().getString("spell-color", false), + () -> PLUGIN.getLangYml().getString("spell-color"), Spell.class ); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java index 7bb21181..12d07300 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java @@ -63,7 +63,7 @@ public class EnchantingListeners extends PluginDependent implements L @ConfigUpdater public static void update(@NotNull final EcoEnchantsPlugin plugin) { SECONDARY_ENCHANTABLE.clear(); - for (String string : plugin.getTargetYml().getStrings("extra-enchantable-items", false)) { + for (String string : plugin.getTargetYml().getStrings("extra-enchantable-items")) { SECONDARY_ENCHANTABLE.add(Material.matchMaterial(string.toUpperCase())); } } diff --git a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java index a6793d2b..3ca79c63 100644 --- a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java +++ b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java @@ -48,7 +48,7 @@ public class Rainbow extends EcoEnchant { List materials = new ArrayList<>(); - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items", false)) { + for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) { Material material = Material.getMaterial(materialName.toUpperCase()); if (material != null) { materials.add(material); diff --git a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java b/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java index a8ce8128..dce76411 100644 --- a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java +++ b/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java @@ -67,7 +67,7 @@ public class SoftTouch extends EcoEnchant { name = name.replace("[", "").replace("]", ""); meta.setDisplayName(name); - List lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore", false); + List lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore"); lore.replaceAll(s -> s.replace("%type%", entityName)); meta.setLore(lore); diff --git a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java index 773262b9..19479021 100644 --- a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java +++ b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java @@ -56,7 +56,7 @@ public class Xray extends Spell { List materials = new ArrayList<>(); - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks", false)) { + for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks")) { Material material = Material.getMaterial(materialName.toUpperCase()); if (material != null) { materials.add(material);