diff --git a/Core/pom.xml b/Core/pom.xml index a54054a..8c4fc26 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 @@ -95,37 +95,27 @@ su.nightexpress.excellentenchants NMS - 3.4.3 + 3.4.5 su.nightexpress.excellentenchants V1_17_R1 - 3.4.3 + 3.4.5 su.nightexpress.excellentenchants V1_18_R2 - 3.4.3 - - - su.nightexpress.excellentenchants - V1_19_R1 - 3.4.3 - - - su.nightexpress.excellentenchants - V1_19_R2 - 3.4.3 + 3.4.5 su.nightexpress.excellentenchants V1_19_R3 - 3.4.3 + 3.4.5 su.nightexpress.excellentenchants V1_20_R1 - 3.4.3 + 3.4.5 diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java index 22b20cd..f07a0e6 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java @@ -5,7 +5,7 @@ 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.nexmedia.engine.utils.EngineUtils; import su.nightexpress.excellentenchants.command.BookCommand; import su.nightexpress.excellentenchants.command.EnchantCommand; import su.nightexpress.excellentenchants.command.ListCommand; @@ -21,8 +21,6 @@ import su.nightexpress.excellentenchants.hook.impl.ProtocolHook; import su.nightexpress.excellentenchants.nms.EnchantNMS; import su.nightexpress.excellentenchants.nms.v1_17_R1.V1_17_R1; import su.nightexpress.excellentenchants.nms.v1_18_R2.V1_18_R2; -import su.nightexpress.excellentenchants.nms.v1_19_R1.V1_19_R1; -import su.nightexpress.excellentenchants.nms.v1_19_R2.V1_19_R2; import su.nightexpress.excellentenchants.nms.v1_19_R3.V1_19_R3; import su.nightexpress.excellentenchants.nms.v1_20_R1.V1_20_R1; import su.nightexpress.excellentenchants.tier.TierManager; @@ -74,13 +72,12 @@ public class ExcellentEnchants extends NexPlugin { } private void setNMS() { - this.enchantNMS = switch (Version.CURRENT) { + this.enchantNMS = switch (Version.getCurrent()) { case V1_17_R1 -> new V1_17_R1(); case V1_18_R2 -> new V1_18_R2(); - case V1_19_R1 -> new V1_19_R1(); - case V1_19_R2 -> new V1_19_R2(); case V1_19_R3 -> new V1_19_R3(); case V1_20_R1 -> new V1_20_R1(); + default -> null; }; } @@ -92,7 +89,7 @@ public class ExcellentEnchants extends NexPlugin { @Override public void loadLang() { this.getLangManager().loadMissing(Lang.class); - this.getLangManager().setupEnum(FitItemType.class); + this.getLangManager().loadEnum(FitItemType.class); this.getLang().saveChanges(); } @@ -108,7 +105,7 @@ public class ExcellentEnchants extends NexPlugin { @Override public void registerHooks() { if (Config.ENCHANTMENTS_DISPLAY_MODE.get() == 2) { - if (Hooks.hasPlugin(HookId.PROTOCOL_LIB)) { + if (EngineUtils.hasPlugin(HookId.PROTOCOL_LIB)) { ProtocolHook.setup(); } else { @@ -116,7 +113,7 @@ public class ExcellentEnchants extends NexPlugin { Config.ENCHANTMENTS_DISPLAY_MODE.set(1); } } - if (Hooks.hasPlaceholderAPI()) { + if (EngineUtils.hasPlaceholderAPI()) { PlaceholderHook.setup(); } } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/Cleanable.java b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/Cleanable.java new file mode 100644 index 0000000..4cc9d59 --- /dev/null +++ b/Core/src/main/java/su/nightexpress/excellentenchants/api/enchantment/Cleanable.java @@ -0,0 +1,6 @@ +package su.nightexpress.excellentenchants.api.enchantment; + +public interface Cleanable { + + void clear(); +} 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 2843570..6afe3e3 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/BookCommand.java @@ -76,7 +76,7 @@ public class BookCommand extends AbstractCommand { plugin.getMessage(Lang.COMMAND_BOOK_DONE) .replace(Placeholders.GENERIC_ENCHANT, LangManager.getEnchantment(enchantment)) - .replace(Placeholders.Player.replacer(player)) + .replace(Placeholders.forPlayer(player)) .send(sender); } } 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 dc9e383..94ff2fb 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/EnchantCommand.java @@ -48,7 +48,7 @@ public class EnchantCommand extends AbstractCommand { Player player = (Player) sender; ItemStack item = player.getInventory().getItemInMainHand(); if (item.getType().isAir()) { - this.errorItem(sender); + this.plugin.getMessage(Lang.COMMAND_ENCHANT_ERROR_NO_ITEM).send(sender); return; } 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 f4768e6..f0d9950 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/command/TierbookCommand.java @@ -84,7 +84,7 @@ public class TierbookCommand extends AbstractCommand { plugin.getMessage(Lang.COMMAND_TIER_BOOK_DONE) .replace(tier.replacePlaceholders()) - .replace(Placeholders.Player.replacer(player)) + .replace(Placeholders.forPlayer(player)) .send(sender); } } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/config/Lang.java b/Core/src/main/java/su/nightexpress/excellentenchants/config/Lang.java index 6ce89f2..54fd362 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/config/Lang.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/config/Lang.java @@ -8,18 +8,19 @@ public class Lang extends EngineLang { public static final LangKey COMMAND_LIST_DESC = LangKey.of("Command.List.Desc", "List of all custom enchantments."); - public static final LangKey COMMAND_ENCHANT_USAGE = LangKey.of("Command.Enchant.Usage", " "); - public static final LangKey COMMAND_ENCHANT_DESC = LangKey.of("Command.Enchant.Desc", "Enchants the item in your hand."); - public static final LangKey COMMAND_ENCHANT_DONE = LangKey.of("Command.Enchant.Done", "&aSuccessfully enchanted!"); + public static final LangKey COMMAND_ENCHANT_USAGE = LangKey.of("Command.Enchant.Usage", " "); + public static final LangKey COMMAND_ENCHANT_DESC = LangKey.of("Command.Enchant.Desc", "Enchants the item in your hand."); + public static final LangKey COMMAND_ENCHANT_DONE = LangKey.of("Command.Enchant.Done", "&aSuccessfully enchanted!"); + public static final LangKey COMMAND_ENCHANT_ERROR_NO_ITEM = LangKey.of("Command.Enchant.Error.NoItem", RED + "You must hold an item to enchant it!"); public static final LangKey COMMAND_BOOK_USAGE = LangKey.of("Command.Book.Usage", " "); public static final LangKey COMMAND_BOOK_DESC = LangKey.of("Command.Book.Desc", "Gives custom enchanted book."); - public static final LangKey COMMAND_BOOK_DONE = LangKey.of("Command.Book.Done", "Given &6" + Placeholders.GENERIC_ENCHANT + "&7 enchanted book to &6" + Placeholders.Player.DISPLAY_NAME + "&7."); + public static final LangKey COMMAND_BOOK_DONE = LangKey.of("Command.Book.Done", "Given &6" + Placeholders.GENERIC_ENCHANT + "&7 enchanted book to &6" + Placeholders.PLAYER_DISPLAY_NAME + "&7."); public static final LangKey COMMAND_TIER_BOOK_USAGE = LangKey.of("Command.TierBook.Usage", " "); public static final LangKey COMMAND_TIER_BOOK_DESC = LangKey.of("Command.TierBook.Desc", "Gives an enchanted book."); public static final LangKey COMMAND_TIER_BOOK_ERROR = LangKey.of("Command.TierBook.Error", "&cInvalid tier!"); - public static final LangKey COMMAND_TIER_BOOK_DONE = LangKey.of("Command.TierBook.Done", "Given &6" + Placeholders.TIER_NAME + "&7 enchanted book to &6" + Placeholders.Player.DISPLAY_NAME + "&7."); + public static final LangKey COMMAND_TIER_BOOK_DONE = LangKey.of("Command.TierBook.Done", "Given &6" + Placeholders.TIER_NAME + "&7 enchanted book to &6" + Placeholders.PLAYER_DISPLAY_NAME + "&7."); public static final LangKey ERROR_NO_ENCHANT = LangKey.of("Error.NoEnchant", "&cInvalid enchantment."); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/ExcellentEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/ExcellentEnchant.java index 718688b..07f4f8e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/ExcellentEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/ExcellentEnchant.java @@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import su.nexmedia.engine.api.config.JYML; -import su.nexmedia.engine.api.manager.IListener; +import su.nexmedia.engine.api.manager.EventListener; import su.nexmedia.engine.api.placeholder.PlaceholderMap; import su.nexmedia.engine.lang.LangManager; import su.nexmedia.engine.utils.ItemUtil; @@ -33,7 +33,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Stream; -public abstract class ExcellentEnchant extends Enchantment implements IEnchantment, IListener { +public abstract class ExcellentEnchant extends Enchantment implements IEnchantment, EventListener { protected final ExcellentEnchants plugin; protected final JYML cfg; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java index 09cd0d8..7fb54fd 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java @@ -17,12 +17,12 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; -import su.nexmedia.engine.api.manager.ICleanable; import su.nexmedia.engine.api.particle.SimpleParticle; import su.nexmedia.engine.api.server.AbstractTask; import su.nexmedia.engine.utils.Pair; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; +import su.nightexpress.excellentenchants.api.enchantment.Cleanable; import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler; import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; @@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; -public class EnchantFlameWalker extends ExcellentEnchant implements ICleanable { +public class EnchantFlameWalker extends ExcellentEnchant implements Cleanable { public static final String ID = "flame_walker"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java index af82685..292a3f8 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantRegrowth.java @@ -7,12 +7,12 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; -import su.nexmedia.engine.api.manager.ICleanable; import su.nexmedia.engine.api.particle.SimpleParticle; import su.nexmedia.engine.utils.EntityUtil; import su.nexmedia.engine.utils.NumberUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; +import su.nightexpress.excellentenchants.api.enchantment.Cleanable; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; import su.nightexpress.excellentenchants.api.enchantment.type.PassiveEnchant; import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler; @@ -22,7 +22,7 @@ import su.nightexpress.excellentenchants.enchantment.task.AbstractEnchantmentTas import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils; -public class EnchantRegrowth extends ExcellentEnchant implements Chanced, PassiveEnchant, ICleanable { +public class EnchantRegrowth extends ExcellentEnchant implements Chanced, PassiveEnchant, Cleanable { public static final String ID = "regrowth"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java index a4acd16..a34c4e4 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantSaturation.java @@ -6,10 +6,10 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; -import su.nexmedia.engine.api.manager.ICleanable; import su.nexmedia.engine.utils.NumberUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; +import su.nightexpress.excellentenchants.api.enchantment.Cleanable; import su.nightexpress.excellentenchants.api.enchantment.type.PassiveEnchant; import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler; import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; @@ -17,7 +17,7 @@ import su.nightexpress.excellentenchants.enchantment.task.AbstractEnchantmentTas import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils; -public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchant, ICleanable { +public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchant, Cleanable { public static final String ID = "saturation"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java index e265a41..cf526ee 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java @@ -9,7 +9,7 @@ import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.particle.SimpleParticle; -import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.PlayerUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; @@ -65,7 +65,7 @@ public class CurseOfDrownedEnchant extends ExcellentEnchant implements FishingEn if (this.hasVisualEffects()) { SimpleParticle.of(Particle.WATER_SPLASH).play(hook.getLocation(), 0.5, 0.1, 50); - MessageUtil.sound(event.getPlayer(), Sound.ENTITY_DROWNED_AMBIENT); + PlayerUtil.sound(event.getPlayer(), Sound.ENTITY_DROWNED_AMBIENT); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/meta/ArrowImplementation.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/meta/ArrowImplementation.java index 7903f4f..dbdca1b 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/meta/ArrowImplementation.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/meta/ArrowImplementation.java @@ -42,7 +42,7 @@ public final class ArrowImplementation implements Arrowed { (cfg1, path, def) -> SimpleParticle.read(cfg1, path), particle, "Sets particle effect for the arrow trail of this enchantment." - ).setWriter((cfg1, path, particle1) -> SimpleParticle.write(particle1, cfg1, path)).read(cfg); + ).setWriter((cfg1, path, particle1) -> particle1.write(cfg1, path)).read(cfg); return new ArrowImplementation(enchant, effect); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantDivineTouch.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantDivineTouch.java index bbf68e6..6b9643b 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantDivineTouch.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantDivineTouch.java @@ -2,6 +2,7 @@ package su.nightexpress.excellentenchants.enchantment.impl.tool; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.BlockState; @@ -21,6 +22,7 @@ import su.nexmedia.engine.api.config.JOption; import su.nexmedia.engine.api.particle.SimpleParticle; import su.nexmedia.engine.utils.Colorizer; import su.nexmedia.engine.utils.LocationUtil; +import su.nexmedia.engine.utils.PDCUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; @@ -40,8 +42,12 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo private String spawnerName; private ChanceImplementation chanceImplementation; + private final NamespacedKey key; + public EnchantDivineTouch(@NotNull ExcellentEnchants plugin) { super(plugin, ID, EnchantPriority.MEDIUM); + this.key = new NamespacedKey(plugin, "divine_spawner"); + this.getDefaults().setDescription(Placeholders.ENCHANTMENT_CHANCE + "% chance to mine spawner."); this.getDefaults().setLevelMax(5); this.getDefaults().setTier(1.0); @@ -91,6 +97,7 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo stateItem.setDisplayName(this.spawnerName.replace(Placeholders.GENERIC_TYPE, plugin.getLangManager().getEnum(spawnerBlock.getSpawnedType()))); itemSpawner.setItemMeta(stateItem); + PDCUtil.set(itemSpawner, this.key, true); return itemSpawner; } @@ -133,6 +140,7 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo Player player = e.getPlayer(); ItemStack spawner = player.getInventory().getItem(e.getHand()); if (spawner == null || spawner.getType() != Material.SPAWNER || !(spawner.getItemMeta() instanceof BlockStateMeta meta)) return; + if (PDCUtil.getBoolean(spawner, this.key).isEmpty()) return; CreatureSpawner spawnerItem = (CreatureSpawner) meta.getBlockState(); CreatureSpawner spawnerBlock = (CreatureSpawner) block.getState(); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantReplanter.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantReplanter.java index ce9d047..ae96884 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantReplanter.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantReplanter.java @@ -15,15 +15,15 @@ import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; -import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.PlayerUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; -import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant; import su.nightexpress.excellentenchants.api.enchantment.type.InteractEnchant; -import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; +import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.enchantment.impl.meta.ChanceImplementation; import su.nightexpress.excellentenchants.enchantment.type.FitItemType; +import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; import java.util.Set; @@ -147,7 +147,7 @@ public class EnchantReplanter extends ExcellentEnchant implements Chanced, Inter if (seed == Material.NETHER_WART && blockGround.getType() == Material.SOUL_SAND || seed != Material.NETHER_WART && blockGround.getType() == Material.FARMLAND) { if (this.takeSeeds(player, seed)) { - MessageUtil.sound(player, seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT); + PlayerUtil.sound(player, seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT); plugin.getEnchantNMS().sendAttackPacket(player, 0); blockPlant.setType(this.fineSeedsToBlock(seed)); break; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java index 3356c76..3c5b5aa 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSilkChest.java @@ -25,16 +25,14 @@ 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.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.api.enchantment.type.BlockDropEnchant; +import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; +import su.nightexpress.excellentenchants.enchantment.type.FitItemType; import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer; import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; -import su.nightexpress.excellentenchants.enchantment.type.FitItemType; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.TreeMap; import java.util.stream.Stream; public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEnchant { @@ -44,7 +42,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha private String chestName; private List chestLore; private final NamespacedKey keyChest; - @Deprecated private final Map keyItems; public EnchantSilkChest(@NotNull ExcellentEnchants plugin) { super(plugin, ID, EnchantPriority.HIGH); @@ -53,10 +50,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha this.getDefaults().setTier(0.5); this.keyChest = new NamespacedKey(plugin, ID + ".item"); - this.keyItems = new TreeMap<>(); - for (int pos = 0; pos < 27; pos++) { - this.getItemKey(pos); - } } @Override @@ -70,11 +63,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha "Use '" + Placeholders.GENERIC_AMOUNT + "' for items amount.").mapReader(Colorizer::apply).read(cfg); } - @Deprecated - private NamespacedKey getItemKey(int pos) { - return this.keyItems.computeIfAbsent(pos, key -> new NamespacedKey(plugin, "silkchest_item_" + pos)); - } - @Override @NotNull public FitItemType[] getFitItemTypes() { @@ -88,7 +76,7 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha } public boolean isSilkChest(@NotNull ItemStack item) { - return PDCUtil.getBoolean(item, this.keyChest).orElse(false) || PDCUtil.getString(item, this.getItemKey(0)).orElse(null) != null; + return PDCUtil.getBoolean(item, this.keyChest).isPresent(); } @NotNull @@ -174,15 +162,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha chest.setCustomName(null); chest.update(true); - - Inventory inventory = chest.getBlockInventory(); - for (int pos = 0; pos < inventory.getSize(); pos++) { - String data = PDCUtil.getString(item, this.getItemKey(pos)).orElse(null); - if (data == null) continue; - - ItemStack itemInv = ItemUtil.fromBase64(data); - inventory.setItem(pos, itemInv); - } } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java index b8d16cd..96419f5 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantSmelter.java @@ -15,7 +15,6 @@ import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; import su.nexmedia.engine.api.particle.SimpleParticle; import su.nexmedia.engine.utils.LocationUtil; -import su.nexmedia.engine.utils.MessageUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; @@ -104,7 +103,7 @@ public class EnchantSmelter extends ExcellentEnchant implements Chanced, BlockDr Block block = e.getBlockState().getBlock(); if (this.hasVisualEffects()) { Location location = LocationUtil.getCenter(block.getLocation(), true); - MessageUtil.sound(location, this.sound); + LocationUtil.sound(location, this.sound); SimpleParticle.of(Particle.FLAME).play(location, 0.25, 0.05, 20); } return true; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTreasures.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTreasures.java index a9e6078..387092a 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTreasures.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTreasures.java @@ -10,24 +10,24 @@ import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; -import su.nexmedia.engine.api.manager.ICleanable; import su.nexmedia.engine.utils.random.Rnd; import su.nexmedia.playerblocktracker.PlayerBlockTracker; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; -import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; +import su.nightexpress.excellentenchants.api.enchantment.Cleanable; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant; import su.nightexpress.excellentenchants.api.enchantment.type.BlockDropEnchant; -import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer; -import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; +import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.enchantment.impl.meta.ChanceImplementation; import su.nightexpress.excellentenchants.enchantment.type.FitItemType; +import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer; +import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority; import java.util.*; import java.util.function.Predicate; -public class EnchantTreasures extends ExcellentEnchant implements Chanced, BlockBreakEnchant, BlockDropEnchant, ICleanable { +public class EnchantTreasures extends ExcellentEnchant implements Chanced, BlockBreakEnchant, BlockDropEnchant, Cleanable { public static final String ID = "treasures"; private static final String META = "wasted"; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTunnel.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTunnel.java index fd72c51..ba28789 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTunnel.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/EnchantTunnel.java @@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; -import su.nexmedia.engine.utils.LocationUtil; +import su.nexmedia.engine.utils.EntityUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant; import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; @@ -75,7 +75,7 @@ public class EnchantTunnel extends ExcellentEnchant implements BlockBreakEnchant if (block.getType().isInteractable() && !INTERACTABLE_BLOCKS.contains(block.getType())) return false; if (block.getDrops(item).isEmpty()) return false; - BlockFace dir = LocationUtil.getDirection(player); + BlockFace dir = EntityUtil.getDirection(player); boolean isY = dir != null && block.getRelative(dir.getOppositeFace()).isEmpty(); boolean isZ = dir == BlockFace.EAST || dir == BlockFace.WEST; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantCutter.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantCutter.java index 3e22cf5..4095c45 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantCutter.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantCutter.java @@ -12,7 +12,7 @@ import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.particle.SimpleParticle; -import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.LocationUtil; import su.nexmedia.engine.utils.NumberUtil; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; @@ -98,7 +98,7 @@ public class EnchantCutter extends ExcellentEnchant implements Chanced, CombatEn if (this.hasVisualEffects()) { SimpleParticle.of(Particle.ITEM_CRACK, itemCut).play(victim.getEyeLocation(), 0.25, 0.15, 30); - MessageUtil.sound(victim.getLocation(), Sound.ENTITY_ITEM_BREAK); + LocationUtil.sound(victim.getLocation(), Sound.ENTITY_ITEM_BREAK); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDecapitator.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDecapitator.java index 5535a43..621ca7b 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDecapitator.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDecapitator.java @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.config.JOption; import su.nexmedia.engine.api.particle.SimpleParticle; import su.nexmedia.engine.lang.LangManager; +import su.nexmedia.engine.utils.Colorizer; import su.nexmedia.engine.utils.ItemUtil; import su.nexmedia.engine.utils.PDCUtil; import su.nexmedia.engine.utils.StringUtil; @@ -71,7 +72,8 @@ public class EnchantDecapitator extends ExcellentEnchant implements Chanced, Dea ).setWriter((cfg, path, set) -> cfg.set(path, set.stream().map(Enum::name).toList())).read(cfg); this.headName = JOption.create("Settings.Head_Item.Name", "&c" + Placeholders.GENERIC_TYPE + "'s Head", - "Head item display name. Use '" + Placeholders.GENERIC_TYPE + "' for entity name.").read(cfg); + "Head item display name. Use '" + Placeholders.GENERIC_TYPE + "' for entity name.") + .mapReader(Colorizer::apply).read(cfg); this.headTextures = JOption.forMap("Settings.Head_Item.Textures", id -> StringUtil.getEnum(id, EntityType.class).orElse(null), diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDoubleStrike.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDoubleStrike.java index 491d70b..c6f5225 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDoubleStrike.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantDoubleStrike.java @@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.particle.SimpleParticle; -import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.LocationUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced; @@ -58,7 +58,7 @@ public class EnchantDoubleStrike extends ExcellentEnchant implements Chanced, Co if (this.hasVisualEffects()) { SimpleParticle.of(Particle.EXPLOSION_NORMAL).play(victim.getEyeLocation(), 0.25, 0.15, 15); - MessageUtil.sound(victim.getLocation(), Sound.ENTITY_GENERIC_EXPLODE); + LocationUtil.sound(victim.getLocation(), Sound.ENTITY_GENERIC_EXPLODE); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantRocket.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantRocket.java index 0ef7d67..9613c3e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantRocket.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/EnchantRocket.java @@ -9,7 +9,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; import org.jetbrains.annotations.NotNull; -import su.nexmedia.engine.utils.MessageUtil; +import su.nexmedia.engine.utils.LocationUtil; import su.nexmedia.engine.utils.random.Rnd; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.Placeholders; @@ -72,7 +72,7 @@ public class EnchantRocket extends ExcellentEnchant implements Chanced, CombatEn Firework firework = this.createRocket(victim.getLocation(), level); firework.addPassenger(victim); - MessageUtil.sound(victim.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH); + LocationUtil.sound(victim.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH); return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantAnvilListener.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantAnvilListener.java index 1683df4..5abae87 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantAnvilListener.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantAnvilListener.java @@ -12,8 +12,8 @@ import org.bukkit.inventory.AnvilInventory; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.manager.AbstractListener; -import su.nexmedia.engine.utils.MessageUtil; import su.nexmedia.engine.utils.PDCUtil; +import su.nexmedia.engine.utils.PlayerUtil; import su.nightexpress.excellentenchants.ExcellentEnchants; import su.nightexpress.excellentenchants.ExcellentEnchantsAPI; import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; @@ -149,7 +149,7 @@ public class EnchantAnvilListener extends AbstractListener { e.getView().setCursor(item); e.setCancelled(false); - MessageUtil.sound(player, Sound.BLOCK_ENCHANTMENT_TABLE_USE); + PlayerUtil.sound(player, Sound.BLOCK_ENCHANTMENT_TABLE_USE); ItemStack second = inventory.getItem(1); if (second != null && !second.getType().isAir()) { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantGenericListener.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantGenericListener.java index 73902b8..0b7e213 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantGenericListener.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/EnchantGenericListener.java @@ -19,11 +19,11 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; import su.nexmedia.engine.api.manager.AbstractListener; -import su.nexmedia.engine.hooks.Hooks; +import su.nexmedia.engine.utils.EngineUtils; import su.nightexpress.excellentenchants.ExcellentEnchants; -import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.config.Config; import su.nightexpress.excellentenchants.enchantment.EnchantManager; +import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant; import su.nightexpress.excellentenchants.enchantment.type.ObtainType; import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils; import su.nightexpress.excellentenchants.hook.HookId; @@ -191,7 +191,7 @@ public class EnchantGenericListener extends AbstractListener EntityEquipment equipment = entity.getEquipment(); if (equipment == null) return; - boolean isMythic = Hooks.hasPlugin(HookId.MYTHIC_MOBS) && MythicMobsHook.isMythicMob(entity); + boolean isMythic = EngineUtils.hasPlugin(HookId.MYTHIC_MOBS) && MythicMobsHook.isMythicMob(entity); boolean doPopulation = Config.getObtainSettings(ObtainType.MOB_SPAWNING).isPresent() && !isMythic; for (EquipmentSlot slot : EquipmentSlot.values()) { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/menu/EnchantmentsListMenu.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/menu/EnchantmentsListMenu.java index da3dc15..5dd50f3 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/menu/EnchantmentsListMenu.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/menu/EnchantmentsListMenu.java @@ -130,9 +130,9 @@ public class EnchantmentsListMenu extends ConfigMenu implemen List charges = enchant.isChargesEnabled() ? new ArrayList<>(this.enchantLoreCharges) : Collections.emptyList(); List obtaining = new ArrayList<>(this.enchantLoreObtaining); - lore = StringUtil.replace(lore, PLACEHOLDER_CONFLICTS, false, conflicts); - lore = StringUtil.replace(lore, PLACEHOLDER_CHARGES, false, charges); - lore = StringUtil.replace(lore, PLACEHOLDER_OBTAINING, false, obtaining); + lore = StringUtil.replaceInList(lore, PLACEHOLDER_CONFLICTS, conflicts); + lore = StringUtil.replaceInList(lore, PLACEHOLDER_CHARGES, charges); + lore = StringUtil.replaceInList(lore, PLACEHOLDER_OBTAINING, obtaining); lore = StringUtil.replace(lore, Placeholders.ENCHANTMENT_DESCRIPTION, true, enchant.getDescription()); meta.setLore(lore); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/NoCheatPlusHook.java b/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/NoCheatPlusHook.java index 2ce103d..9cc6458 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/NoCheatPlusHook.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/NoCheatPlusHook.java @@ -5,19 +5,19 @@ import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.hooks.ExemptionContext; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import su.nexmedia.engine.hooks.Hooks; +import su.nexmedia.engine.utils.EngineUtils; import su.nightexpress.excellentenchants.hook.HookId; public class NoCheatPlusHook { public static void exemptBlocks(@NotNull Player player) { - if (!Hooks.hasPlugin(HookId.NCP)) return; + if (!EngineUtils.hasPlugin(HookId.NCP)) return; NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager().getPlayerData(player).exempt(CheckType.BLOCKBREAK, ExemptionContext.ANONYMOUS_NESTED); } public static void unexemptBlocks(@NotNull Player player) { - if (!Hooks.hasPlugin(HookId.NCP)) return; + if (!EngineUtils.hasPlugin(HookId.NCP)) return; NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager().getPlayerData(player).unexempt(CheckType.BLOCKBREAK, ExemptionContext.ANONYMOUS_NESTED); } diff --git a/NMS/pom.xml b/NMS/pom.xml index 381596e..57c1252 100644 --- a/NMS/pom.xml +++ b/NMS/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 diff --git a/V1_17_R1/pom.xml b/V1_17_R1/pom.xml index 91407e6..f949ea7 100644 --- a/V1_17_R1/pom.xml +++ b/V1_17_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.3 + 3.4.5 diff --git a/V1_18_R2/pom.xml b/V1_18_R2/pom.xml index fb1ff53..18554b4 100644 --- a/V1_18_R2/pom.xml +++ b/V1_18_R2/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.3 + 3.4.5 diff --git a/V1_19_R1/pom.xml b/V1_19_R1/pom.xml deleted file mode 100644 index 0a4ed48..0000000 --- a/V1_19_R1/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - ExcellentEnchants - su.nightexpress.excellentenchants - 3.4.3 - - 4.0.0 - - V1_19_R1 - - - 16 - 16 - - - - - org.spigotmc - spigot - 1.19.2-R0.1-SNAPSHOT - remapped-mojang - - - su.nightexpress.excellentenchants - NMS - 3.4.3 - - - - - - - net.md-5 - specialsource-maven-plugin - 1.2.4 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - - \ No newline at end of file diff --git a/V1_19_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R1/V1_19_R1.java b/V1_19_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R1/V1_19_R1.java deleted file mode 100644 index 0cd82d6..0000000 --- a/V1_19_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R1/V1_19_R1.java +++ /dev/null @@ -1,94 +0,0 @@ -package su.nightexpress.excellentenchants.nms.v1_19_R1; - -import net.minecraft.core.BlockPos; -import net.minecraft.network.protocol.game.ClientboundAnimatePacket; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.projectile.FishingHook; -import net.minecraft.world.item.SpawnEggItem; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftFishHook; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory; -import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack; -import org.bukkit.entity.FishHook; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import su.nightexpress.excellentenchants.nms.EnchantNMS; - -import java.util.HashSet; -import java.util.Set; - -public class V1_19_R1 implements EnchantNMS { - - @Override - public void sendAttackPacket(@NotNull Player player, int id) { - CraftPlayer craftPlayer = (CraftPlayer) player; - Entity entity = craftPlayer.getHandle(); - ClientboundAnimatePacket packet = new ClientboundAnimatePacket(entity, id); - craftPlayer.getHandle().connection.send(packet); - } - - @Override - public void retrieveHook(@NotNull FishHook hook, @NotNull ItemStack item) { - CraftFishHook craftFishHook = (CraftFishHook) hook; - FishingHook handle = craftFishHook.getHandle(); - handle.retrieve(CraftItemStack.asNMSCopy(item)); - } - - @Override - @Nullable - public ItemStack getSpawnEgg(@NotNull LivingEntity entity) { - CraftLivingEntity craftLivingEntity = (CraftLivingEntity) entity; - net.minecraft.world.entity.LivingEntity livingEntity = craftLivingEntity.getHandle(); - - SpawnEggItem eggItem = SpawnEggItem.byId(livingEntity.getType()); - if (eggItem == null) return null; - - return CraftItemStack.asBukkitCopy(eggItem.getDefaultInstance()); - } - - @Override - @NotNull - public Set handleFlameWalker(@NotNull LivingEntity bukkitEntity, @NotNull Location location, int level) { - Entity entity = ((CraftLivingEntity) bukkitEntity).getHandle(); - BlockPos pos = new BlockPos(location.getX(), location.getY(), location.getZ()); - ServerLevel world = ((CraftWorld) bukkitEntity.getWorld()).getHandle(); - - float radius = Math.min(16F, 2F + level); - BlockState bStone = Blocks.MAGMA_BLOCK.defaultBlockState(); - BlockPos.MutableBlockPos posAbove = new BlockPos.MutableBlockPos(); - - Set blocks = new HashSet<>(); - for (BlockPos posNear : BlockPos.betweenClosed(pos.offset(-radius, -1.0, -radius), pos.offset(radius, -1.0, radius))) { - if (!posNear.closerThan(entity.blockPosition(), radius)) continue; - - posAbove.set(posNear.getX(), posNear.getY() + 1, posNear.getZ()); - - BlockState bLavaAbove = world.getBlockState(posAbove); - BlockState bLava = world.getBlockState(posNear); - - if (!bLavaAbove.isAir()) continue; - if (!bLava.getBlock().equals(Blocks.LAVA)) continue; - if (bLava.getValue(LiquidBlock.LEVEL) != 0) continue; - if (!bStone.canSurvive(world, posNear)) continue; - if (!world.isUnobstructed(bStone, posNear, CollisionContext.empty())) continue; - if (!CraftEventFactory.handleBlockFormEvent(world, posNear, bStone, entity)) continue; - //world.scheduleTick(posNear, Blocks.STONE, Rnd.get(60, 120)); - - Location bukkitLoc = new Location(world.getWorld(), posNear.getX(), posNear.getY(), posNear.getZ()); - blocks.add(bukkitLoc.getBlock()); - } - return blocks; - } -} diff --git a/V1_19_R2/pom.xml b/V1_19_R2/pom.xml deleted file mode 100644 index 8a8913c..0000000 --- a/V1_19_R2/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - ExcellentEnchants - su.nightexpress.excellentenchants - 3.4.3 - - 4.0.0 - - V1_19_R2 - - - 16 - 16 - - - - - org.spigotmc - spigot - 1.19.3-R0.1-SNAPSHOT - remapped-mojang - - - su.nightexpress.excellentenchants - NMS - 3.4.3 - - - - - - - net.md-5 - specialsource-maven-plugin - 1.2.4 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - \ No newline at end of file diff --git a/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/V1_19_R2.java b/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/V1_19_R2.java deleted file mode 100644 index 9542b37..0000000 --- a/V1_19_R2/src/main/java/su/nightexpress/excellentenchants/nms/v1_19_R2/V1_19_R2.java +++ /dev/null @@ -1,94 +0,0 @@ -package su.nightexpress.excellentenchants.nms.v1_19_R2; - -import net.minecraft.core.BlockPos; -import net.minecraft.network.protocol.game.ClientboundAnimatePacket; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.projectile.FishingHook; -import net.minecraft.world.item.SpawnEggItem; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftFishHook; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory; -import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; -import org.bukkit.entity.FishHook; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import su.nightexpress.excellentenchants.nms.EnchantNMS; - -import java.util.HashSet; -import java.util.Set; - -public class V1_19_R2 implements EnchantNMS { - - @Override - public void sendAttackPacket(@NotNull Player player, int id) { - CraftPlayer craftPlayer = (CraftPlayer) player; - Entity entity = craftPlayer.getHandle(); - ClientboundAnimatePacket packet = new ClientboundAnimatePacket(entity, id); - craftPlayer.getHandle().connection.send(packet); - } - - @Override - public void retrieveHook(@NotNull FishHook hook, @NotNull ItemStack item) { - CraftFishHook craftFishHook = (CraftFishHook) hook; - FishingHook handle = craftFishHook.getHandle(); - handle.retrieve(CraftItemStack.asNMSCopy(item)); - } - - @Override - @Nullable - public ItemStack getSpawnEgg(@NotNull LivingEntity entity) { - CraftLivingEntity craftLivingEntity = (CraftLivingEntity) entity; - net.minecraft.world.entity.LivingEntity livingEntity = craftLivingEntity.getHandle(); - - SpawnEggItem eggItem = SpawnEggItem.byId(livingEntity.getType()); - if (eggItem == null) return null; - - return CraftItemStack.asBukkitCopy(eggItem.getDefaultInstance()); - } - - @Override - @NotNull - public Set handleFlameWalker(@NotNull LivingEntity bukkitEntity, @NotNull Location location, int level) { - Entity entity = ((CraftLivingEntity) bukkitEntity).getHandle(); - BlockPos pos = new BlockPos(location.getX(), location.getY(), location.getZ()); - ServerLevel world = ((CraftWorld) bukkitEntity.getWorld()).getHandle(); - - float radius = Math.min(16F, 2F + level); - BlockState bStone = Blocks.MAGMA_BLOCK.defaultBlockState(); - BlockPos.MutableBlockPos posAbove = new BlockPos.MutableBlockPos(); - - Set blocks = new HashSet<>(); - for (BlockPos posNear : BlockPos.betweenClosed(pos.offset(-radius, -1.0, -radius), pos.offset(radius, -1.0, radius))) { - if (!posNear.closerThan(entity.blockPosition(), radius)) continue; - - posAbove.set(posNear.getX(), posNear.getY() + 1, posNear.getZ()); - - BlockState bLavaAbove = world.getBlockState(posAbove); - BlockState bLava = world.getBlockState(posNear); - - if (!bLavaAbove.isAir()) continue; - if (!bLava.getBlock().equals(Blocks.LAVA)) continue; - if (bLava.getValue(LiquidBlock.LEVEL) != 0) continue; - if (!bStone.canSurvive(world, posNear)) continue; - if (!world.isUnobstructed(bStone, posNear, CollisionContext.empty())) continue; - if (!CraftEventFactory.handleBlockFormEvent(world, posNear, bStone, entity)) continue; - //world.scheduleTick(posNear, Blocks.STONE, Rnd.get(60, 120)); - - Location bukkitLoc = new Location(world.getWorld(), posNear.getX(), posNear.getY(), posNear.getZ()); - blocks.add(bukkitLoc.getBlock()); - } - return blocks; - } -} diff --git a/V1_19_R3/pom.xml b/V1_19_R3/pom.xml index 0d2a789..a0f13b0 100644 --- a/V1_19_R3/pom.xml +++ b/V1_19_R3/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.3 + 3.4.5 diff --git a/V1_20_R1/pom.xml b/V1_20_R1/pom.xml index 4a5d1ea..f879353 100644 --- a/V1_20_R1/pom.xml +++ b/V1_20_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.3 + 3.4.5 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.3 + 3.4.5 diff --git a/pom.xml b/pom.xml index 3d18962..d4960c9 100644 --- a/pom.xml +++ b/pom.xml @@ -7,14 +7,12 @@ su.nightexpress.excellentenchants ExcellentEnchants pom - 3.4.3 + 3.4.5 Core NMS V1_17_R1 V1_18_R2 - V1_19_R1 - V1_19_R2 V1_19_R3 V1_20_R1 @@ -30,7 +28,7 @@ su.nexmedia NexEngine - 2.2.10 + 2.2.11