diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index 1d2fbbc3..32c26043 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -189,15 +189,16 @@ public class EnchantDisplay extends DisplayModule { return; } + FastItemStack fast = FastItemStack.wrap(itemStack); + + List lore = fast.getLore(); + lore.removeIf(s -> s.startsWith("§w")); + fast.setLore(lore); + ItemMeta meta = itemStack.getItemMeta(); assert meta != null; - List lore = meta.getLore() == null ? new ArrayList<>() : new ArrayList<>(meta.getLore()); - - lore.removeIf(s -> s.startsWith("§w")); - meta.setLore(lore); - meta.getPersistentDataContainer().remove(legacyV); if (!meta.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java index 8be84217..53e3c73a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java @@ -55,6 +55,10 @@ public class Necrotic extends EcoEnchant { return; } + if (!event.getEntity().getMetadata("eco-target").isEmpty()) { + return; + } + ItemStack item = new ItemStack(Material.WITHER_SKELETON_SKULL, 1); new DropQueue(player) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java index 9841544e..e1225eec 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java @@ -1,10 +1,12 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; +import com.willfp.eco.core.integrations.anticheat.AnticheatManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityShootBowEvent; import org.jetbrains.annotations.NotNull; @@ -20,6 +22,9 @@ public class Rapid extends EcoEnchant { @NotNull final Arrow arrow, final int level, @NotNull final EntityShootBowEvent event) { + if (shooter instanceof Player player) { + AnticheatManager.exemptPlayer(player); + } double multiplier = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-faster-per-level") / 100) * level); if (event.getForce() < multiplier) { @@ -28,5 +33,9 @@ public class Rapid extends EcoEnchant { double force = 1 / event.getForce(); event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(force)); + + if (shooter instanceof Player player) { + AnticheatManager.unexemptPlayer(player); + } } } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java index 4ad1a095..83341309 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java @@ -4,6 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Trident; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.jetbrains.annotations.NotNull; @@ -21,6 +22,7 @@ public class Bladed extends EcoEnchant { @NotNull final Trident trident, final int level, @NotNull final EntityDamageByEntityEvent event) { + if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return; double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-multiplier"); double damage = event.getDamage(); double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java index e92ee028..099adbbe 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java @@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.jetbrains.annotations.NotNull; @@ -21,6 +22,7 @@ public class Force extends EcoEnchant { @NotNull final Arrow arrow, final int level, @NotNull final EntityDamageByEntityEvent event) { + if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return; double damage = event.getDamage(); double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); double bonus = (multiplier * (level + 6)) + 1; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java index bef73e33..ec92ace3 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java @@ -20,6 +20,7 @@ public class Razor extends EcoEnchant { @NotNull final LivingEntity victim, final int level, @NotNull final EntityDamageByEntityEvent event) { + if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) return; double perLevelMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-damage"); double extra = (level * perLevelMultiplier) + baseDamage; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java index 26ec8e35..e816686a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java @@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.enchantments.util.EnchantChecks; import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -97,9 +97,10 @@ public class Soulbound extends EcoEnchant { player.setMetadata("soulbound-items", this.getPlugin().getMetadataValueFactory().create(soulboundItems)); } - public boolean hasEmptyInventory(@NotNull final Player player) { + public boolean hasSoulboundItems(@NotNull final Player player) { + final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound"); for (ItemStack itemStack : player.getInventory().getContents()) { - if (itemStack != null && itemStack.getType() != Material.AIR) { + if (itemStack != null && itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER)) { return false; } } @@ -110,8 +111,8 @@ public class Soulbound extends EcoEnchant { public void onSoulboundRespawn(@NotNull final PlayerRespawnEvent event) { Player player = event.getPlayer(); - this.getPlugin().getScheduler().runLater(() -> { - if (!hasEmptyInventory(player)) { + this.getPlugin().getScheduler().run(() -> { + if (!hasSoulboundItems(player)) { return; } @@ -137,11 +138,12 @@ public class Soulbound extends EcoEnchant { } player.removeMetadata("soulbound-items", this.getPlugin()); - }, 1); + }); } @EventHandler(priority = EventPriority.HIGHEST) public void onDeath(@NotNull final PlayerDeathEvent event) { - event.getDrops().removeIf(itemStack -> itemStack.getItemMeta().getPersistentDataContainer().has(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER)); + final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound"); + event.getDrops().removeIf(itemStack -> itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER)); } } diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml b/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml index f199eba3..a657fac4 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml @@ -31,6 +31,7 @@ general-config: maximum-level: 5 config: + disable-on-players: false # Should this enchantment only boost damage on mobs base-multiplier: 1.5 # Percent more damage to do as base multiplier: 0.5 # 1 + (Level * Multiplier) is multiplied with the damage # To explain, Bladed V would be 4x more damage: 1.5 + (5*0.5) diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml b/eco-core/core-plugin/src/main/resources/enchants/special/force.yml index 516d905e..9049a13f 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/special/force.yml @@ -30,4 +30,5 @@ general-config: maximum-level: 8 config: + disable-on-players: false # Should this enchantment only boost damage on mobs multiplier: 0.25 # Formula is (multiplier * (level + 6) + 1)*damage | Default functions as power 5 + level, eg force 2 = power 7 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml b/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml index ce353329..a3037d16 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml @@ -32,6 +32,7 @@ general-config: maximum-level: 8 config: + disable-on-players: false # Should this enchantment only boost damage on mobs multiplier: 0.3 # Vanilla sharpness is 0.5*level + 0.5 extra damage. Razor formula is multiplier*level + base extra damage. base-damage: 10 # Vanilla Smite 5/BOA 5 extra damage is 12.5 decrease-if-cooldown: true \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7df2746b..307774d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 8.10.9 +version = 8.10.11 plugin-name = EcoEnchants \ No newline at end of file