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