Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.mm98.PlayKits;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.inventory.InventoryClickEvent;
- public class InvListener
- implements Listener
- {
- @EventHandler
- public void onKlick(InventoryClickEvent e)
- {
- if (ChatColor.stripColor(e.getInventory().getTitle()).equalsIgnoreCase("PlayKits.eu"))
- {
- Player p = (Player)e.getWhoClicked();
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (PlayKits.getInstance().getConfig().contains("kits." + ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()).toLowerCase()))) {
- Bukkit.dispatchCommand((CommandSender)e.getWhoClicked(), "kit " + ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()));
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§7§lPAGE 2"))) {
- new KitInventory(e.getWhoClicked().getName(), 2);
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§7§lPAGE 1"))) {
- new KitInventory(e.getWhoClicked().getName(), 1);
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName().toLowerCase()).equals("all kits"))) {
- new AllKitsInventory(p.getName(), 1);
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() == Material.THIN_GLASS)) {
- e.setCancelled(true);
- }
- e.setCancelled(true);
- }
- if (ChatColor.stripColor(e.getInventory().getTitle()).equalsIgnoreCase("all kits"))
- {
- Player p = (Player)e.getWhoClicked();
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (PlayKits.getInstance().getConfig().contains("kits." + ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()).toLowerCase()))) {
- Bukkit.dispatchCommand((CommandSender)e.getWhoClicked(), "kit " + ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()));
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() != Material.AIR) && (e.getCurrentItem().getItemMeta().getDisplayName() != null) && (ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName().toLowerCase()).equals("back"))) {
- new KitInventory(p.getName(), 1);
- }
- if ((e.getCurrentItem() != null) && (e.getCursor().getType() != null) && (e.getCurrentItem().getType() == Material.THIN_GLASS)) {
- e.setCancelled(true);
- }
- e.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement