Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ((targetBlock != null) && (targetBlock.getLocation().getY() > 0.0D)) {
- final Location location = targetBlock.getLocation().clone();
- location.setY(location.getY() + 1);
- location.setYaw(player.getLocation().getYaw());
- location.setPitch(player.getLocation().getPitch());
- Block loc = (Block) location.getBlock();
- boolean blockSouth = (targetBlock.getFace(loc) == BlockFace.SOUTH);
- boolean blockNorth = (targetBlock.getFace(loc) == BlockFace.NORTH);
- boolean blockEast = (targetBlock.getFace(loc) == BlockFace.EAST);
- boolean blockWest = (targetBlock.getFace(loc) == BlockFace.WEST);
- boolean blockDown = (targetBlock.getFace(loc) == BlockFace.DOWN);
- boolean blockUp = (targetBlock.getFace(loc) == BlockFace.UP);
- if(blockSouth || blockNorth || blockEast || blockWest){
- player.teleport(location);
- }else if (blockUp || blockDown){
- player.sendMessage("You cannot do that!");
- }
Add Comment
Please, Sign In to add comment