diff --git a/src/main/java/net/TheDgtl/Stargate/Portal.java b/src/main/java/net/TheDgtl/Stargate/Portal.java index 5e767f078..42ea693e7 100644 --- a/src/main/java/net/TheDgtl/Stargate/Portal.java +++ b/src/main/java/net/TheDgtl/Stargate/Portal.java @@ -676,7 +676,7 @@ public ArrayList getSignLines() { } int curIndex = destinations.indexOf(destination); - int i = Math.max(curIndex - (curIndex == max ? 2 : 1), 0); + int i = Math.min(max, Math.max(0, curIndex - (curIndex == max ? 2 : 1))); while (lines.size() < 3) { String drawDestination = destinations.get(i); diff --git a/src/main/java/net/TheDgtl/Stargate/Stargate.java b/src/main/java/net/TheDgtl/Stargate/Stargate.java index 3feaf1fdf..1694a9641 100644 --- a/src/main/java/net/TheDgtl/Stargate/Stargate.java +++ b/src/main/java/net/TheDgtl/Stargate/Stargate.java @@ -926,35 +926,32 @@ public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); BlockData blockData = block.getBlockData(); Action action = event.getAction(); + Material blockMat = block.getType(); - if (action == Action.RIGHT_CLICK_BLOCK) { - Material blockMat = block.getType(); + if (action == Action.RIGHT_CLICK_BLOCK + && (blockMat == Material.STONE_BUTTON || blockMat == Material.DEAD_TUBE_CORAL_WALL_FAN)) { - if (blockMat == Material.STONE_BUTTON || blockMat == Material.DEAD_TUBE_CORAL_WALL_FAN) { - Portal portal = Portal.getByBlock(block); - if (portal == null) return; - - // Cancel item use - event.setUseItemInHand(Result.DENY); - event.setUseInteractedBlock(Result.DENY); + Portal portal = Portal.getByBlock(block); + if (portal == null) return; - boolean deny = false; - if (!Stargate.canAccessNetwork(player, portal.getNetwork())) { - deny = true; - } + // Cancel item use + event.setUseItemInHand(Result.DENY); + event.setUseInteractedBlock(Result.DENY); - if (!Stargate.canAccessPortal(player, portal, deny)) { - Stargate.sendMessage(player, Stargate.getString("denyMsg")); - return; - } + boolean deny = false; + if (!Stargate.canAccessNetwork(player, portal.getNetwork())) { + deny = true; + } - openPortal(player, portal); - if (portal.isOpenFor(player)) { - event.setUseInteractedBlock(Result.ALLOW); - } + if (!Stargate.canAccessPortal(player, portal, deny)) { + Stargate.sendMessage(player, Stargate.getString("denyMsg")); + return; } - return; + openPortal(player, portal); + if (portal.isOpenFor(player)) { + event.setUseInteractedBlock(Result.ALLOW); + } } if (blockData instanceof WallSign