diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/patches/CommandSign.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/patches/CommandSign.java index ae28e812a..f86269a60 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/patches/CommandSign.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/patches/CommandSign.java @@ -1,5 +1,6 @@ package me.moomoo.anarchyexploitfixes.modules.patches; +import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XTag; import me.moomoo.anarchyexploitfixes.AnarchyExploitFixes; import me.moomoo.anarchyexploitfixes.modules.AnarchyExploitFixesModule; @@ -11,17 +12,18 @@ import org.bukkit.event.player.PlayerInteractEvent; import java.util.HashSet; +import java.util.stream.Collectors; public class CommandSign implements AnarchyExploitFixesModule, Listener { - private final HashSet signs = new HashSet<>(); + private final HashSet signs; public CommandSign() { shouldEnable(); - XTag.SIGNS.getValues().forEach(xMaterial -> { - Material signType = xMaterial.parseMaterial(); - if (signType != null) this.signs.add(signType); - }); + this.signs = XTag.SIGNS.getValues().stream() + .filter(XMaterial::isSupported) + .map(XMaterial::parseMaterial) + .collect(Collectors.toCollection(HashSet::new)); AnarchyExploitFixes.getConfiguration().addComment("patches.prevent-command-sign", "Will have the side effect of players being unable to dye signs in newer versions."); } @@ -47,7 +49,7 @@ public boolean shouldEnable() { return AnarchyExploitFixes.getConfiguration().getBoolean("patches.prevent-command-sign", false); } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) private void onInteract(PlayerInteractEvent event) { if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return; if (signs.contains(event.getClickedBlock().getType())) {