Advertisement
DSHunterMC

Untitled

Sep 23rd, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.68 KB | None | 0 0
  1. @EventHandler
  2. public void STOP(PlayerInteractEvent e) {
  3. stop = Bukkit.createInventory(null, 9, ChatColor.DARK_RED + "" + ChatColor.UNDERLINE + "Are you sure?");
  4. stop.setItem(0, accept);
  5. stop.setItem(8, deny);
  6. stop.setItem(4, RUSHURE);
  7.  
  8. }
  9. //-------------------------- Stop GUI ------------------------------------------------
  10. @SuppressWarnings("deprecation")
  11. @EventHandler
  12. public void STOP2(InventoryClickEvent e) {
  13. Player p = (Player) e.getWhoClicked();
  14.  
  15. //------------------------------------------ accept stop -----------------------------------------------------
  16. if(e.getInventory().getName().equals(ChatColor.DARK_RED + "" + ChatColor.UNDERLINE + "Are you sure?")) {
  17. e.setCancelled(true);
  18.  
  19. if(e.getCurrentItem() == null) {
  20. return;
  21. }
  22.  
  23. if(e.getCurrentItem().getType() == Material.EMERALD_BLOCK) {
  24. p.performCommand("stop");
  25. p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_USE, 1.0f, 1.0f);
  26. p.closeInventory();
  27. p.getInventory().remove(accept);
  28. p.updateInventory();
  29. //------------------------------------------ accept stop -----------------------------------------------------
  30. }
  31. //------------------------------------------- deny stop ------------------------------------------------------
  32.  
  33. if(e.getInventory().getName().equals(ChatColor.DARK_RED + "" + ChatColor.UNDERLINE + "Are you sure?")) {
  34. e.setCancelled(true);
  35.  
  36. if(e.getCurrentItem() == null) {
  37. return;
  38. }
  39.  
  40. if(e.getCurrentItem().getType() == Material.BARRIER) {
  41. p.openInventory(agui);
  42. p.playSound(p.getLocation(), Sound.ITEM_SHIELD_BREAK, 1.0f, 1.0f);
  43.  
  44. }
  45.  
  46. }
  47.  
  48.  
  49. //------------------------------------------- deny stop ------------------------------------------------------
  50. }
  51.  
  52. }
  53.  
  54. //-------------------------- Stop GUI ------------------------------------------------
  55.  
  56. // ------------------------- Agui GUI -----------------------------
  57.  
  58. @EventHandler
  59. public void Reload(PlayerInteractEvent e) {
  60. rload = Bukkit.createInventory(null, 9, ChatColor.RED + "" + ChatColor.UNDERLINE + "Are you sure?");
  61. rload.setItem(4, RUSHURE);
  62. rload.setItem(0, accept);
  63. rload.setItem(8, deny);
  64.  
  65. }
  66.  
  67. @SuppressWarnings("deprecation")
  68. @EventHandler
  69. public void Reload2(InventoryClickEvent e) {
  70. Player p = (Player) e.getWhoClicked();
  71.  
  72. //-------------------------------- Reload ------------------------------------------------
  73.  
  74. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.UNDERLINE + "Are you sure?")) {
  75. e.setCancelled(true);
  76.  
  77. if(e.getCurrentItem() == null) {
  78. return;
  79. }
  80.  
  81. if(e.getCurrentItem().getType() == Material.EMERALD_BLOCK) {
  82. p.performCommand("reload");
  83. p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
  84. p.closeInventory();
  85. p.getInventory().remove(accept);
  86. p.updateInventory();
  87.  
  88.  
  89. }
  90.  
  91.  
  92.  
  93.  
  94. //-------------------------------- Reload ------------------------------------------------
  95.  
  96. // ------------------------------- reload button ------------------------------------------
  97.  
  98. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!")) {
  99.  
  100. if(e.getCurrentItem() == null) {
  101. return;
  102.  
  103. }
  104.  
  105. if(e.getCurrentItem().getType() == Material.PRISMARINE_SHARD) {
  106. }
  107.  
  108.  
  109. }
  110. // ------------------------------- reload button ------------------------------------------
  111.  
  112. // ------------------------------- go back button -----------------------------------------
  113.  
  114. if(e.getInventory().getName().equals(rload.getName())) {
  115.  
  116. if(e.getCurrentItem() == null) {
  117. return;
  118. }
  119.  
  120. if(e.getCurrentItem().getType() == Material.BARRIER) {
  121. p.openInventory(agui);
  122. p.playSound(p.getLocation(), Sound.ITEM_SHIELD_BREAK, 1.0f, 1.0f);
  123.  
  124. }
  125. }
  126. }
  127. }
  128.  
  129. // ------------------------------- go back button -----------------------------------------
  130.  
  131.  
  132. @SuppressWarnings("deprecation")
  133. @EventHandler
  134. public void AGUI(PlayerInteractEvent e ) {
  135. Player p = e.getPlayer();
  136. // GUI! V---
  137. agui = Bukkit.createInventory(null, 54, ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!");
  138. agui.setItem(0, Plugins);
  139. agui.setItem(40, gm1);
  140. agui.setItem(37, gm0);
  141. agui.setItem(43, gm3);
  142. agui.setItem(45, reload);
  143. agui.setItem(53, STOP);
  144. if(p.hasPermission("hhf.agui.open")) {
  145. if(p.getInventory().getItemInHand().getType() == Material.END_CRYSTAL) {
  146. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
  147. p.openInventory(agui);
  148. }
  149. }
  150.  
  151. }
  152.  
  153.  
  154. // ------------------------- Agui GUI -----------------------------
  155. }
  156. //----------------------------- Execute Commands for Agui buttons -------------------------------------
  157. @EventHandler
  158. public void AGUI2(InventoryClickEvent e) {
  159. Player p = (Player) e.getWhoClicked();
  160.  
  161. // --------------------------- Plugins button -----------------------------------------
  162. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!")) {
  163. e.setCancelled(true);
  164.  
  165. if(e.getCurrentItem() == null) {
  166. return;
  167. }
  168.  
  169. if(e.getCurrentItem().getType() == Material.REDSTONE) {
  170. p.performCommand("plugins");
  171. p.closeInventory();
  172. p.playSound(p.getLocation(), Sound.ENTITY_ARMORSTAND_PLACE, 1.0f, 1.0f);
  173. }
  174. // --------------------------- Plugins button -----------------------------------------
  175.  
  176. // ------------------------------- Gamemode 1 button -----------------------------------
  177. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!")) {
  178.  
  179. if(e.getCurrentItem() == null) {
  180. return;
  181.  
  182. }
  183.  
  184. if(e.getCurrentItem().getType() == Material.ELYTRA) {
  185. p.sendMessage(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Gamemode set to " + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Gamemode 1!");
  186. p.setGameMode(GameMode.CREATIVE);
  187. p.closeInventory();
  188. p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 1.0f, 1.0f);
  189.  
  190. }
  191. // ------------------------------- Gamemode 1 button -----------------------------------
  192.  
  193. // ------------------------------- Gamemode 0 button --------------------------------------
  194.  
  195. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!")) {
  196. e.setCancelled(true);
  197.  
  198. if(e.getCurrentItem() == null) {
  199. return;
  200.  
  201. }
  202.  
  203. if(e.getCurrentItem().getType() == Material.ENCHANTMENT_TABLE) {
  204. p.setGameMode(GameMode.SURVIVAL);
  205. p.sendMessage(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Gamemode set to " + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Gamemode 0!");
  206. p.closeInventory();
  207. p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_PLACE, 1.0f, 1.0f);
  208.  
  209. }
  210. }
  211.  
  212.  
  213. // ------------------------------- Gamemode 0 button --------------------------------------
  214.  
  215. // ------------------------------- Gamemode 3 button --------------------------------------
  216.  
  217. if(e.getInventory().getName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Admin GUI!")) {
  218. e.setCancelled(true);
  219.  
  220. if(e.getCurrentItem() == null) {
  221. return;
  222.  
  223. }
  224.  
  225. if(e.getCurrentItem().getType() == Material.ENDER_PORTAL_FRAME) {
  226. p.setGameMode(GameMode.SPECTATOR);
  227. p.sendMessage(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "Gamemode set to " + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Gamemode 3!");
  228. p.closeInventory();
  229. p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_BREAK, 1.0f, 1.0f);
  230.  
  231. }
  232. }
  233.  
  234.  
  235. }
  236.  
  237. }
  238. // ------------------------------- Gamemode 3 button --------------------------------------
  239.  
  240.  
  241. //----------------------------- Execute Commands for Agui buttons -------------------------------------
  242.  
  243. }
  244.  
  245. // ---------------------------------- reload and stop slots ------------------------------------------------------
  246. @EventHandler
  247. public void onClick(InventoryClickEvent e) {
  248.  
  249. Player p = (Player) e.getWhoClicked();
  250.  
  251. if(e.getInventory().getTitle().equals("agui"));
  252.  
  253. if(e.getSlot() == 45) {
  254.  
  255. p.openInventory(rload);
  256. p.playSound(p.getLocation(), Sound.ITEM_SHIELD_BLOCK, 1.0f, 1.0f);
  257.  
  258. } else if (e.getSlot() == 53) {
  259. p.openInventory(stop);
  260. p.playSound(p.getLocation(), Sound.ITEM_BUCKET_EMPTY_LAVA, 1.0f, 1.0f);
  261.  
  262. }
  263. }
  264. }
  265.  
  266.  
  267. // ---------------------------------- reload and stop slots ------------------------------------------------------
  268.  
  269.  
  270. // ------------------------- Agui GUI's -----------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement