Fixed Door, Trapdoor and Gate permissions.

This commit is contained in:
Brianna 2020-09-23 08:44:43 -05:00
parent 258d67d5b4
commit 1fd9732fc1
3 changed files with 55 additions and 22 deletions

View File

@ -24,19 +24,40 @@ public class DoorPermission extends ListeningPermission {
@PermissionHandler @PermissionHandler
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) if (event.getAction() == Action.LEFT_CLICK_BLOCK)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock()); CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
if (material == CompatibleMaterial.BIRCH_DOOR || material == CompatibleMaterial.ACACIA_DOOR if (material == null) return;
|| material == CompatibleMaterial.DARK_OAK_DOOR || material == CompatibleMaterial.JUNGLE_DOOR switch (material) {
|| material == CompatibleMaterial.SPRUCE_DOOR || material == CompatibleMaterial.OAK_DOOR) case OAK_DOOR:
cancelAndMessage(event, player, plugin, messageManager); case BIRCH_DOOR:
case ACACIA_DOOR:
case JUNGLE_DOOR:
case SPRUCE_DOOR:
case WARPED_DOOR:
case CRIMSON_DOOR:
case DARK_OAK_DOOR:
case OAK_TRAPDOOR:
case BIRCH_TRAPDOOR:
case ACACIA_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case WARPED_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case ACACIA_FENCE_GATE:
case OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
cancelAndMessage(event, player, plugin, messageManager);
}
} }
} }

View File

@ -23,17 +23,23 @@ public class GatePermission extends ListeningPermission {
@PermissionHandler @PermissionHandler
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock()); CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
if (material == null) return;
if (material == CompatibleMaterial.OAK_FENCE_GATE || material == CompatibleMaterial.ACACIA_FENCE_GATE switch (material) {
|| material == CompatibleMaterial.BIRCH_FENCE_GATE || material == CompatibleMaterial.DARK_OAK_FENCE_GATE case ACACIA_FENCE_GATE:
|| material == CompatibleMaterial.JUNGLE_FENCE_GATE || material == CompatibleMaterial.SPRUCE_FENCE_GATE) case OAK_FENCE_GATE:
cancelAndMessage(event, player, plugin, messageManager); case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
case CRIMSON_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
cancelAndMessage(event, player, plugin, messageManager);
}
} }
} }

View File

@ -23,17 +23,23 @@ public class TrapdoorPermission extends ListeningPermission {
@PermissionHandler @PermissionHandler
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_BLOCK)
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock()); CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
if (material == null) return;
if (material == CompatibleMaterial.OAK_TRAPDOOR || material == CompatibleMaterial.SPRUCE_TRAPDOOR switch (material) {
|| material == CompatibleMaterial.BIRCH_TRAPDOOR || material == CompatibleMaterial.JUNGLE_TRAPDOOR case OAK_TRAPDOOR:
|| material == CompatibleMaterial.ACACIA_TRAPDOOR || material == CompatibleMaterial.DARK_OAK_TRAPDOOR) case BIRCH_TRAPDOOR:
cancelAndMessage(event, player, plugin, messageManager); case ACACIA_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case WARPED_TRAPDOOR:
case CRIMSON_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
cancelAndMessage(event, player, plugin, messageManager);
}
} }
} }