Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void trapPlayer(Player player,Player targetPlayer, Location location) {
- System.out.println(player.getName() + " trapped " + targetPlayer.getName());
- Location blockAbove = location.add(0, 1, 0);
- Location blockUnder = location.subtract(0, 2, 0);
- Location blockFront = location.add(1, 0, 0);
- Location blockBack = location.subtract(1, 0, 0);
- Location blockRight = location.add(0, 0, 1);
- Location blockLeft = location.subtract(0, 0, 1);
- Location blockUnderFront = location.subtract(0, 1, 0);
- blockUnderFront.add(1, 0, 0);
- Location blockUnderBack = location.subtract(0, 1, 0);
- blockUnderBack.subtract(1, 0, 0);
- Location blockUnderRight = location.subtract(0, 1, 0);
- blockUnderRight.add(0, 0, 1);
- Location blockUnderLeft = location.subtract(0, 1, 0);
- blockUnderLeft.subtract(0, 0, 1);
- blockAbove.getBlock().setType(Material.BARRIER);
- blockUnder.getBlock().setType(Material.BARRIER);
- blockFront.getBlock().setType(Material.BARRIER);
- blockBack.getBlock().setType(Material.BARRIER);
- blockLeft.getBlock().setType(Material.BARRIER);
- blockRight.getBlock().setType(Material.BARRIER);
- blockUnderFront.getBlock().setType(Material.BARRIER);
- blockUnderBack.getBlock().setType(Material.BARRIER);
- blockUnderRight.getBlock().setType(Material.BARRIER);
- blockUnderLeft.getBlock().setType(Material.BARRIER);
- player.sendMessage(ChatColor.AQUA + "You trapped " + player.getName() + ".");
- player.sendMessage(ChatColor.AQUA + "You got trapped! :D");
- }
- - location is the location of the player
- - and the messages "player.sendmessage" worked
Advertisement
Add Comment
Please, Sign In to add comment