Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. @EventHandler
  2. public void onClick(InventoryClickEvent e) {
  3. Player p = (Player) e.getWhoClicked();
  4. try {
  5. if(e.getInventory().getName().equalsIgnoreCase("§l§bLobby Changer")) {
  6. e.setCancelled(true);
  7. double x = p.getLocation().getX();
  8. double y = p.getLocation().getY();
  9. double z = p.getLocation().getZ();
  10. float yaw = p.getLocation().getYaw();
  11. float pitch = p.getLocation().getPitch();
  12.  
  13.  
  14. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§8Lobby1")) {
  15.  
  16. Location loc = new Location(Bukkit.getWorld(Main.world1), x, y, z, yaw, pitch);
  17. p.teleport(loc);
  18. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  19. p.closeInventory();
  20. p.sendMessage(Main.pr + "§7Du bist nun in der §aLobby1§7!");
  21. return;
  22. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§8Lobby2")) {
  23.  
  24. Location loc = new Location(Bukkit.getWorld(Main.world2), x, y, z, yaw, pitch);
  25. p.teleport(loc);
  26. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  27. p.closeInventory();
  28. p.sendMessage(Main.pr + "§7Du bist nun in der §aLobby2§7!");
  29. return;
  30. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§8Lobby3")) {
  31.  
  32. Location loc = new Location(Bukkit.getWorld(Main.world3), x, y, z, yaw, pitch);
  33. p.teleport(loc);
  34. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  35. p.closeInventory();
  36. p.sendMessage(Main.pr + "§7Du bist nun in der §aLobby3§7!");
  37. return;
  38. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§8Lobby4")) {
  39.  
  40. Location loc = new Location(Bukkit.getWorld(Main.world4), x, y, z, yaw, pitch);
  41. p.teleport(loc);
  42. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  43. p.closeInventory();
  44. p.sendMessage(Main.pr + "§7Du bist nun in der §aLobby4§7!");
  45. return;
  46. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§8Lobby5")) {
  47.  
  48. Location loc = new Location(Bukkit.getWorld(Main.world5), x, y, z, yaw, pitch);
  49. p.teleport(loc);
  50. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  51. p.closeInventory();
  52. p.sendMessage(Main.pr + "§7Du bist nun in der §aLobby5§7!");
  53. return;
  54. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Premium Lobby1")) {
  55. if(p.hasPermission("lobby.lobby.premium")) {
  56.  
  57. Location loc = new Location(Bukkit.getWorld(Main.pworld1), x, y, z, yaw, pitch);
  58. p.teleport(loc);
  59. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  60. p.closeInventory();
  61. p.sendMessage(Main.pr + "§7Du bist nun in der §aPremium Lobby1§7!");
  62. return;
  63. }else {
  64. p.sendMessage(Main.np);
  65. }
  66. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Premium Lobby2")) {
  67. if(p.hasPermission("lobby.lobby.premium")) {
  68.  
  69. Location loc = new Location(Bukkit.getWorld(Main.pworld2), x, y, z, yaw, pitch);
  70. p.teleport(loc);
  71. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  72. p.closeInventory();
  73. p.sendMessage(Main.pr + "§7Du bist nun in der §aPremium Lobby2§7!");
  74. return;
  75. }else {
  76. p.sendMessage(Main.np);
  77. }
  78. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Premium Lobby3")) {
  79. if(p.hasPermission("lobby.lobby.premium")) {
  80.  
  81. Location loc = new Location(Bukkit.getWorld(Main.pworld3), x, y, z, yaw, pitch);
  82. p.teleport(loc);
  83. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  84. p.closeInventory();
  85. p.sendMessage(Main.pr + "§7Du bist nun in der §aPremium Lobby3§7!");
  86. return;
  87. }else {
  88. p.sendMessage(Main.np);
  89. }
  90. }else if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cAdmin Lobby")) {
  91. if(p.hasPermission("lobby.lobby.vip")) {
  92.  
  93. Location loc = new Location(Bukkit.getWorld(Main.vworld1), x, y, z, yaw, pitch);
  94. p.teleport(loc);
  95. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 2F, 1F);
  96. p.closeInventory();
  97. p.sendMessage(Main.pr + "§7Du bist nun in der §cAdmin Lobby§7!");
  98. return;
  99. }else {
  100. p.sendMessage(Main.np);
  101. }
  102. }
  103. }
  104. } catch (NullPointerException e1) {
  105.  
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement