Updated to eco 6

This commit is contained in:
Auxilor 2021-07-21 18:40:30 +01:00
parent ab6f52a900
commit 5fc58a1c5e
9 changed files with 18 additions and 23 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)) {

View File

@ -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;

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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<EcoPlugin> 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<EcoPlugin> 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<EcoPlugin> 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<EcoPlugin> 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()) {