From 4548bd7690a8c7479e5d3f2c99891909de992f87 Mon Sep 17 00:00:00 2001 From: xGinko Date: Wed, 3 Jan 2024 14:25:20 +0100 Subject: [PATCH] replace method --- .../modules/illegals/items/RevertOverstacked.java | 3 ++- .../modules/illegals/items/RevertUnbreakables.java | 3 ++- .../illegals/items/bannedblocks/BanSpecificBlocks.java | 3 ++- .../illegals/items/enchantments/HigherEnchants.java | 3 ++- .../illegals/items/enchantments/InapplicableEnchants.java | 3 ++- .../items/enchantments/SpecificHigherEnchants.java | 5 +++-- .../modules/illegals/items/nbt/DamageModifierTags.java | 3 ++- .../modules/illegals/items/nbt/FilledStorageItemTags.java | 3 ++- .../illegals/items/playerheads/BanPlayerHeads.java | 3 ++- .../modules/illegals/items/spawneggs/RemoveSpawnEggs.java | 3 ++- .../me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java | 5 ----- .../modules/illegals/items/RevertOverstacked.java | 6 +++++- .../modules/illegals/items/RevertUnbreakables.java | 6 +++++- .../illegals/items/bannedblocks/BanSpecificBlocks.java | 6 +++++- .../illegals/items/enchantments/HigherEnchants.java | 6 +++++- .../illegals/items/enchantments/InapplicableEnchants.java | 6 +++++- .../items/enchantments/SpecificHigherEnchants.java | 8 ++++++-- .../modules/illegals/items/nbt/DamageModifierTags.java | 6 +++++- .../modules/illegals/items/nbt/FilledStorageItemTags.java | 3 ++- .../illegals/items/playerheads/BanPlayerHeads.java | 6 +++++- .../modules/illegals/items/spawneggs/RemoveSpawnEggs.java | 6 +++++- .../me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java | 5 ----- 22 files changed, 69 insertions(+), 32 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java index 115b8b083..c156933d1 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -238,7 +239,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsOverstacked((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsOverstacked((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java index 2a30a1c23..98059187e 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -271,7 +272,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsUnbreakable((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsUnbreakable((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java index 501c5460b..0c37a0e69 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.bannedblocks; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -176,7 +177,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsBannedBlock((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsBannedBlock((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java index a95f7167b..554afd3ac 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.enchantments; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -251,7 +252,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsHigherEnchant((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsHigherEnchant((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java index d792dd3dd..9a05c26eb 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.enchantments; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -216,7 +217,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsInapplicableEnchant((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsInapplicableEnchant((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java index 1b5f21e85..70a8bf994 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.enchantments; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -266,9 +267,9 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) private void onBlockPlace(BlockPlaceEvent event) { - Block placedBlock = event.getBlockPlaced(); if (removeIllegalShulkers) { - if (isShulkerBox(placedBlock.getType()) && shulkerContainsSpecificHigherEnchanted((ShulkerBox) placedBlock.getState())) { + Block placedBlock = event.getBlockPlaced(); + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsSpecificHigherEnchanted((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java index 77ca53143..62ccfcdbe 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.nbt; +import com.destroystokyo.paper.MaterialTags; import de.tr7zw.changeme.nbtapi.NBTItem; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; @@ -250,7 +251,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsIllegalDamageModifier((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsIllegalDamageModifier((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java index 2110e011d..7fbbaa8a7 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.nbt; +import com.destroystokyo.paper.MaterialTags; import de.tr7zw.changeme.nbtapi.NBTItem; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -152,7 +153,7 @@ && new NBTItem(event.getItemInHand()).getKeys().contains(STORED_ITEMS_TAG) if ( shouldCheckShulker - && isShulkerBox(placedBlock.getType()) + && MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsImpossibleStorageItem((ShulkerBox) placedBlock.getState()) ) { placedBlock.setType(Material.AIR); diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java index f12da0a25..83e28c763 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.playerheads; +import com.destroystokyo.paper.MaterialTags; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; @@ -147,7 +148,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (!removeIllegalShulkers) return; Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsIllegalHead((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsIllegalHead((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java index f3d4bf8a0..ee3a0b4c6 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.illegals.items.spawneggs; +import com.destroystokyo.paper.MaterialTags; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; @@ -129,7 +130,7 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsSpawnEgg((ShulkerBox) placedBlock.getState())) { + if (MaterialTags.SHULKER_BOXES.isTagged(placedBlock) && shulkerContainsSpawnEgg((ShulkerBox) placedBlock.getState())) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java index 4d9aa096b..254c970f1 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java @@ -61,11 +61,6 @@ public static boolean isShulkerBox(ItemStack item) { return MaterialTags.SHULKER_BOXES.isTagged(item); } - public static boolean isShulkerBox(Material material) { - if (material == null) return false; - return MaterialTags.SHULKER_BOXES.isTagged(material); - } - public static boolean isHelmet(ItemStack item) { if (item == null) return false; return MaterialTags.HELMETS.isTagged(item); diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java index 2787409eb..709318c0b 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertOverstacked.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -206,7 +207,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsOverstacked((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsOverstacked((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java index ca0fe3e9c..c6b2a22f7 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/RevertUnbreakables.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -236,7 +237,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsUnbreakable((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsUnbreakable((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(Material.AIR); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java index 38e7722ef..431d08966 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/bannedblocks/BanSpecificBlocks.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -167,7 +168,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsBannedBlock((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsBannedBlock((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java index 8f83fb78b..ad128ff54 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/HigherEnchants.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -221,7 +222,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsHigherEnchant((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsHigherEnchant((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java index 0a50383b4..dc8956acc 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/InapplicableEnchants.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -215,7 +216,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsInapplicableEnchant((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsInapplicableEnchant((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java index f10fe80da..eb2fe43ab 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/enchantments/SpecificHigherEnchants.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -232,9 +233,12 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) private void onBlockPlace(BlockPlaceEvent event) { - Block placedBlock = event.getBlockPlaced(); if (removeIllegalShulkers) { - if (isShulkerBox(placedBlock.getType()) && shulkerContainsSpecificHigherEnchanted((ShulkerBox) placedBlock.getState())) { + Block placedBlock = event.getBlockPlaced(); + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsSpecificHigherEnchanted((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java index ba1700df8..b1a15eecc 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/DamageModifierTags.java @@ -6,6 +6,7 @@ import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; import me.moomoo.anarchyexploitfixes.utils.LogUtil; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -216,7 +217,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsIllegalDamageModifier((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsIllegalDamageModifier((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java index 5447afc53..1528bbc7e 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/nbt/FilledStorageItemTags.java @@ -5,6 +5,7 @@ import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -144,7 +145,7 @@ private void onBlockPlace(BlockPlaceEvent event) { Block placedBlock = event.getBlockPlaced(); if ( removeIllegalShulkers - && isShulkerBox(placedBlock.getType()) + && MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) && shulkerContainsImpossibleStorageItem((ShulkerBox) placedBlock.getState()) ) { placedBlock.setType(air); diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java index 7a32d61b4..289101cb4 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/playerheads/BanPlayerHeads.java @@ -4,6 +4,7 @@ import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -146,7 +147,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsIllegalHead((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsIllegalHead((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java index 6f3eda83d..17cd8f7e1 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/illegals/items/spawneggs/RemoveSpawnEggs.java @@ -4,6 +4,7 @@ import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.config.Config; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; +import me.moomoo.anarchyexploitfixes.utils.MaterialUtil; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.ShulkerBox; @@ -125,7 +126,10 @@ private void onPlayerPickupItem(PlayerAttemptPickupItemEvent event) { private void onBlockPlace(BlockPlaceEvent event) { if (removeIllegalShulkers) { Block placedBlock = event.getBlockPlaced(); - if (isShulkerBox(placedBlock.getType()) && shulkerContainsSpawnEgg((ShulkerBox) placedBlock.getState())) { + if ( + MaterialUtil.SHULKER_BOXES.contains(placedBlock.getType()) + && shulkerContainsSpawnEgg((ShulkerBox) placedBlock.getState()) + ) { placedBlock.setType(air); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java index a3cb1bcb9..ae20de70b 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/utils/MaterialUtil.java @@ -59,11 +59,6 @@ public static boolean isShulkerBox(ItemStack item) { return SHULKER_BOXES.contains(item.getType()); } - public static boolean isShulkerBox(Material material) { - if (material == null) return false; - return SHULKER_BOXES.contains(material); - } - public static final HashSet HELMETS = Stream.of( XMaterial.NETHERITE_HELMET, XMaterial.DIAMOND_HELMET,