Fix some stuff

This commit is contained in:
kaenganxt
2014-10-25 19:49:04 +02:00
parent fa79378935
commit 0cda1722ca
2 changed files with 6 additions and 1 deletions

View File

@@ -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");

View File

@@ -43,6 +43,7 @@ public class Inventories implements Listener {
private static final HashMap<String, HashMap<String, ItemStack>> items = new HashMap<>();
private static final HashMap<String, Entry<Action, Object>> itemActions = new HashMap<>();
private static final HashMap<String, Integer> itemPositions = new HashMap<>();
public static final HashMap<Player, Boolean> checkInteracts = new HashMap<>();
public static void registerInventory(String type, String name, ChatColor nameColor) {
HashMap<String, Inventory> 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();