Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1.             if ((targetBlock != null) && (targetBlock.getLocation().getY() > 0.0D)) {
  2.               final Location location = targetBlock.getLocation().clone();
  3.              
  4.              
  5.               location.setY(location.getY() + 1);
  6.               location.setYaw(player.getLocation().getYaw());
  7.               location.setPitch(player.getLocation().getPitch());
  8.              Block loc = (Block) location.getBlock();
  9.              
  10.              boolean blockSouth = (targetBlock.getFace(loc) == BlockFace.SOUTH);
  11.              boolean blockNorth = (targetBlock.getFace(loc) == BlockFace.NORTH);
  12.              boolean blockEast = (targetBlock.getFace(loc) == BlockFace.EAST);
  13.              boolean blockWest = (targetBlock.getFace(loc) == BlockFace.WEST);
  14.              boolean blockDown = (targetBlock.getFace(loc) == BlockFace.DOWN);
  15.              boolean blockUp = (targetBlock.getFace(loc) == BlockFace.UP);
  16.              
  17.               if(blockSouth || blockNorth || blockEast || blockWest){
  18.                   player.teleport(location);
  19.               }else if (blockUp || blockDown){
  20.                   player.sendMessage("You cannot do that!");
  21.               }
Add Comment
Please, Sign In to add comment