Skip to content

Commit

Permalink
Ticket #187
Browse files Browse the repository at this point in the history
  • Loading branch information
zelytra committed Sep 13, 2021
1 parent 88d7872 commit 25eb91c
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,24 @@ public class InteractListener implements Listener {

@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (Daedalus.getInstance().getGameManager().getState() != GameStatesEnum.RUNNING) {
return;
}
if (Daedalus.getInstance().getStructureManager().getStructuresPosition().isEmpty()) {
return;
}

if (Daedalus.getInstance().getGameManager().getState() != GameStatesEnum.RUNNING) return;

if (Daedalus.getInstance().getStructureManager().getStructuresPosition().isEmpty()) return;

Maze maze = Daedalus.getInstance().getStructureManager().getMaze();
if (maze == null) {
return;
}
System.out.println("trigger");

if (maze == null) return;

int groundY = (int) maze.getOrigin().getY();

if (e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_BLOCK) {

Vector2 matrixCoordinate = new Vector2((int) (e.getClickedBlock().getX() - maze.getOrigin().getX() + 1), (int) (e.getClickedBlock().getZ() - maze.getOrigin().getZ() + 1));
System.out.println(maze.getMaze()[matrixCoordinate.x][matrixCoordinate.z]);
if (maze.getMaze()[matrixCoordinate.x][matrixCoordinate.z] >= 1 && e.getClickedBlock().getY() >= groundY + (wallHigh - limit)) {
System.out.println("cancel");

if (maze.getMaze()[matrixCoordinate.x][matrixCoordinate.z] >= 1 && e.getClickedBlock().getY() >= groundY + (wallHigh - limit))
e.setCancelled(true);
}

}

}
Expand Down

0 comments on commit 25eb91c

Please sign in to comment.