Skip to content

Commit

Permalink
Fix for signs not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleBigBug committed Jul 6, 2020
1 parent ee6b488 commit 85b0e25
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/TheDgtl/Stargate/Portal.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ public ArrayList<String> 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);
Expand Down
41 changes: 19 additions & 22 deletions src/main/java/net/TheDgtl/Stargate/Stargate.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85b0e25

Please sign in to comment.