From 39ec13296ec53f4c227b570f0e50ea4255d741a0 Mon Sep 17 00:00:00 2001 From: nulli0n Date: Mon, 26 Dec 2022 22:10:54 +0600 Subject: [PATCH] v3.2.13 + engine update --- Core/pom.xml | 46 ++++++- .../excellentenchants/ExcellentEnchants.java | 9 +- .../excellentenchants/Placeholders.java | 25 ++++ .../api/enchantment/ExcellentEnchant.java | 65 ++++------ .../enchantment/IEnchantChanceTemplate.java | 5 +- .../enchantment/IEnchantPotionTemplate.java | 4 +- .../command/BookCommand.java | 6 +- .../command/EnchantCommand.java | 6 +- .../command/ListCommand.java | 4 +- .../command/TierbookCommand.java | 3 +- .../excellentenchants/hook/ProtocolHook.java | 115 ++++++++++++++++++ .../manager/EnchantManager.java | 21 ++-- .../manager/EnchantRegister.java | 2 +- .../armor/EnchantElementalProtection.java | 4 +- .../enchants/armor/EnchantFireShield.java | 2 +- .../enchants/armor/EnchantFlameWalker.java | 5 +- .../enchants/armor/EnchantRegrowth.java | 4 +- .../enchants/armor/EnchantSaturation.java | 6 +- .../armor/EnchantSelfDestruction.java | 2 +- .../manager/enchants/bow/EnchantBomber.java | 2 +- .../enchants/bow/EnchantExplosiveArrows.java | 2 +- .../manager/enchants/bow/EnchantGhast.java | 7 +- .../enchants/tool/EnchantBlastMining.java | 5 +- .../enchants/tool/EnchantCurseOfBreaking.java | 2 +- .../enchants/tool/EnchantLuckyMiner.java | 2 +- .../enchants/tool/EnchantTreasures.java | 4 +- .../enchants/tool/EnchantVeinminer.java | 2 +- .../weapon/EnchantBaneOfNetherspawn.java | 10 +- .../enchants/weapon/EnchantCutter.java | 2 +- .../enchants/weapon/EnchantExpHunter.java | 2 +- .../enchants/weapon/EnchantInfernus.java | 2 +- .../enchants/weapon/EnchantRocket.java | 2 +- .../enchants/weapon/EnchantVampire.java | 11 +- .../weapon/EnchantVillageDefender.java | 8 +- .../listeners/EnchantGenericListener.java | 6 +- .../listeners/EnchantHandlerListener.java | 4 +- .../manager/object/EnchantListGUI.java | 23 ++-- .../manager/object/EnchantScaler.java | 5 +- Core/src/main/resources/plugin.yml | 2 +- NMS/pom.xml | 2 +- V1_17_R1/pom.xml | 4 +- V1_18_R2/pom.xml | 4 +- V1_19_R1/pom.xml | 4 +- V1_19_R2/pom.xml | 4 +- .../nms/v1_19_R2/CustomEffectInstance.java | 2 +- pom.xml | 4 +- 46 files changed, 316 insertions(+), 145 deletions(-) create mode 100644 Core/src/main/java/su/nightexpress/excellentenchants/Placeholders.java create mode 100644 Core/src/main/java/su/nightexpress/excellentenchants/hook/ProtocolHook.java diff --git a/Core/pom.xml b/Core/pom.xml index 92ec565..f469c75 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 @@ -25,6 +25,10 @@ sk89q-repo https://maven.enginehub.org/repo/ + + dmulloy2-repo + https://repo.dmulloy2.net/repository/public/ + @@ -33,30 +37,35 @@ spigot-api 1.19.3-R0.1-SNAPSHOT + + su.nexmedia.playerblocktracker + PlayerBlockTracker + 1.0.1 + su.nightexpress.excellentenchants NMS - 3.2.11 + 3.2.13 su.nightexpress.excellentenchants V1_17_R1 - 3.2.11 + 3.2.13 su.nightexpress.excellentenchants V1_18_R2 - 3.2.11 + 3.2.13 su.nightexpress.excellentenchants V1_19_R1 - 3.2.11 + 3.2.13 su.nightexpress.excellentenchants V1_19_R2 - 3.2.11 + 3.2.13 fr.neatmonster @@ -70,6 +79,11 @@ 7.0.6 provided + + com.comphenix.protocol + ProtocolLib + 5.0.0-SNAPSHOT + @@ -84,6 +98,19 @@ org.apache.maven.plugins maven-shade-plugin 3.2.4 + + + + org.ow2.asm + asm + 9.2 + + + org.ow2.asm + asm-commons + 9.2 + + package @@ -95,8 +122,15 @@ su.nightexpress.excellentenchants* + su.nexmedia.playerblocktracker:* + + + su.nexmedia.playerblocktracker. + su.nightexpress.excellentenchants.playerblocktracker. + + diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java index 625c630..b4e5156 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java @@ -6,12 +6,14 @@ import su.nexmedia.engine.NexPlugin; import su.nexmedia.engine.Version; import su.nexmedia.engine.api.command.GeneralCommand; import su.nexmedia.engine.command.list.ReloadSubCommand; +import su.nexmedia.engine.hooks.Hooks; import su.nightexpress.excellentenchants.command.BookCommand; import su.nightexpress.excellentenchants.command.EnchantCommand; import su.nightexpress.excellentenchants.command.ListCommand; import su.nightexpress.excellentenchants.command.TierbookCommand; import su.nightexpress.excellentenchants.config.Config; import su.nightexpress.excellentenchants.config.Lang; +import su.nightexpress.excellentenchants.hook.ProtocolHook; import su.nightexpress.excellentenchants.manager.EnchantManager; import su.nightexpress.excellentenchants.manager.type.FitItemType; import su.nightexpress.excellentenchants.nms.EnchantNMS; @@ -87,7 +89,12 @@ public class ExcellentEnchants extends NexPlugin { @Override public void registerHooks() { - + if (Hooks.hasPlugin("ProtocolLib")) { + ProtocolHook.setup(); + } + else { + this.warn("ProtocolLib is not installed. Enchantments won't be displayed on items."); + } } @Override diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/Placeholders.java b/Core/src/main/java/su/nightexpress/excellentenchants/Placeholders.java new file mode 100644 index 0000000..5656606 --- /dev/null +++ b/Core/src/main/java/su/nightexpress/excellentenchants/Placeholders.java @@ -0,0 +1,25 @@ +package su.nightexpress.excellentenchants; + +public class Placeholders extends su.nexmedia.engine.utils.Placeholders { + + public static final String URL_WIKI = "https://github.com/nulli0n/ExcellentEnchants-spigot/wiki/"; + public static final String URL_PLACEHOLDERS = URL_WIKI + "Internal-Placeholders"; + public static final String URL_ENGINE_SCALE = "https://github.com/nulli0n/NexEngine-spigot/wiki/Configuration-Tips#scalable-sections"; + + public static final String ENCHANTMENT_NAME = "%enchantment_name%"; + public static final String ENCHANTMENT_NAME_FORMATTED = "%enchantment_name_formatted%"; + public static final String ENCHANTMENT_DESCRIPTION = "%enchantment_description%"; + public static final String ENCHANTMENT_LEVEL = "%enchantment_level%"; + public static final String ENCHANTMENT_LEVEL_MIN = "%enchantment_level_min%"; + public static final String ENCHANTMENT_LEVEL_MAX = "%enchantment_level_max%"; + public static final String ENCHANTMENT_CONFLICTS = "%enchantment_conflicts%"; + public static final String ENCHANTMENT_TARGET = "%enchantment_target%"; + public static final String ENCHANTMENT_TIER = "%enchantment_tier%"; + public static final String ENCHANTMENT_FIT_ITEM_TYPES = "%enchantment_fit_item_types%"; + public static final String ENCHANTMENT_OBTAIN_CHANCE_ENCHANTING = "%enchantment_obtain_chance_enchanting%"; + public static final String ENCHANTMENT_OBTAIN_CHANCE_VILLAGER = "%enchantment_obtain_chance_villager%"; + public static final String ENCHANTMENT_OBTAIN_CHANCE_LOOT_GENERATION = "%enchantment_obtain_chance_loot_generation%"; + public static final String ENCHANTMENT_OBTAIN_CHANCE_FISHING = "%enchantment_obtain_chance_fishing%"; + public static final String ENCHANTMENT_OBTAIN_CHANCE_MOB_SPAWNING = "%enchantment_obtain_chance_mob_spawning%"; + public static final String ENCHANTMENT_COST_ITEM = "%enchantment_cost_item%"; +} diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/ExcellentEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/ExcellentEnchant.java index a07789a..04b006e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/ExcellentEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/ExcellentEnchant.java @@ -11,9 +11,7 @@ import org.jetbrains.annotations.Nullable; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.api.manager.IListener; import su.nexmedia.engine.lang.LangManager; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.*; -import su.nexmedia.engine.utils.data.Pair; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.config.Config; @@ -23,6 +21,7 @@ import su.nightexpress.excellentenchants.manager.object.EnchantScaler; import su.nightexpress.excellentenchants.manager.object.EnchantTier; import su.nightexpress.excellentenchants.manager.type.FitItemType; import su.nightexpress.excellentenchants.manager.type.ObtainType; +import su.nightexpress.excellentenchants.Placeholders; import java.util.*; import java.util.function.UnaryOperator; @@ -31,23 +30,6 @@ import java.util.stream.Stream; public abstract class ExcellentEnchant extends Enchantment implements IListener { - public static final String PLACEHOLDER_NAME = "%enchantment_name%"; - public static final String PLACEHOLDER_NAME_FORMATTED = "%enchantment_name_formatted%"; - public static final String PLACEHOLDER_DESCRIPTION = "%enchantment_description%"; - public static final String PLACEHOLDER_LEVEL = "%enchantment_level%"; - public static final String PLACEHOLDER_LEVEL_MIN = "%enchantment_level_min%"; - public static final String PLACEHOLDER_LEVEL_MAX = "%enchantment_level_max%"; - public static final String PLACEHOLDER_CONFLICTS = "%enchantment_conflicts%"; - public static final String PLACEHOLDER_TARGET = "%enchantment_target%"; - public static final String PLACEHOLDER_TIER = "%enchantment_tier%"; - public static final String PLACEHOLDER_FIT_ITEM_TYPES = "%enchantment_fit_item_types%"; - public static final String PLACEHOLDER_OBTAIN_CHANCE_ENCHANTING = "%enchantment_obtain_chance_enchanting%"; - public static final String PLACEHOLDER_OBTAIN_CHANCE_VILLAGER = "%enchantment_obtain_chance_villager%"; - public static final String PLACEHOLDER_OBTAIN_CHANCE_LOOT_GENERATION = "%enchantment_obtain_chance_loot_generation%"; - public static final String PLACEHOLDER_OBTAIN_CHANCE_FISHING = "%enchantment_obtain_chance_fishing%"; - public static final String PLACEHOLDER_OBTAIN_CHANCE_MOB_SPAWNING = "%enchantment_obtain_chance_mob_spawning%"; - public static final String PLACEHOLDER_COST_ITEM = "%enchantment_cost_item%"; - protected final ExcellentEnchants plugin; protected final JYML cfg; protected final String id; @@ -113,6 +95,7 @@ public abstract class ExcellentEnchant extends Enchantment implements IListener this.costItem = cfg.getItem("Settings.Cost.Item"); } + @Deprecated protected void updateConfig() { cfg.addMissing("Is_Treasure", false); cfg.addMissing("Conflicts", new ArrayList()); @@ -192,28 +175,34 @@ public abstract class ExcellentEnchant extends Enchantment implements IListener String conflicts = this.getConflicts().isEmpty() ? plugin.getMessage(Lang.OTHER_NONE).getLocalized() : this.getConflicts().stream().filter(Objects::nonNull).map(LangManager::getEnchantment).collect(Collectors.joining("\n")); return str -> str - .replace(PLACEHOLDER_NAME, this.getDisplayName()) - .replace(PLACEHOLDER_NAME_FORMATTED, this.getNameFormatted(level)) - .replace(PLACEHOLDER_LEVEL, NumberUtil.toRoman(level)) - .replace(PLACEHOLDER_LEVEL_MIN, String.valueOf(this.getStartLevel())) - .replace(PLACEHOLDER_LEVEL_MAX, String.valueOf(this.getMaxLevel())) - .replace(PLACEHOLDER_TARGET, plugin.getLangManager().getEnum(this.getItemTarget())) - .replace(PLACEHOLDER_TIER, this.getTier().getName()) - .replace(PLACEHOLDER_CONFLICTS, conflicts) - .replace(PLACEHOLDER_FIT_ITEM_TYPES, String.join(", ", Stream.of(this.getFitItemTypes()).map(type -> plugin.getLangManager().getEnum(type)).toList())) - .replace(PLACEHOLDER_OBTAIN_CHANCE_ENCHANTING, NumberUtil.format(this.getObtainChance(ObtainType.ENCHANTING))) - .replace(PLACEHOLDER_OBTAIN_CHANCE_VILLAGER, NumberUtil.format(this.getObtainChance(ObtainType.VILLAGER))) - .replace(PLACEHOLDER_OBTAIN_CHANCE_LOOT_GENERATION, NumberUtil.format(this.getObtainChance(ObtainType.LOOT_GENERATION))) - .replace(PLACEHOLDER_OBTAIN_CHANCE_FISHING, NumberUtil.format(this.getObtainChance(ObtainType.FISHING))) - .replace(PLACEHOLDER_OBTAIN_CHANCE_MOB_SPAWNING, NumberUtil.format(this.getObtainChance(ObtainType.MOB_SPAWNING))) - .replace(PLACEHOLDER_COST_ITEM, this.hasCostItem() ? ItemUtil.getItemName(this.costItem) : plugin.getMessage(Lang.OTHER_NONE).getLocalized()) + .replace(Placeholders.ENCHANTMENT_NAME, this.getDisplayName()) + .replace(Placeholders.ENCHANTMENT_NAME_FORMATTED, this.getNameFormatted(level)) + .replace(Placeholders.ENCHANTMENT_LEVEL, NumberUtil.toRoman(level)) + .replace(Placeholders.ENCHANTMENT_LEVEL_MIN, String.valueOf(this.getStartLevel())) + .replace(Placeholders.ENCHANTMENT_LEVEL_MAX, String.valueOf(this.getMaxLevel())) + .replace(Placeholders.ENCHANTMENT_TARGET, plugin.getLangManager().getEnum(this.getItemTarget())) + .replace(Placeholders.ENCHANTMENT_TIER, this.getTier().getName()) + .replace(Placeholders.ENCHANTMENT_CONFLICTS, conflicts) + .replace(Placeholders.ENCHANTMENT_FIT_ITEM_TYPES, String.join(", ", Stream.of(this.getFitItemTypes()).map(type -> plugin.getLangManager().getEnum(type)).toList())) + .replace(Placeholders.ENCHANTMENT_OBTAIN_CHANCE_ENCHANTING, NumberUtil.format(this.getObtainChance(ObtainType.ENCHANTING))) + .replace(Placeholders.ENCHANTMENT_OBTAIN_CHANCE_VILLAGER, NumberUtil.format(this.getObtainChance(ObtainType.VILLAGER))) + .replace(Placeholders.ENCHANTMENT_OBTAIN_CHANCE_LOOT_GENERATION, NumberUtil.format(this.getObtainChance(ObtainType.LOOT_GENERATION))) + .replace(Placeholders.ENCHANTMENT_OBTAIN_CHANCE_FISHING, NumberUtil.format(this.getObtainChance(ObtainType.FISHING))) + .replace(Placeholders.ENCHANTMENT_OBTAIN_CHANCE_MOB_SPAWNING, NumberUtil.format(this.getObtainChance(ObtainType.MOB_SPAWNING))) + .replace(Placeholders.ENCHANTMENT_COST_ITEM, this.hasCostItem() ? ItemUtil.getItemName(this.costItem) : plugin.getMessage(Lang.OTHER_NONE).getLocalized()) ; } + @Override + public void registerListeners() { + this.addConflicts(); + this.plugin.getPluginManager().registerEvents(this, plugin); + } + @NotNull public UnaryOperator formatString(int level) { return str -> this.replacePlaceholders(level).apply(str - .replace(PLACEHOLDER_DESCRIPTION, String.join("\n", Config.formatDescription(this.getDescription()))) + .replace(Placeholders.ENCHANTMENT_DESCRIPTION, String.join("\n", Config.formatDescription(this.getDescription()))) ); } @@ -246,12 +235,6 @@ public abstract class ExcellentEnchant extends Enchantment implements IListener return !Config.isEnchantmentDisabled(this, entity.getWorld().getName()); } - @Override - public void registerListeners() { - this.addConflicts(); - this.plugin.getPluginManager().registerEvents(this, plugin); - } - @NotNull public JYML getConfig() { return this.cfg; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantChanceTemplate.java b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantChanceTemplate.java index c3368f3..a05254e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantChanceTemplate.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantChanceTemplate.java @@ -2,10 +2,11 @@ package su.nightexpress.excellentenchants.api.enchantment; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.manager.object.EnchantScaler; import java.util.function.UnaryOperator; @@ -31,7 +32,7 @@ public abstract class IEnchantChanceTemplate extends ExcellentEnchant { super.updateConfig(); if (cfg.contains("settings.enchant-trigger-chance")) { - String triggerChance = cfg.getString("settings.enchant-trigger-chance", "100").replace("%level%", PLACEHOLDER_LEVEL); + String triggerChance = cfg.getString("settings.enchant-trigger-chance", "100").replace("%level%", Placeholders.ENCHANTMENT_LEVEL); cfg.set("Settings.Trigger_Chance", triggerChance); cfg.set("settings.enchant-trigger-chance", null); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantPotionTemplate.java b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantPotionTemplate.java index 7cd66c7..bc9bb1c 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantPotionTemplate.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/IEnchantPotionTemplate.java @@ -6,8 +6,8 @@ import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.lang.LangManager; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.type.PassiveEnchant; import su.nightexpress.excellentenchants.manager.EnchantManager; @@ -21,7 +21,7 @@ public abstract class IEnchantPotionTemplate extends IEnchantChanceTemplate { public static final String PLACEHOLDER_POTION_DURATION = "%enchantment_potion_duration%"; public static final String PLACEHOLDER_POTION_TYPE = "%enchantment_potion_type%"; - protected PotionEffectType potionEffectType; + protected PotionEffectType potionEffectType; protected final boolean potionParticles; protected Scaler potionDuration; protected Scaler potionLevel; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java b/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java index 7fa3fa3..669c5e9 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java @@ -16,10 +16,10 @@ import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Perms; import su.nightexpress.excellentenchants.config.Lang; -import su.nightexpress.excellentenchants.manager.EnchantManager; import java.util.Arrays; import java.util.List; +import java.util.Map; public class BookCommand extends AbstractCommand { @@ -60,7 +60,7 @@ public class BookCommand extends AbstractCommand { } @Override - public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) { + public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args, @NotNull Map flags) { if (args.length != 4) { this.printUsage(sender); return; @@ -90,7 +90,7 @@ public class BookCommand extends AbstractCommand { meta.addStoredEnchant(enchantment, level, true); item.setItemMeta(meta); - EnchantManager.updateItemLoreEnchants(item); + //EnchantManager.updateItemLoreEnchants(item); PlayerUtil.addItem(player, item); plugin.getMessage(Lang.COMMAND_BOOK_DONE) diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java b/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java index 6533cd4..c714df1 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java @@ -14,10 +14,10 @@ import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Perms; import su.nightexpress.excellentenchants.config.Lang; -import su.nightexpress.excellentenchants.manager.EnchantManager; import java.util.Arrays; import java.util.List; +import java.util.Map; public class EnchantCommand extends AbstractCommand { @@ -55,7 +55,7 @@ public class EnchantCommand extends AbstractCommand { } @Override - public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) { + public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args, @NotNull Map flags) { if (args.length != 3) { this.printUsage(sender); return; @@ -99,7 +99,7 @@ public class EnchantCommand extends AbstractCommand { } } item.setItemMeta(meta); - EnchantManager.updateItemLoreEnchants(item); + //EnchantManager.updateItemLoreEnchants(item); plugin.getMessage(Lang.COMMAND_ENCHANT_DONE).send(sender); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/command/ListCommand.java b/Core/src/main/java/su/nightexpress/excellentenchants/command/ListCommand.java index 54ca8ab..259dce4 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/ListCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/ListCommand.java @@ -8,6 +8,8 @@ import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Perms; import su.nightexpress.excellentenchants.config.Lang; +import java.util.Map; + public class ListCommand extends AbstractCommand { public ListCommand(@NotNull ExcellentEnchants plugin) { @@ -32,7 +34,7 @@ public class ListCommand extends AbstractCommand { } @Override - protected void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) { + protected void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args, @NotNull Map flags) { plugin.getEnchantManager().getEnchantsListGUI().open((Player) sender, 1); } } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java b/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java index f1b2d91..a38a5a7 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java @@ -18,6 +18,7 @@ import su.nightexpress.excellentenchants.manager.object.EnchantTier; import java.util.Arrays; import java.util.List; +import java.util.Map; public class TierbookCommand extends AbstractCommand { @@ -58,7 +59,7 @@ public class TierbookCommand extends AbstractCommand { } @Override - public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) { + public void onExecute(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args, @NotNull Map flags) { if (args.length != 4) { this.printUsage(sender); return; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/hook/ProtocolHook.java b/Core/src/main/java/su/nightexpress/excellentenchants/hook/ProtocolHook.java new file mode 100644 index 0000000..54fbf43 --- /dev/null +++ b/Core/src/main/java/su/nightexpress/excellentenchants/hook/ProtocolHook.java @@ -0,0 +1,115 @@ +package su.nightexpress.excellentenchants.hook; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolManager; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketContainer; +import com.comphenix.protocol.events.PacketEvent; +import org.bukkit.GameMode; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.jetbrains.annotations.Nullable; +import su.nexmedia.engine.utils.ItemUtil; +import su.nightexpress.excellentenchants.ExcellentEnchantsAPI; +import su.nightexpress.excellentenchants.api.enchantment.ExcellentEnchant; +import su.nightexpress.excellentenchants.config.Config; +import su.nightexpress.excellentenchants.manager.EnchantManager; + +import java.util.List; +import java.util.Map; + +public class ProtocolHook { + + private static boolean isRegistered = false; + + public static void setup() { + if (isRegistered) return; + + ProtocolManager manager = ProtocolLibrary.getProtocolManager(); + manager.addPacketListener(new PacketAdapter(ExcellentEnchantsAPI.PLUGIN, PacketType.Play.Server.SET_SLOT) { + @Override + public void onPacketSending(PacketEvent event) { + PacketContainer packet = event.getPacket(); + + ItemStack item = packet.getItemModifier().read(0); + boolean removeOld = event.getPlayer().getGameMode() == GameMode.CREATIVE; + if (removeOld) { + packet.getItemModifier().write(0, remove(item)); + } + else { + packet.getItemModifier().write(0, update(item)); + } + } + }); + + manager.addPacketListener(new PacketAdapter(ExcellentEnchantsAPI.PLUGIN, PacketType.Play.Server.WINDOW_ITEMS) { + @Override + public void onPacketSending(PacketEvent event) { + PacketContainer packet = event.getPacket(); + + List items = packet.getItemListModifier().readSafely(0); + boolean removeOld = event.getPlayer().getGameMode() == GameMode.CREATIVE; + + for (int index = 0; index < items.size(); index++) { + if (removeOld) { + items.set(index, remove(items.get(index))); + } + else { + items.set(index, update(items.get(index))); + } + } + packet.getItemListModifier().write(0, items); + } + }); + + isRegistered = true; + } + + @Nullable + private static ItemStack update(@Nullable ItemStack item) { + if (item == null || item.getType().isAir()) return item; + + ItemStack copy = new ItemStack(item); + ItemMeta meta = copy.getItemMeta(); + if (meta == null) return item; + + List lore = ItemUtil.getLore(copy); + Map enchants = EnchantManager.getItemCustomEnchants(item); + //if (enchants.keySet().stream().anyMatch(enchant -> ItemUtil.getLoreTag(item, enchant.getId()) != null)) { + // return item; + //} + + if (Config.ENCHANTMENTS_DESCRIPTION_ENABLED) { + enchants.forEach((enchant, integer) -> { + lore.addAll(0, Config.formatDescription(enchant.getDescription(integer))); + }); + } + enchants.forEach((enchant, integer) -> { + lore.add(0, enchant.getNameFormatted(integer)); + }); + + meta.setLore(lore); + copy.setItemMeta(meta); + return copy; + } + + @Nullable + private static ItemStack remove(@Nullable ItemStack item) { + if (item == null || item.getType().isAir()) return item; + + List from = ItemUtil.getLore(item); + Map enchants = EnchantManager.getItemCustomEnchants(item); + enchants.forEach((enchant, integer) -> { + from.removeIf(line -> line.equalsIgnoreCase(enchant.getNameFormatted(integer))); + from.removeAll(Config.formatDescription(enchant.getDescription(integer))); + }); + + ItemMeta meta = item.getItemMeta(); + if (meta == null) return item; + + meta.setLore(from); + item.setItemMeta(meta); + return item; + } +} diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantManager.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantManager.java index 65d448e..fc9b9e7 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantManager.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantManager.java @@ -160,10 +160,11 @@ public class EnchantManager extends AbstractManager { return EnchantManager.getItemCustomEnchantsAmount(item) != enchantsHad; } + @Deprecated public static void updateItemLoreEnchants(@NotNull ItemStack item) { EnchantRegister.ENCHANT_LIST.forEach(ench -> { - ItemUtil.delLore(item, ench.getId()); - ItemUtil.delLore(item, ench.getId() + "_info"); + //ItemUtil.delLore(item, ench.getId()); + //ItemUtil.delLore(item, ench.getId() + "_info"); }); // Filter custom enchants and define map order. @@ -172,7 +173,7 @@ public class EnchantManager extends AbstractManager { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (has, add) -> add, LinkedHashMap::new)); excellents.forEach((excellent, level) -> { - ItemUtil.addLore(item, excellent.getId(), excellent.getNameFormatted(level), 0); + //ItemUtil.addLore(item, excellent.getId(), excellent.getNameFormatted(level), 0); }); // Add enchantment description at the end of item lore. @@ -184,7 +185,7 @@ public class EnchantManager extends AbstractManager { List desc = excellent.getDescription(excellents.get(excellent)); if (desc.isEmpty()) return; - ItemUtil.addLore(item, excellent.getId() + "_info", Config.formatDescription(desc), -1); + //ItemUtil.addLore(item, excellent.getId() + "_info", Config.formatDescription(desc), -1); }); } } @@ -194,9 +195,9 @@ public class EnchantManager extends AbstractManager { EnchantManager.removeEnchant(item, enchantment); - if (enchantment instanceof ExcellentEnchant excellentEnchant) { - ItemUtil.addLore(item, excellentEnchant.getId(), excellentEnchant.getNameFormatted(level), 0); - } + //if (enchantment instanceof ExcellentEnchant excellentEnchant) { + //ItemUtil.addLore(item, excellentEnchant.getId(), excellentEnchant.getNameFormatted(level), 0); + //} ItemMeta meta = item.getItemMeta(); if (meta == null) return false; @@ -213,9 +214,9 @@ public class EnchantManager extends AbstractManager { } public static void removeEnchant(@NotNull ItemStack item, @NotNull Enchantment enchantment) { - if (enchantment instanceof ExcellentEnchant excellentEnchant) { - ItemUtil.delLore(item, excellentEnchant.getId()); - } + //if (enchantment instanceof ExcellentEnchant excellentEnchant) { + //ItemUtil.delLore(item, excellentEnchant.getId()); + //} ItemMeta meta = item.getItemMeta(); if (meta instanceof EnchantmentStorageMeta storageMeta) { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantRegister.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantRegister.java index 9187838..c95735e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantRegister.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/EnchantRegister.java @@ -90,7 +90,7 @@ public class EnchantRegister { static { PLUGIN = ExcellentEnchants.getPlugin(ExcellentEnchants.class); - PLUGIN.getConfigManager().extract("enchants"); + PLUGIN.getConfigManager().extractResources("/enchants/"); ENCHANT_LIST = new HashSet<>(); // Tool enchants diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantElementalProtection.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantElementalProtection.java index a6be031..801bc1a 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantElementalProtection.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantElementalProtection.java @@ -8,10 +8,10 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.ArrayUtil; import su.nexmedia.engine.utils.EntityUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; @@ -83,7 +83,7 @@ public class EnchantElementalProtection extends IEnchantChanceTemplate { if (!this.isEnchantmentAvailable(victim)) return; double protectionAmount = 0D; - for (ItemStack armor : EntityUtil.getArmor(victim)) { + for (ItemStack armor : EntityUtil.getEquippedArmor(victim).values()) { if (armor == null || armor.getType().isAir()) continue; int level = EnchantManager.getItemEnchantLevel(armor, this); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFireShield.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFireShield.java index 229e278..d177944 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFireShield.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFireShield.java @@ -6,8 +6,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFlameWalker.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFlameWalker.java index 0bca191..d4bfe21 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFlameWalker.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantFlameWalker.java @@ -19,10 +19,11 @@ import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.api.manager.ICleanable; import su.nexmedia.engine.api.task.AbstractTask; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; +import su.nexmedia.engine.utils.Scaler; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; import su.nightexpress.excellentenchants.api.enchantment.type.MoveEnchant; @@ -60,7 +61,7 @@ public class EnchantFlameWalker extends IEnchantChanceTemplate implements MoveEn protected void updateConfig() { super.updateConfig(); - cfg.addMissing("Settings.Block_Decay", "5.0 + " + PLACEHOLDER_LEVEL + " * 2"); + cfg.addMissing("Settings.Block_Decay", "5.0 + " + Placeholders.ENCHANTMENT_LEVEL + " * 2"); } @Override diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantRegrowth.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantRegrowth.java index decce70..eeda95e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantRegrowth.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantRegrowth.java @@ -7,10 +7,10 @@ import org.bukkit.entity.LivingEntity; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.api.manager.ICleanable; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.EntityUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.ExcellentEnchant; @@ -30,7 +30,7 @@ public class EnchantRegrowth extends IEnchantChanceTemplate implements PassiveEn private String particleData; private long healthInterval; private Scaler healthAmount; - private Task healthTask; + private Task healthTask; private static final String PLACEHOLDER_HEALTH_AMOUNT = "%enchantment_health_amount%"; private static final String PLACEHOLDER_HEALTH_INTERVAL = "%enchantment_health_interval%"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSaturation.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSaturation.java index 1a2dd17..7af96ca 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSaturation.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSaturation.java @@ -6,8 +6,8 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.api.manager.ICleanable; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.ExcellentEnchant; @@ -21,9 +21,9 @@ import java.util.function.UnaryOperator; public class EnchantSaturation extends IEnchantChanceTemplate implements PassiveEnchant, ICleanable { - private long saturationInterval; + private long saturationInterval; private Scaler saturationAmount; - private Task saturationTask; + private Task saturationTask; public static final String ID = "saturation"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSelfDestruction.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSelfDestruction.java index 42ff188..01def0c 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSelfDestruction.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/armor/EnchantSelfDestruction.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantBomber.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantBomber.java index 380d136..3b3208a 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantBomber.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantBomber.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantExplosiveArrows.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantExplosiveArrows.java index ea01d3b..11adde2 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantExplosiveArrows.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantExplosiveArrows.java @@ -13,8 +13,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantBowTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantGhast.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantGhast.java index 9f8d4f7..4e18d5f 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantGhast.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/bow/EnchantGhast.java @@ -12,8 +12,9 @@ import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; import su.nightexpress.excellentenchants.api.enchantment.type.BowEnchant; @@ -23,7 +24,7 @@ import su.nightexpress.excellentenchants.manager.object.EnchantScaler; public class EnchantGhast extends IEnchantChanceTemplate implements BowEnchant { private boolean fireSpread; - private Scaler yield; + private Scaler yield; public static final String ID = "ghast"; @@ -43,7 +44,7 @@ public class EnchantGhast extends IEnchantChanceTemplate implements BowEnchant { super.updateConfig(); cfg.addMissing("Settings.Fire_Spread", true); - cfg.addMissing("Settings.Yield", "1.0 * " + PLACEHOLDER_LEVEL); + cfg.addMissing("Settings.Yield", "1.0 * " + Placeholders.ENCHANTMENT_LEVEL); } public boolean isFireSpread() { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantBlastMining.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantBlastMining.java index e6061ae..f28dab5 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantBlastMining.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantBlastMining.java @@ -14,9 +14,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant; @@ -68,7 +69,7 @@ public class EnchantBlastMining extends IEnchantChanceTemplate implements BlockB protected void updateConfig() { super.updateConfig(); - cfg.addMissing("Settings.Min_Block_Strength", "1.5 - " + PLACEHOLDER_LEVEL + " / 10.0"); + cfg.addMissing("Settings.Min_Block_Strength", "1.5 - " + Placeholders.ENCHANTMENT_LEVEL + " / 10.0"); } @Override diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantCurseOfBreaking.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantCurseOfBreaking.java index 8ca176b..0c00d63 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantCurseOfBreaking.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantCurseOfBreaking.java @@ -8,8 +8,8 @@ import org.bukkit.event.player.PlayerItemDamageEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantLuckyMiner.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantLuckyMiner.java index 890b7f7..1c31f34 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantLuckyMiner.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantLuckyMiner.java @@ -6,8 +6,8 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantTreasures.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantTreasures.java index e437b16..fbef4b8 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantTreasures.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantTreasures.java @@ -13,11 +13,11 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import su.nexmedia.engine.api.config.JYML; import su.nexmedia.engine.api.manager.ICleanable; -import su.nexmedia.engine.manager.player.blocktracker.PlayerBlockTracker; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.LocationUtil; import su.nexmedia.engine.utils.MessageUtil; import su.nexmedia.engine.utils.random.Rnd; +import su.nexmedia.playerblocktracker.PlayerBlockTracker; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantDropContainer; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; @@ -42,7 +42,7 @@ public class EnchantTreasures extends IEnchantChanceTemplate implements CustomDr public EnchantTreasures(@NotNull ExcellentEnchants plugin, @NotNull JYML cfg) { super(plugin, cfg, EnchantPriority.MEDIUM); - PlayerBlockTracker.initialize(); + PlayerBlockTracker.initialize(plugin); PlayerBlockTracker.BLOCK_FILTERS.add(this.blockTracker = (block) -> { return this.getTreasure(block.getType()) != null; }); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantVeinminer.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantVeinminer.java index 82034cf..62894bf 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantVeinminer.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/tool/EnchantVeinminer.java @@ -11,9 +11,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.LocationUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantBaneOfNetherspawn.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantBaneOfNetherspawn.java index ca40ac4..d6cc057 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantBaneOfNetherspawn.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantBaneOfNetherspawn.java @@ -9,9 +9,9 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; @@ -23,10 +23,10 @@ import java.util.function.UnaryOperator; public class EnchantBaneOfNetherspawn extends IEnchantChanceTemplate implements CombatEnchant { - private String particleName; - private String particleData; - private boolean damageModifier; - private Scaler damageFormula; + private String particleName; + private String particleData; + private boolean damageModifier; + private Scaler damageFormula; private final Set entityTypes; public static final String ID = "bane_of_netherspawn"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantCutter.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantCutter.java index 2f25103..ec49c0f 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantCutter.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantCutter.java @@ -12,10 +12,10 @@ import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.MessageUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantExpHunter.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantExpHunter.java index 79caf87..aff8142 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantExpHunter.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantExpHunter.java @@ -6,8 +6,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDeathEvent; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantInfernus.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantInfernus.java index 720188c..ba30988 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantInfernus.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantInfernus.java @@ -11,8 +11,8 @@ import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantRocket.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantRocket.java index 3b8842f..f7c397a 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantRocket.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantRocket.java @@ -9,9 +9,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EntityUtil; import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVampire.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVampire.java index ed492c3..5bb11e0 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVampire.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVampire.java @@ -9,11 +9,12 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.EntityUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; @@ -23,9 +24,9 @@ import java.util.function.UnaryOperator; public class EnchantVampire extends IEnchantChanceTemplate implements CombatEnchant { - private String particleName; - private String particleData; - private Scaler healAmount; + private String particleName; + private String particleData; + private Scaler healAmount; private boolean healMultiplier; public static final String ID = "vampire"; @@ -60,7 +61,7 @@ public class EnchantVampire extends IEnchantChanceTemplate implements CombatEnch cfg.remove("Settings.Heal_Of_Damage"); cfg.addMissing("Settings.Particle.Name", Particle.HEART.name()); cfg.addMissing("Settings.Particle.Data", ""); - cfg.addMissing("Settings.Heal.Amount", "0.25 * " + PLACEHOLDER_LEVEL); + cfg.addMissing("Settings.Heal.Amount", "0.25 * " + Placeholders.ENCHANTMENT_LEVEL); cfg.addMissing("Settings.Heal.As_Multiplier", false); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVillageDefender.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVillageDefender.java index 89740d4..e2ab391 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVillageDefender.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/enchants/weapon/EnchantVillageDefender.java @@ -8,9 +8,9 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.manager.leveling.Scaler; import su.nexmedia.engine.utils.EffectUtil; import su.nexmedia.engine.utils.NumberUtil; +import su.nexmedia.engine.utils.Scaler; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.EnchantPriority; import su.nightexpress.excellentenchants.api.enchantment.IEnchantChanceTemplate; @@ -22,9 +22,9 @@ import java.util.function.UnaryOperator; public class EnchantVillageDefender extends IEnchantChanceTemplate implements CombatEnchant { private boolean damageMultiplier; - private Scaler damageAmount; - private String particleName; - private String particleData; + private Scaler damageAmount; + private String particleName; + private String particleData; public static final String ID = "village_defender"; public static final String PLACEHOLDER_DAMAGE_AMOUNT = "%enchantment_damage_amount%"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantGenericListener.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantGenericListener.java index c5552a6..e6660a9 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantGenericListener.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantGenericListener.java @@ -102,7 +102,7 @@ public class EnchantGenericListener extends AbstractListener } if (!first.equals(result)) { - EnchantManager.updateItemLoreEnchants(result); + //EnchantManager.updateItemLoreEnchants(result); e.setResult(result); // NMS ContainerAnvil will set level cost to 0 right after calling the event @@ -148,7 +148,7 @@ public class EnchantGenericListener extends AbstractListener curses.forEach((excellentEnchant, level) -> { EnchantManager.addEnchant(result, excellentEnchant, level, true); }); - EnchantManager.updateItemLoreEnchants(result); + //EnchantManager.updateItemLoreEnchants(result); }); } @@ -181,7 +181,7 @@ public class EnchantGenericListener extends AbstractListener result.setItemMeta(storageMeta); } - EnchantManager.updateItemLoreEnchants(result); + //EnchantManager.updateItemLoreEnchants(result); e.getInventory().setItem(0, result); }); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantHandlerListener.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantHandlerListener.java index b52cf56..51d6375 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantHandlerListener.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/listeners/EnchantHandlerListener.java @@ -95,7 +95,7 @@ public class EnchantHandlerListener extends AbstractListener ItemStack weaponDamager = equipDamager.getItemInMainHand(); - for (ItemStack armor : EntityUtil.getArmor(victim)) { + for (ItemStack armor : EntityUtil.getEquippedArmor(victim).values()) { if (armor == null || armor.getType().isAir()) continue; EnchantManager.getItemCustomEnchants(armor, CombatEnchant.class).forEach((combatEnchant, level) -> { @@ -182,7 +182,7 @@ public class EnchantHandlerListener extends AbstractListener @EventHandler(priority = EventPriority.HIGHEST) public void onEnchantDeath(EntityDeathEvent e) { LivingEntity dead = e.getEntity(); - for (ItemStack armor : EntityUtil.getArmor(dead)) { + for (ItemStack armor : EntityUtil.getEquippedArmor(dead).values()) { if (armor == null || armor.getType().isAir()) continue; EnchantManager.getItemCustomEnchants(armor, DeathEnchant.class).forEach((deathEnchant, level) -> { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantListGUI.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantListGUI.java index 66fdccf..22a93b8 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantListGUI.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantListGUI.java @@ -13,6 +13,7 @@ import su.nexmedia.engine.utils.CollectionsUtil; import su.nexmedia.engine.utils.ItemUtil; import su.nexmedia.engine.utils.PDCUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.ExcellentEnchant; import su.nightexpress.excellentenchants.config.Lang; import su.nightexpress.excellentenchants.manager.EnchantRegister; @@ -35,7 +36,7 @@ public class EnchantListGUI extends AbstractMenu { this.enchantIcon = cfg.getItem("Enchantments.Icon"); this.enchantSlots = cfg.getIntArray("Enchantments.Slots"); - IMenuClick click = (p, type, e) -> { + MenuClick click = (p, type, e) -> { if (type instanceof MenuItemType type2) { switch (type2) { case PAGE_NEXT -> this.open(p, this.getPage(p) + 1); @@ -46,10 +47,10 @@ public class EnchantListGUI extends AbstractMenu { }; for (String sId : cfg.getSection("Content")) { - IMenuItem menuItem = cfg.getMenuItem("Content." + sId); + MenuItem menuItem = cfg.getMenuItem("Content." + sId); if (menuItem.getType() != null) { - menuItem.setClick(click); + menuItem.setClickHandler(click); } this.addItem(menuItem); } @@ -69,13 +70,13 @@ public class EnchantListGUI extends AbstractMenu { : enchant.getConflicts().stream().filter(Objects::nonNull) .map(LangManager::getEnchantment).toList(); - ItemUtil.replaceLore(icon, ExcellentEnchant.PLACEHOLDER_CONFLICTS, conflicts); + ItemUtil.replaceLore(icon, Placeholders.ENCHANTMENT_CONFLICTS, conflicts); ItemUtil.replace(icon, enchant.formatString(level)); return icon; } @Override - public void onPrepare(@NotNull Player player, @NotNull Inventory inventory) { + public boolean onPrepare(@NotNull Player player, @NotNull Inventory inventory) { int page = this.getPage(player); int length = this.enchantSlots.length; List list = new ArrayList<>(EnchantRegister.ENCHANT_LIST.stream(). @@ -91,7 +92,7 @@ public class EnchantListGUI extends AbstractMenu { ItemStack icon = this.getEnchantIcon(enchant, 1); PDCUtil.setData(icon, this.keyLevel, 1); - IMenuClick click = (p, type, e) -> { + MenuClick click = (p, type, e) -> { if (!e.isLeftClick()) return; ItemStack itemClick = e.getCurrentItem(); @@ -107,16 +108,12 @@ public class EnchantListGUI extends AbstractMenu { e.setCurrentItem(itemClick); }; - IMenuItem menuItem = new MenuItem(icon, this.enchantSlots[count++]); - menuItem.setClick(click); + MenuItem menuItem = new MenuItem(icon, this.enchantSlots[count++]); + menuItem.setClickHandler(click); this.addItem(player, menuItem); } this.setPage(player, page, pages); - } - - @Override - public void onReady(@NotNull Player player, @NotNull Inventory inventory) { - + return true; } @Override diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantScaler.java b/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantScaler.java index a0dfb67..200df18 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantScaler.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/manager/object/EnchantScaler.java @@ -1,12 +1,13 @@ package su.nightexpress.excellentenchants.manager.object; import org.jetbrains.annotations.NotNull; -import su.nexmedia.engine.manager.leveling.Scaler; +import su.nexmedia.engine.utils.Scaler; +import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.ExcellentEnchant; public class EnchantScaler extends Scaler { public EnchantScaler(@NotNull ExcellentEnchant enchant, @NotNull String path) { - super(enchant.getConfig(), path, ExcellentEnchant.PLACEHOLDER_LEVEL, enchant.getStartLevel(), enchant.getMaxLevel()); + super(enchant.getConfig(), path, Placeholders.ENCHANTMENT_LEVEL, enchant.getStartLevel(), enchant.getMaxLevel()); } } diff --git a/Core/src/main/resources/plugin.yml b/Core/src/main/resources/plugin.yml index abbaa5d..66e9b82 100644 --- a/Core/src/main/resources/plugin.yml +++ b/Core/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ name: ExcellentEnchants author: NightExpress desciption: Vanilla-like enchants for your server. depend: [ NexEngine ] -softdepend: [ Towny, Residence, WorldGuard, GriefPrevention, Lands ] +softdepend: [ ProtocolLib, Towny, Residence, WorldGuard, GriefPrevention, Lands ] api-version: 1.17 load: STARTUP diff --git a/NMS/pom.xml b/NMS/pom.xml index 6a0d505..5c8fd3d 100644 --- a/NMS/pom.xml +++ b/NMS/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 diff --git a/V1_17_R1/pom.xml b/V1_17_R1/pom.xml index 989600f..39c989f 100644 --- a/V1_17_R1/pom.xml +++ b/V1_17_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.2.11 + 3.2.13 diff --git a/V1_18_R2/pom.xml b/V1_18_R2/pom.xml index 589949f..a5222ff 100644 --- a/V1_18_R2/pom.xml +++ b/V1_18_R2/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.2.11 + 3.2.13 diff --git a/V1_19_R1/pom.xml b/V1_19_R1/pom.xml index 6d6516e..53686f3 100644 --- a/V1_19_R1/pom.xml +++ b/V1_19_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.2.11 + 3.2.13 diff --git a/V1_19_R2/pom.xml b/V1_19_R2/pom.xml index 61cad56..051da34 100644 --- a/V1_19_R2/pom.xml +++ b/V1_19_R2/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.2.11 + 3.2.13 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.2.11 + 3.2.13 diff --git a/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/CustomEffectInstance.java b/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/CustomEffectInstance.java index 7a7d20f..c4aca5b 100644 --- a/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/CustomEffectInstance.java +++ b/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/CustomEffectInstance.java @@ -15,7 +15,7 @@ public class CustomEffectInstance extends MobEffectInstance { private final Enchantment enchantment; public CustomEffectInstance(MobEffect effect, int amplifier, @NotNull Enchantment enchantment) { - super(effect, Integer.MAX_VALUE, amplifier); + super(effect, MIN * 2, amplifier); this.enchantment = enchantment; } diff --git a/pom.xml b/pom.xml index 164146d..51ff3c4 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ su.nightexpress.excellentenchants ExcellentEnchants pom - 3.2.11 + 3.2.13 Core NMS @@ -26,7 +26,7 @@ su.nexmedia NexEngine - 2.2.7 + 2.2.8