Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. package me.Jan2808.navigator;
  2.  
  3. import java.io.File;
  4.  
  5. import javax.crypto.Mac;
  6.  
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.Location;
  9. import org.bukkit.Material;
  10. import org.bukkit.Sound;
  11. import org.bukkit.configuration.file.YamlConfiguration;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.EventHandler;
  14. import org.bukkit.event.Listener;
  15. import org.bukkit.event.inventory.InventoryClickEvent;
  16. import org.bukkit.event.player.PlayerInteractEvent;
  17. import org.bukkit.inventory.Inventory;
  18. import org.bukkit.inventory.ItemStack;
  19. import org.bukkit.inventory.meta.ItemMeta;
  20.  
  21. ;
  22.  
  23. public class compass_item implements Listener{
  24.  
  25. @EventHandler
  26. public void onInteract(PlayerInteractEvent e) {
  27. Player p = e.getPlayer();
  28. try {
  29. if(e.getItem().getItemMeta().getDisplayName().equals("§6Navigator")) {
  30. Inventory inv = Bukkit.createInventory(null, 9, "§6Navigator");
  31. p.playSound(p.getLocation(), Sound.NOTE_BASS_DRUM, 1, 1);
  32.  
  33. ItemStack ffa = new ItemStack(Material.BED);
  34. ItemMeta ffameta = ffa.getItemMeta();
  35. ffameta.setDisplayName("cBedWars");
  36. ffa.setItemMeta(ffameta);
  37.  
  38. ItemStack ffa1 = new ItemStack(Material.STONE_SWORD);
  39. ItemMeta ffameta1 = ffa1.getItemMeta();
  40. ffameta1.setDisplayName("c1v1");
  41. ffa1.setItemMeta(ffameta1);
  42.  
  43. ItemStack ffa2 = new ItemStack(Material.GRASS);
  44. ItemMeta ffameta2 = ffa2.getItemMeta();
  45. ffameta2.setDisplayName("cSkyWars");
  46. ffa2.setItemMeta(ffameta2);
  47.  
  48. ItemStack ffa21 = new ItemStack(Material.STICK);
  49. ItemMeta ffameta21 = ffa21.getItemMeta();
  50. ffameta21.setDisplayName("cKBFFA");
  51. ffa21.setItemMeta(ffameta21);
  52.  
  53.  
  54. ItemStack ffa22 = new ItemStack(Material.TNT);
  55. ItemMeta ffameta22 = ffa22.getItemMeta();
  56. ffameta22.setDisplayName("cTnT Run");
  57. ffa22.setItemMeta(ffameta22);
  58.  
  59. inv.setItem(0, ffa);
  60. inv.setItem(1, ffa1);
  61. inv.setItem(4, ffa21);
  62. inv.setItem(7, ffa2);
  63. inv.setItem(8, ffa22);
  64. p.openInventory(inv);
  65.  
  66.  
  67.  
  68.  
  69. }
  70. }catch(Exception e1) {
  71.  
  72. }
  73. }
  74. @EventHandler
  75. public void onClick(InventoryClickEvent e) {
  76. Player p = (Player)e.getWhoClicked();
  77. if(e.getInventory().getName().equalsIgnoreCase("§6Navigator"));
  78. e.setCancelled(true);
  79. if(e.getCurrentItem().getType() == Material.BED) {
  80. File file = new File("plugin//LobbySystem//spawns.yml");
  81. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  82. String w = cfg.getString("Spawn21.WeltName");
  83. double x = cfg.getDouble("Spawn21.X");
  84. double Y = cfg.getDouble("Spawn21.Y");
  85. double Z = cfg.getDouble("Spawn21.Z");
  86. double yaw = cfg.getDouble("sSpawn21Yaw");
  87. double pitch = cfg.getDouble("Spawn21.Pitch");
  88. org.bukkit.Location loc = new org.bukkit.Location(Bukkit.getWorld(w), x, Y, Z);
  89. loc.setY((float)yaw);
  90. loc.setPitch((float)pitch);
  91. p.teleport(loc);
  92. p.sendMessage(Main.Prefix + "§aDu hast dich zu SkyWars teleportiert!");
  93. p.closeInventory();
  94. }else if (e.getCurrentItem().getType() == Material.IRON_SWORD) {
  95. if(e.getCurrentItem().getType() == Material.STONE_SWORD) {
  96. File file = new File("plugin//LobbySystem//spawns.yml");
  97. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  98. String w = cfg.getString("Spawn2.WeltName");
  99. double x = cfg.getDouble("Spawn2.X");
  100. double Y = cfg.getDouble("Spawn2.Y");
  101. double Z = cfg.getDouble("Spawn2.Z");
  102. double yaw = cfg.getDouble("sSpawn1Yaw");
  103. double pitch = cfg.getDouble("Spawn1.Pitch");
  104. org.bukkit.Location loc = new org.bukkit.Location(Bukkit.getWorld(w), x, Y, Z);
  105. loc.setY((float)yaw);
  106. loc.setPitch((float)pitch);
  107. p.teleport(loc);
  108. p.sendMessage(Main.Prefix + "§aDu hast dich zu 1v1 teleportiert!");
  109. p.closeInventory();
  110. } if(e.getCurrentItem().getType() == Material.BED) {
  111. File file = new File("plugin//LobbySystem//spawns.yml");
  112. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  113. String w = cfg.getString("Spawn1.WeltName");
  114. double x = cfg.getDouble("Spawn1.X");
  115. double Y = cfg.getDouble("Spawn1.Y");
  116. double Z = cfg.getDouble("Spawn1.Z");
  117. double yaw = cfg.getDouble("sSpawn1Yaw");
  118. double pitch = cfg.getDouble("Spawn1.Pitch");
  119. org.bukkit.Location loc = new org.bukkit.Location(Bukkit.getWorld(w), x, Y, Z);
  120. loc.setY((float)yaw);
  121. loc.setPitch((float)pitch);
  122. p.teleport(loc);
  123. p.sendMessage(Main.Prefix + "§aDu hast dich zu BedWars teleportiert!");
  124. p.closeInventory();
  125. }
  126. }else if(e.getCurrentItem().getType() == Material.FIREBALL) {
  127. if(e.getCurrentItem().getType() == Material.FIREBALL) {
  128. File file = new File("plugin//LobbySystem//spawns.yml");
  129. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  130. String w = cfg.getString("Spawn.WeltName");
  131. double x = cfg.getDouble("Spawn.X");
  132. double Y = cfg.getDouble("Spawn.Y");
  133. double Z = cfg.getDouble("Spawn.Z");
  134. double yaw = cfg.getDouble("sSpawn1Yaw");
  135. double pitch = cfg.getDouble("Spawn1.Pitch");
  136. org.bukkit.Location loc = new org.bukkit.Location(Bukkit.getWorld(w), x, Y, Z);
  137. loc.setY((float)yaw);
  138. loc.setPitch((float)pitch);
  139. p.teleport(loc);
  140. p.sendMessage(Main.Prefix + "§aDu hast dich zu Spawn teleportiert!");
  141. p.closeInventory();
  142. } if(e.getCurrentItem().getType() == Material.TNT) {
  143. File file = new File("plugin//LobbySystem//spawns.yml");
  144. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  145. String w = cfg.getString("Spawn22.WeltName");
  146. double x = cfg.getDouble("Spawn22.X");
  147. double Y = cfg.getDouble("Spawn22.Y");
  148. double Z = cfg.getDouble("Spawn22.Z");
  149. double yaw = cfg.getDouble("sSpawn1Yaw");
  150. double pitch = cfg.getDouble("Spawn1.Pitch");
  151. org.bukkit.Location loc = new org.bukkit.Location(Bukkit.getWorld(w), x, Y, Z);
  152. loc.setY((float)yaw);
  153. loc.setPitch((float)pitch);
  154. p.teleport(loc);
  155. p.sendMessage(Main.Prefix + "§aDu hast dich zu TnT Run teleportiert!");
  156. p.closeInventory();
  157. }
  158. }
  159. }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement