From 5fc58a1c5e192d863938f97c37e0aead50b398a7 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 21 Jul 2021 18:40:30 +0100 Subject: [PATCH] Updated to eco 6 --- .../ecoenchants/display/EnchantmentCache.java | 2 +- .../ecoenchants/enchantments/EcoEnchants.java | 2 +- .../enchantments/ecoenchants/normal/Shockwave.java | 5 ++--- .../ecoenchants/normal/Spearfishing.java | 3 +-- .../enchantments/ecoenchants/normal/Splash.java | 3 +-- .../ecoenchants/normal/Telekinesis.java | 9 ++++----- .../enchantments/meta/EnchantmentTarget.java | 2 +- .../enchantments/meta/EnchantmentType.java | 2 +- .../enchantments/util/WatcherTriggers.java | 13 ++++++------- 9 files changed, 18 insertions(+), 23 deletions(-) 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 2a48b00f..8a141129 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 @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.display; import com.google.common.collect.ImmutableMap; -import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.eco.core.display.Display; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; 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 21f3e016..d3e6a64b 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 @@ -3,7 +3,7 @@ package com.willfp.ecoenchants.enchantments; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableList; -import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AngerArtifact; import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AshArtifact; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java index 19495402..da9b170a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java @@ -1,7 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; @@ -33,8 +32,8 @@ public class Shockwave extends EcoEnchant { } ItemStack item = player.getInventory().getItemInMainHand(); - if (entity instanceof Trident) { - item = TridentUtils.getItemStack((Trident) entity); + if (entity instanceof Trident trident) { + item = trident.getItem(); } if (!EnchantChecks.item(item, this)) { 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 8b8bc2f8..0b1b2c28 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 @@ -2,7 +2,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; import com.willfp.eco.core.drops.DropQueue; import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; @@ -51,7 +50,7 @@ public class Spearfishing extends EcoEnchant { return; } - ItemStack item = TridentUtils.getItemStack(trident); + ItemStack item = trident.getItem(); if (!EnchantChecks.item(item, this)) { return; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java index de619dd3..66c9feea 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java @@ -1,7 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; @@ -30,7 +29,7 @@ public class Splash extends EcoEnchant { @NotNull final ProjectileHitEvent event) { Trident trident = (Trident) event.getEntity(); - ItemStack item = TridentUtils.getItemStack(trident); + ItemStack item = trident.getItem(); if (!EnchantChecks.item(item, this)) { return; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java index 7aa3f641..e37648bd 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java @@ -4,7 +4,6 @@ import com.willfp.eco.core.drops.DropQueue; import com.willfp.eco.core.events.EntityDeathByEntityEvent; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; @@ -150,10 +149,10 @@ public class Telekinesis extends EcoEnchant { player = (Player) ((Arrow) event.getKiller()).getShooter(); item = player.getInventory().getItemInMainHand(); } - } else if (event.getKiller() instanceof Trident) { - if (((Trident) event.getKiller()).getShooter() instanceof Player) { - player = (Player) ((Trident) event.getKiller()).getShooter(); - item = TridentUtils.getItemStack((Trident) event.getKiller()); + } else if (event.getKiller() instanceof Trident trident) { + if (trident.getShooter() instanceof Player) { + player = (Player) trident.getShooter(); + item = trident.getItem(); } } 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 aee37394..4ce201eb 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 @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.enchantments.meta; import com.google.common.collect.ImmutableSet; -import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.ecoenchants.EcoEnchantsPlugin; import lombok.Getter; import org.bukkit.Material; 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 48fd949f..fca04b56 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 @@ -1,7 +1,7 @@ package com.willfp.ecoenchants.enchantments.meta; import com.google.common.collect.ImmutableList; -import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; 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 9b45b31d..ccbf1372 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 @@ -2,12 +2,11 @@ package com.willfp.ecoenchants.enchantments.util; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.config.ConfigUpdater; +import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.eco.core.events.ArmorEquipEvent; import com.willfp.eco.core.events.PlayerJumpEvent; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -148,7 +147,7 @@ public class WatcherTriggers extends PluginDependent implements Liste return; } - ItemStack item = TridentUtils.getItemStack(trident); + ItemStack item = trident.getItem(); if (!allowOnNPC) { if (victim.hasMetadata("NPC")) { @@ -325,8 +324,8 @@ public class WatcherTriggers extends PluginDependent implements Liste ItemStack item = shooter.getEquipment().getItemInMainHand(); - if (projectile instanceof Trident) { - item = TridentUtils.getItemStack((Trident) projectile); + if (projectile instanceof Trident trident) { + item = trident.getItem(); } EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { @@ -441,7 +440,7 @@ public class WatcherTriggers extends PluginDependent implements Liste return; } - ItemStack item = TridentUtils.getItemStack(trident); + ItemStack item = trident.getItem(); EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { if (!enchant.isEnabled()) { @@ -609,7 +608,7 @@ public class WatcherTriggers extends PluginDependent implements Liste } LivingEntity shooter = (LivingEntity) trident.getShooter(); - ItemStack item = TridentUtils.getItemStack(trident); + ItemStack item = trident.getItem(); EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { if (event.isCancelled()) {