Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.darki.naps;
- import java.util.ArrayList;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import de.slikey.effectlib.EffectManager;
- import de.slikey.effectlib.effect.TornadoEffect;
- public class InteractListener implements Listener {
- private napsmain plugin;
- ArrayList<String> h = new ArrayList<String>();
- public InteractListener(napsmain napsmain){
- this.plugin = napsmain;
- this.plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
- if(e.getMaterial().equals(Material.NETHER_STAR)){
- plugin.inv = p.getServer().createInventory(null, 9, ChatColor.AQUA + "NewAge PointShop");
- ItemStack item = new ItemStack(Material.DRAGON_EGG);
- ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(ChatColor.LIGHT_PURPLE + "Pets");
- ArrayList<String> lore = new ArrayList<String>();
- lore.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Buy a Pet");
- meta.setLore(lore);
- meta.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
- item.setItemMeta(meta);
- plugin.inv.setItem(0, item);
- ItemStack item1 = new ItemStack(Material.DIAMOND_BOOTS);
- ItemMeta meta1 = item1.getItemMeta();
- meta1.setDisplayName(ChatColor.GOLD + "Boots");
- ArrayList<String> lore1 = new ArrayList<String>();
- lore1.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Buy Boots");
- meta1.setLore(lore1);
- meta1.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
- item1.setItemMeta(meta1);
- plugin.inv.setItem(2, item1);
- ItemStack item2 = new ItemStack(Material.EMERALD);
- ItemMeta meta2 = item2.getItemMeta();
- meta2.setDisplayName(ChatColor.GREEN + "Gamemodes");
- ArrayList<String> lore2 = new ArrayList<String>();
- lore2.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "Things for the Gamemodes");
- meta2.setLore(lore2);
- meta2.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
- item2.setItemMeta(meta2);
- plugin.inv.setItem(4, item2);
- ItemStack item4 = new ItemStack(Material.BEDROCK);
- ItemMeta meta4 = item4.getItemMeta();
- meta4.setDisplayName(ChatColor.RED + "Particle");
- ArrayList<String> lore4 = new ArrayList<String>();
- lore4.add("->" + ChatColor.ITALIC + ChatColor.DARK_PURPLE + "COMMING SOON");
- meta4.setLore(lore4);
- meta4.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
- item4.setItemMeta(meta4);
- plugin.inv.setItem(6, item4);
- ItemStack item3 = new ItemStack(Material.BARRIER);
- ItemMeta meta3 = item3.getItemMeta();
- meta3.setDisplayName(ChatColor.LIGHT_PURPLE + "Close");
- meta3.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, false);
- item3.setItemMeta(meta3);
- plugin.inv.setItem(8, item3);
- p.openInventory(plugin.inv);
- }
- }
- if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
- if(e.getMaterial().equals(Material.SLIME_BALL)){
- for(Player players : Bukkit.getOnlinePlayers()){
- if(!h.contains(p.getName())){
- h.add(p.getName());
- p.hidePlayer(players);
- p.sendMessage(ChatColor.DARK_AQUA + "All Players are now " + ChatColor.RED + "hidden");
- ItemStack i = new ItemStack(Material.MAGMA_CREAM);
- ItemMeta im = i.getItemMeta();
- im.setDisplayName(ChatColor.GOLD + "Make all Player Visible");
- im.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, true);
- i.setItemMeta(im);
- p.getPlayer().getInventory().setItem(8, i);
- }
- }
- }
- if(e.getMaterial().equals(Material.MAGMA_CREAM)){
- for(Player players : Bukkit.getOnlinePlayers()){
- if(h.contains(p.getName())){
- h.remove(p.getName());
- p.showPlayer(players);
- p.sendMessage(ChatColor.DARK_AQUA + "All Players are now " + ChatColor.GREEN + "visible");
- ItemStack i = new ItemStack(Material.SLIME_BALL);
- ItemMeta im = i.getItemMeta();
- im.setDisplayName(ChatColor.GREEN + "Hide all Players");
- im.addEnchant(Enchantment.DAMAGE_UNDEAD, 2, true);
- i.setItemMeta(im);
- p.getPlayer().getInventory().setItem(8, i);
- }
- }
- }
- }
- if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
- if(e.getMaterial().equals(Material.BLAZE_POWDER)){
- TornadoEffect effect = new TornadoEffect(napsmain.em);
- effect.getLocation();
- effect.start();
- }
- }
- if(e.getAction() == Action.RIGHT_CLICK_AIR | e.getAction() == Action.RIGHT_CLICK_BLOCK){
- if(e.getMaterial().equals(Material.STICK)){
- this.plugin.getInventory(p);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment