mirror of
https://github.com/filoghost/ChestCommands.git
synced 2024-11-22 18:16:14 +01:00
Fix issue with signs on Minecraft 1.13+
This commit is contained in:
parent
9d035f84ba
commit
835f4f5407
@ -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]")) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user