Makes containers used as buttons no longer open when right-clicked
This commit is contained in:
parent
8c37b11484
commit
f3292cff99
@ -281,7 +281,7 @@ public class PlayerEventListener implements Listener {
|
||||
}
|
||||
|
||||
PermissionHelper.openPortal(player, portal);
|
||||
if (portal.getPortalOpener().isOpenFor(player)) {
|
||||
if (portal.getPortalOpener().isOpenFor(player) && !MaterialHelper.isContainer(block.getType())) {
|
||||
event.setUseInteractedBlock(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,17 @@ public final class MaterialHelper {
|
||||
material.equals(Material.DEAD_TUBE_CORAL_WALL_FAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given material is a container
|
||||
*
|
||||
* @param material <p>The material to check</p>
|
||||
* @return <p>True if the material is a container</p>
|
||||
*/
|
||||
public static boolean isContainer(Material material) {
|
||||
return Tag.SHULKER_BOXES.isTagged(material) || material == Material.CHEST ||
|
||||
material == Material.TRAPPED_CHEST || material == Material.ENDER_CHEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given material can be used as a button
|
||||
*
|
||||
@ -35,8 +46,7 @@ public final class MaterialHelper {
|
||||
* @return <p>True if the material can be used as a button</p>
|
||||
*/
|
||||
public static boolean isButtonCompatible(Material material) {
|
||||
return Tag.BUTTONS.isTagged(material) || isWallCoral(material) || Tag.SHULKER_BOXES.isTagged(material) ||
|
||||
material == Material.CHEST || material == Material.TRAPPED_CHEST || material == Material.ENDER_CHEST;
|
||||
return Tag.BUTTONS.isTagged(material) || isWallCoral(material) || isContainer(material);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user