Fixed broken inputs with more than one lift, closes #78

This commit is contained in:
Stijn Bannink 2023-08-19 19:17:05 +02:00
parent 2e28ad658e
commit 92a60be306

View file

@ -42,7 +42,6 @@ public class PlayerInteractListener implements Listener {
Action action = e.getAction(); Action action = e.getAction();
Block block = e.getClickedBlock(); Block block = e.getClickedBlock();
if (block == null) return; if (block == null) return;
Material button = block.getType();
if (action == Action.RIGHT_CLICK_BLOCK if (action == Action.RIGHT_CLICK_BLOCK
&& e.getHand() != EquipmentSlot.OFF_HAND) { && e.getHand() != EquipmentSlot.OFF_HAND) {
@ -51,6 +50,7 @@ public class PlayerInteractListener implements Listener {
int y = block.getY(); int y = block.getY();
int z = block.getZ(); int z = block.getZ();
outer:
for (Map.Entry<String, Lift> entry : DataManager.getLifts().entrySet()) { for (Map.Entry<String, Lift> entry : DataManager.getLifts().entrySet()) {
Lift lift = entry.getValue(); Lift lift = entry.getValue();
@ -68,21 +68,17 @@ public class PlayerInteractListener implements Listener {
b.setBlockData(bd); b.setBlockData(bd);
} }
break; break outer; //We handled an input, stop!
} }
} }
if (lift.isOffline()) break;
for (LiftInput lbi : lift.getInputs()) { for (LiftInput lbi : lift.getInputs()) {
if (world.equals(lbi.getWorld()) && x == lbi.getX() && y == lbi.getY() && z == lbi.getZ()) { if (world.equals(lbi.getWorld()) && x == lbi.getX() && y == lbi.getY() && z == lbi.getZ()) {
V10LiftAPI.getInstance().addToQueue(entry.getKey(), lift.getFloors().get(lbi.getFloor()), lbi.getFloor()); V10LiftAPI.getInstance().addToQueue(entry.getKey(), lift.getFloors().get(lbi.getFloor()), lbi.getFloor());
e.setCancelled(true); e.setCancelled(true);
break; break outer; //We handled an input, stop!
} }
} }
break;
} }
} }
} }