From 4b2e3ba533aa733818e18940414702e9d63f2464 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 16 Jul 2021 14:21:19 +0200 Subject: [PATCH] Fixed various codestyle / misc issues --- .../main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java | 2 +- .../java/com/willfp/ecoenchants/display/EnchantmentCache.java | 2 +- .../java/com/willfp/ecoenchants/enchantments/EcoEnchants.java | 2 ++ .../ecoenchants/enchantments/meta/EnchantmentRarity.java | 2 ++ .../ecoenchants/enchantments/meta/EnchantmentTarget.java | 2 ++ .../enchantments/support/obtaining/VillagerListeners.java | 4 +--- .../enchantments/support/vanilla/VanillaEnchantments.java | 3 ++- .../willfp/ecoenchants/enchantments/util/WatcherTriggers.java | 2 ++ 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java index d7c5c40d..ef219551 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java @@ -112,7 +112,7 @@ public class EcoEnchantsPlugin extends EcoPlugin { public void onReload() { targetYml.update(); rarityYml.update(); - ((EnchantDisplay) this.getDisplayModule()).update(); + this.getDisplayModule().update(); EcoEnchants.values().forEach((ecoEnchant -> { HandlerList.unregisterAll(ecoEnchant); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java index a46e674a..2a48b00f 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java @@ -133,7 +133,7 @@ public class EnchantmentCache { String rawName = name; name = color + name; - description.replaceAll(line -> Display.PREFIX + ((EnchantDisplay) PLUGIN.getDisplayModule()).getOptions().getDescriptionOptions().getColor() + line); + description.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line); CACHE.put(enchantment.getKey(), new CacheEntry(enchantment, name, rawName, description, type, rarity)); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java index 6d36a710..bf2ea78d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java @@ -591,6 +591,8 @@ public class EcoEnchants { /** * Update all {@link EcoEnchant}s. + * + * @param plugin Instance of EcoEnchants. */ @ConfigUpdater public static void update(@NotNull final EcoEnchantsPlugin plugin) { 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 2d5da896..22836cb9 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 @@ -92,6 +92,8 @@ public class EnchantmentRarity { /** * Update all rarities. + * + * @param plugin Instance of EcoEnchants. */ @ConfigUpdater public static void update(@NotNull final EcoEnchantsPlugin plugin) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java index 6e4d92e5..aee37394 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java @@ -65,6 +65,8 @@ public class EnchantmentTarget { /** * Update all targets. + * + * @param plugin Instance of EcoEnchants. */ @ConfigUpdater public static void update(@NotNull final EcoEnchantsPlugin plugin) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java index 53eb1584..026a4623 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java @@ -179,9 +179,7 @@ public class VillagerListeners extends PluginDependent implements Lis anyConflicts.set(true); } - EcoEnchant ecoEnchant = enchant; - - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { + if (enchantment.getType().equals(enchant.getType()) && enchant.getType().isSingular()) { anyConflicts.set(true); } }); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java index 32ff836b..3ff5b424 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java @@ -1,6 +1,5 @@ package com.willfp.ecoenchants.enchantments.support.vanilla; -import com.willfp.eco.core.EcoPlugin; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; import com.willfp.ecoenchants.util.ProxyUtils; @@ -33,6 +32,8 @@ public class VanillaEnchantments { /** * Update the map. + * + * @param plugin Instance of EcoEnchants. */ public static void update(@NotNull final EcoEnchantsPlugin plugin) { Map map = new HashMap<>(); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java index f9c9fb2e..9b45b31d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java @@ -51,6 +51,8 @@ public class WatcherTriggers extends PluginDependent implements Liste /** * Update if allowed on npc. + * + * @param plugin Instance of EcoEnchants. */ @ConfigUpdater public static void update(@NotNull final EcoEnchantsPlugin plugin) {