From acb65798e58c03e4fc09423f046446f1bce9e066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Fri, 27 Dec 2024 19:17:35 +0100 Subject: [PATCH] mc downgrade to 1.20.4 & java to 17 --- .../zerobzerot/test_server_extras/Plugin.java | 53 +++++++------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/zerobzerot/test_server_extras/Plugin.java b/src/main/java/org/zerobzerot/test_server_extras/Plugin.java index 9e28a07..8516fd5 100644 --- a/src/main/java/org/zerobzerot/test_server_extras/Plugin.java +++ b/src/main/java/org/zerobzerot/test_server_extras/Plugin.java @@ -8,7 +8,6 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.player.PlayerAdvancementDoneEvent; import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.inventory.ItemRarity; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.EnchantmentStorageMeta; @@ -27,26 +26,24 @@ public void onEnable() { private static @NotNull ItemStack makeElytra() { ItemStack stack = new ItemStack(Material.ELYTRA, 1); - stack.addEnchantment(Enchantment.UNBREAKING, 3); + stack.addEnchantment(Enchantment.DURABILITY, 3); stack.addEnchantment(Enchantment.MENDING, 1); stack.addEnchantment(Enchantment.VANISHING_CURSE, 1); var meta = stack.getItemMeta(); - meta.setRarity(ItemRarity.EPIC); stack.setItemMeta(meta); return stack; } private static @NotNull ItemStack makeFishingRod() { ItemStack stack = new ItemStack(Material.FISHING_ROD, 1); - stack.addEnchantment(Enchantment.UNBREAKING, 3); + stack.addEnchantment(Enchantment.DURABILITY, 3); stack.addEnchantment(Enchantment.MENDING, 1); stack.addEnchantment(Enchantment.LURE, 3); - stack.addEnchantment(Enchantment.LUCK_OF_THE_SEA, 3); + stack.addEnchantment(Enchantment.LUCK, 3); stack.addEnchantment(Enchantment.VANISHING_CURSE, 1); var meta = stack.getItemMeta(); - meta.setRarity(ItemRarity.RARE); stack.setItemMeta(meta); return stack; @@ -54,17 +51,15 @@ public void onEnable() { private static @NotNull ItemStack makeFlintSteel() { ItemStack stack = new ItemStack(Material.FLINT_AND_STEEL, 1); - stack.addEnchantment(Enchantment.UNBREAKING, 3); + stack.addEnchantment(Enchantment.DURABILITY, 3); stack.addEnchantment(Enchantment.MENDING, 1); stack.addEnchantment(Enchantment.VANISHING_CURSE, 1); if (ThreadLocalRandom.current().nextBoolean()) { var meta = stack.getItemMeta(); - meta.setRarity(ItemRarity.RARE); stack.setItemMeta(meta); } else { var meta = stack.getItemMeta(); - meta.setRarity(ItemRarity.EPIC); meta.setUnbreakable(true); stack.setItemMeta(meta); } @@ -74,20 +69,19 @@ public void onEnable() { private static @NotNull ItemStack makeHoe() { ItemStack stack = new ItemStack(Material.NETHERITE_HOE, 1); - stack.addEnchantment(Enchantment.UNBREAKING, 3); + stack.addEnchantment(Enchantment.DURABILITY, 3); stack.addEnchantment(Enchantment.MENDING, 1); - stack.addEnchantment(Enchantment.EFFICIENCY, 5); - stack.addEnchantment(Enchantment.FORTUNE, 3); + stack.addEnchantment(Enchantment.DIG_SPEED, 5); + stack.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3); stack.addEnchantment(Enchantment.SILK_TOUCH, 1); stack.addEnchantment(Enchantment.VANISHING_CURSE, 1); var meta = stack.getItemMeta(); - meta.setRarity(ItemRarity.EPIC); stack.setItemMeta(meta); // does this work? 🤔 var damageable = (Damageable) stack.getItemMeta(); - damageable.setMaxDamage(1); + damageable.setDamage(1); stack.setItemMeta(damageable); return stack; @@ -95,7 +89,7 @@ public void onEnable() { private static @NotNull ItemStack makeTrident() { ItemStack stack = new ItemStack(Material.TRIDENT, 1); - stack.addEnchantment(Enchantment.UNBREAKING, 3); + stack.addEnchantment(Enchantment.DURABILITY, 3); stack.addEnchantment(Enchantment.MENDING, 1); stack.addEnchantment(Enchantment.IMPALING, 5); stack.addEnchantment(Enchantment.VANISHING_CURSE, 1); @@ -104,10 +98,8 @@ public void onEnable() { if (ThreadLocalRandom.current().nextBoolean()) { stack.addEnchantment(Enchantment.LOYALTY, 3); stack.addEnchantment(Enchantment.CHANNELING, 1); - meta.setRarity(ItemRarity.RARE); } else { stack.addEnchantment(Enchantment.RIPTIDE, 3); - meta.setRarity(ItemRarity.EPIC); } stack.setItemMeta(meta); @@ -119,31 +111,25 @@ public void onEnable() { var meta = (EnchantmentStorageMeta) stack.getItemMeta(); switch (ThreadLocalRandom.current().nextInt(0, 15)) { case 0 -> meta.addStoredEnchant(Enchantment.MENDING, 1, true); - case 1 -> meta.addStoredEnchant(Enchantment.UNBREAKING, 3, true); - case 2 -> meta.addStoredEnchant(Enchantment.EFFICIENCY, 5, true); - case 3 -> meta.addStoredEnchant(Enchantment.FORTUNE, 3, true); + case 1 -> meta.addStoredEnchant(Enchantment.DURABILITY, 3, true); + case 2 -> meta.addStoredEnchant(Enchantment.DIG_SPEED, 5, true); + case 3 -> meta.addStoredEnchant(Enchantment.LOOT_BONUS_BLOCKS, 3, true); case 4 -> meta.addStoredEnchant(Enchantment.SILK_TOUCH, 1, true); - case 5 -> meta.addStoredEnchant(Enchantment.PROTECTION, 4, true); - case 6 -> meta.addStoredEnchant(Enchantment.BLAST_PROTECTION, 4, true); + case 5 -> meta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 4, true); + case 6 -> meta.addStoredEnchant(Enchantment.PROTECTION_EXPLOSIONS, 4, true); case 7 -> meta.addStoredEnchant(Enchantment.DEPTH_STRIDER, 3, true); case 8 -> meta.addStoredEnchant(Enchantment.THORNS, 3, true); - case 9 -> meta.addStoredEnchant(Enchantment.RESPIRATION, 3, true); - case 10 -> meta.addStoredEnchant(Enchantment.SHARPNESS, 5, true); + case 9 -> meta.addStoredEnchant(Enchantment.OXYGEN, 3, true); + case 10 -> meta.addStoredEnchant(Enchantment.DAMAGE_ALL, 5, true); case 11 -> meta.addStoredEnchant(Enchantment.SWEEPING_EDGE, 3, true); - case 12 -> meta.addStoredEnchant(Enchantment.FLAME, 1, true); - case 13 -> meta.addStoredEnchant(Enchantment.INFINITY, 1, true); - case 14 -> meta.addStoredEnchant(Enchantment.POWER, 5, true); + case 12 -> meta.addStoredEnchant(Enchantment.ARROW_FIRE, 1, true); + case 13 -> meta.addStoredEnchant(Enchantment.ARROW_INFINITE, 1, true); + case 14 -> meta.addStoredEnchant(Enchantment.ARROW_DAMAGE, 5, true); } stack.setItemMeta(meta); return stack; } - private static void setRarity(@NotNull ItemStack stack, @NotNull ItemRarity rarity) { - var meta = stack.getItemMeta(); - meta.setRarity(rarity); - stack.setItemMeta(meta); - } - @EventHandler public void onPlayerRespawn(PlayerRespawnEvent ev) { @@ -201,7 +187,6 @@ public void onEntityDeath(EntityDeathEvent ev) { ThreadLocalRandom.current().nextInt(2, 8)); var meta = (FireworkMeta) stack.getItemMeta(); meta.setPower(3); - meta.setRarity(ItemRarity.UNCOMMON); stack.setItemMeta(meta); ev.getDrops().add(stack); }