Fix issue with signs on Minecraft 1.13+

This commit is contained in:
filoghost 2020-06-10 19:22:30 +02:00
parent 9d035f84ba
commit 835f4f5407
2 changed files with 1 additions and 9 deletions

View File

@ -19,7 +19,6 @@ import com.gmail.filoghost.chestcommands.Permissions;
import com.gmail.filoghost.chestcommands.api.IconMenu; import com.gmail.filoghost.chestcommands.api.IconMenu;
import com.gmail.filoghost.chestcommands.internal.ExtendedIconMenu; import com.gmail.filoghost.chestcommands.internal.ExtendedIconMenu;
import com.gmail.filoghost.chestcommands.util.BukkitUtils; import com.gmail.filoghost.chestcommands.util.BukkitUtils;
import com.gmail.filoghost.chestcommands.util.MaterialsRegistry;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -34,7 +33,7 @@ public class SignListener implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && MaterialsRegistry.isSign(event.getClickedBlock().getType())) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.hasBlock() && event.getClickedBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getClickedBlock().getState(); Sign sign = (Sign) event.getClickedBlock().getState();
if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[menu]")) { if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[menu]")) {

View File

@ -36,9 +36,6 @@ public final class MaterialsRegistry {
// Materials that are considered air (with 1.13+ compatibility) // Materials that are considered air (with 1.13+ compatibility)
private static final Collection<Material> AIR_MATERIALS = getExistingMaterials("AIR", "CAVE_AIR", "VOID_AIR"); private static final Collection<Material> AIR_MATERIALS = getExistingMaterials("AIR", "CAVE_AIR", "VOID_AIR");
// Materials that have a "Sign" block state (with 1.13+ compatibility)
private static final Collection<Material> SIGN_MATERIALS = getExistingMaterials("SIGN", "SIGN_POST", "WALL_SIGN");
private MaterialsRegistry() { private MaterialsRegistry() {
} }
@ -84,10 +81,6 @@ public final class MaterialsRegistry {
return AIR_MATERIALS.contains(material); return AIR_MATERIALS.contains(material);
} }
public static boolean isSign(Material material) {
return SIGN_MATERIALS.contains(material);
}
public static boolean useNewMaterialNames() { public static boolean useNewMaterialNames() {
return USE_NEW_MATERIAL_NAMES; return USE_NEW_MATERIAL_NAMES;
} }