RS_Darki

Untitled

Oct 4th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. package com.darki.naps;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Material;
  8. import org.bukkit.enchantments.Enchantment;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.block.Action;
  13. import org.bukkit.event.player.PlayerInteractEvent;
  14. import org.bukkit.inventory.ItemStack;
  15. import org.bukkit.inventory.meta.ItemMeta;
  16.  
  17. import de.slikey.effectlib.EffectManager;
  18. import de.slikey.effectlib.effect.TornadoEffect;
  19.  
  20. public class InteractListener implements Listener {
  21.  
  22. private napsmain plugin;
  23. ArrayList<String> h = new ArrayList<String>();
  24.  
  25. public InteractListener(napsmain napsmain){
  26. this.plugin = napsmain;
  27. this.plugin.getServer().getPluginManager().registerEvents(this, plugin);
  28. }
  29.  
  30.  
  31. @EventHandler
  32. public void onPlayerInteract(PlayerInteractEvent e){
  33. Player p = e.getPlayer();
  34.  
  35. if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
  36. if(e.getMaterial().equals(Material.NETHER_STAR)){
  37. plugin.inv = p.getServer().createInventory(null, 9, ChatColor.AQUA + "NewAge PointShop");
  38.  
  39. ItemStack item = new ItemStack(Material.DRAGON_EGG);
  40. ItemMeta meta = item.getItemMeta();
  41. meta.setDisplayName(ChatColor.LIGHT_PURPLE + "Pets");
  42.  
  43. ArrayList<String> lore = new ArrayList<String>();
  44. lore.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Buy a Pet");
  45. meta.setLore(lore);
  46. meta.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
  47. item.setItemMeta(meta);
  48.  
  49. plugin.inv.setItem(0, item);
  50.  
  51. ItemStack item1 = new ItemStack(Material.DIAMOND_BOOTS);
  52. ItemMeta meta1 = item1.getItemMeta();
  53. meta1.setDisplayName(ChatColor.GOLD + "Boots");
  54.  
  55. ArrayList<String> lore1 = new ArrayList<String>();
  56. lore1.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Buy Boots");
  57. meta1.setLore(lore1);
  58. meta1.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
  59. item1.setItemMeta(meta1);
  60.  
  61. plugin.inv.setItem(2, item1);
  62.  
  63. ItemStack item2 = new ItemStack(Material.EMERALD);
  64. ItemMeta meta2 = item2.getItemMeta();
  65. meta2.setDisplayName(ChatColor.GREEN + "Gamemodes");
  66.  
  67. ArrayList<String> lore2 = new ArrayList<String>();
  68. lore2.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Things for the Gamemodes");
  69. meta2.setLore(lore2);
  70. meta2.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
  71. item2.setItemMeta(meta2);
  72. plugin.inv.setItem(4, item2);
  73.  
  74. ItemStack item4 = new ItemStack(Material.BEDROCK);
  75. ItemMeta meta4 = item4.getItemMeta();
  76. meta4.setDisplayName(ChatColor.RED + "Particle");
  77.  
  78. ArrayList<String> lore4 = new ArrayList<String>();
  79. lore4.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "COMMING SOON");
  80. meta4.setLore(lore4);
  81. meta4.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
  82. item4.setItemMeta(meta4);
  83.  
  84. plugin.inv.setItem(6, item4);
  85.  
  86. ItemStack item3 = new ItemStack(Material.BARRIER);
  87. ItemMeta meta3 = item3.getItemMeta();
  88. meta3.setDisplayName(ChatColor.LIGHT_PURPLE + "Close");
  89.  
  90. meta3.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
  91. item3.setItemMeta(meta3);
  92.  
  93. plugin.inv.setItem(8, item3);
  94.  
  95.  
  96. p.openInventory(plugin.inv);
  97. }
  98.  
  99.  
  100.  
  101.  
  102. }
  103. if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
  104. if(e.getMaterial().equals(Material.SLIME_BALL)){
  105.  
  106. for(Player players : Bukkit.getOnlinePlayers()){
  107.  
  108. if(!h.contains(p.getName())){
  109. h.add(p.getName());
  110. p.hidePlayer(players);
  111. p.sendMessage(ChatColor.DARK_AQUA + "All Players are now " + ChatColor.RED + "hidden");
  112. ItemStack i = new ItemStack(Material.MAGMA_CREAM);
  113. ItemMeta im = i.getItemMeta();
  114. im.setDisplayName(ChatColor.GOLD + "Make all Player Visible");
  115.  
  116. im.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, true);
  117. i.setItemMeta(im);
  118. p.getPlayer().getInventory().setItem(8, i);
  119. }
  120.  
  121. }
  122. }
  123. if(e.getMaterial().equals(Material.MAGMA_CREAM)){
  124.  
  125. for(Player players : Bukkit.getOnlinePlayers()){
  126.  
  127. if(h.contains(p.getName())){
  128. h.remove(p.getName());
  129. p.showPlayer(players);
  130. p.sendMessage(ChatColor.DARK_AQUA + "All Players are now " + ChatColor.GREEN + "visible");
  131.  
  132. ItemStack i = new ItemStack(Material.SLIME_BALL);
  133. ItemMeta im = i.getItemMeta();
  134. im.setDisplayName(ChatColor.GREEN + "Hide all Players");
  135.  
  136. im.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, true);
  137. i.setItemMeta(im);
  138. p.getPlayer().getInventory().setItem(8, i);
  139. }
  140. }
  141. }
  142. }
  143. if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
  144. if(e.getMaterial().equals(Material.BLAZE_POWDER)){
  145. TornadoEffect effect = new TornadoEffect(napsmain.em);
  146. effect.getLocation();
  147. effect.start();
  148. }
  149. }
  150. if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
  151. if(e.getMaterial().equals(Material.STICK)){
  152. this.plugin.getInventory(p);
  153. }
  154. }
  155. }
  156. }
Advertisement
Add Comment
Please, Sign In to add comment