diff --git a/src/de/anura/core/AnuraCore.java b/src/de/anura/core/AnuraCore.java index 889cd2e..7526bf9 100644 --- a/src/de/anura/core/AnuraCore.java +++ b/src/de/anura/core/AnuraCore.java @@ -173,7 +173,8 @@ public class AnuraCore extends JavaPlugin implements PluginMessageListener { Inventories.buildInvItem("COMPASS", Material.COMPASS, "select_game", ChatColor.DARK_AQUA); Inventories.buildInvItem("SIGN", Material.SIGN, "Change language", ChatColor.DARK_GREEN); Inventories.buildInvItem("PAPER", Material.PAPER, "features_item", ChatColor.BLUE); - Inventories.buildInvItem("DOOR", Material.WOOD_DOOR, "to_spawn", ChatColor.YELLOW); + Inventories.buildInvItem("DOOR", Material.WOOD_DOOR, "to_to_spawn", ChatColor.YELLOW); + Inventories.buildInvItem("EYE", Material.EYE_OF_ENDER, "inv_to_lobby", ChatColor.YELLOW); if (getConfig().getString("server-name").equals("lobby")) { Inventories.setItemInPlayerInv("COMPASS", 0); Inventories.setItemInPlayerInv("SIGN", 1); @@ -184,6 +185,7 @@ public class AnuraCore extends JavaPlugin implements PluginMessageListener { Inventories.registerItemAction("SIGN", Inventories.Action.OPEN_INV, "LANGUAGE"); Inventories.registerItemAction("PAPER", Inventories.Action.OPEN_INV, "FEATURES"); Inventories.registerItemAction("DOOR", Inventories.Action.COMMAND, "spawn"); + Inventories.registerItemAction("EYE", Inventories.Action.SERVER, "lobby"); this.pots = new FlowerPots(); ResultSet rs = sql.querySelect("SELECT id, X, Y, Z, world, type, waitTime FROM corePots"); diff --git a/src/de/anura/core/Inventories.java b/src/de/anura/core/Inventories.java index b2d8c46..debf9be 100644 --- a/src/de/anura/core/Inventories.java +++ b/src/de/anura/core/Inventories.java @@ -43,6 +43,7 @@ public class Inventories implements Listener { private static final HashMap> items = new HashMap<>(); private static final HashMap> itemActions = new HashMap<>(); private static final HashMap itemPositions = new HashMap<>(); + public static final HashMap checkInteracts = new HashMap<>(); public static void registerInventory(String type, String name, ChatColor nameColor) { HashMap langInvs = new HashMap<>(); @@ -174,6 +175,7 @@ public class Inventories implements Listener { @EventHandler public void onInvClick(InventoryClickEvent event) { + if (checkInteracts.containsKey((Player)event.getWhoClicked()) && !checkInteracts.get((Player)event.getWhoClicked())) return; final Player player = (Player) event.getWhoClicked(); Inventory inventory = event.getClickedInventory(); String invName = inventory.getName(); @@ -204,6 +206,7 @@ public class Inventories implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { + if (checkInteracts.containsKey((Player)event.getPlayer()) && !checkInteracts.get((Player)event.getPlayer())) return; if (event.hasItem()) { if (event.getAction().equals(org.bukkit.event.block.Action.RIGHT_CLICK_AIR) || event.getAction().equals(org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) { final Player P = event.getPlayer();