Guest User

Untitled

a guest
Jul 3rd, 2020
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. public static void trapPlayer(Player player,Player targetPlayer, Location location) {
  2. System.out.println(player.getName() + " trapped " + targetPlayer.getName());
  3. Location blockAbove = location.add(0, 1, 0);
  4. Location blockUnder = location.subtract(0, 2, 0);
  5. Location blockFront = location.add(1, 0, 0);
  6. Location blockBack = location.subtract(1, 0, 0);
  7. Location blockRight = location.add(0, 0, 1);
  8. Location blockLeft = location.subtract(0, 0, 1);
  9. Location blockUnderFront = location.subtract(0, 1, 0);
  10. blockUnderFront.add(1, 0, 0);
  11. Location blockUnderBack = location.subtract(0, 1, 0);
  12. blockUnderBack.subtract(1, 0, 0);
  13. Location blockUnderRight = location.subtract(0, 1, 0);
  14. blockUnderRight.add(0, 0, 1);
  15. Location blockUnderLeft = location.subtract(0, 1, 0);
  16. blockUnderLeft.subtract(0, 0, 1);
  17. blockAbove.getBlock().setType(Material.BARRIER);
  18. blockUnder.getBlock().setType(Material.BARRIER);
  19. blockFront.getBlock().setType(Material.BARRIER);
  20. blockBack.getBlock().setType(Material.BARRIER);
  21. blockLeft.getBlock().setType(Material.BARRIER);
  22. blockRight.getBlock().setType(Material.BARRIER);
  23. blockUnderFront.getBlock().setType(Material.BARRIER);
  24. blockUnderBack.getBlock().setType(Material.BARRIER);
  25. blockUnderRight.getBlock().setType(Material.BARRIER);
  26. blockUnderLeft.getBlock().setType(Material.BARRIER);
  27. player.sendMessage(ChatColor.AQUA + "You trapped " + player.getName() + ".");
  28. player.sendMessage(ChatColor.AQUA + "You got trapped! :D");
  29.  
  30.  
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37. - location is the location of the player
  38.  
  39. - and the messages "player.sendmessage" worked
Advertisement
Add Comment
Please, Sign In to add comment