diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 3a99ddbc0..c8024e3f3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -1292,15 +1292,15 @@ public class PlotMain extends JavaPlugin { return plots; } - public static void setAllPlotsRaw(final LinkedHashMap> plots) { - PlotMain.plots = plots; - } - public static void setAllPlotsRaw(final HashMap> plots) { PlotMain.plots = new LinkedHashMap<>(plots); // PlotMain.plots.putAll(plots); } + public static void setAllPlotsRaw(final LinkedHashMap> plots) { + PlotMain.plots = plots; + } + /** * !!WorldGeneration!! */ @@ -1486,6 +1486,8 @@ public class PlotMain extends JavaPlugin { // Main event handler getServer().getPluginManager().registerEvents(new PlayerEvents(), this); + // Info Inventory + getServer().getPluginManager().registerEvents(new InventoryListener(), this); // Flag runnable PlotPlusListener.startRunnable(this); // Flag+ listener diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java new file mode 100644 index 000000000..7349ffef5 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/InventoryListener.java @@ -0,0 +1,35 @@ +package com.intellectualcrafters.plot.listeners; + +import com.intellectualcrafters.plot.object.InfoInventory; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryInteractEvent; +import org.bukkit.inventory.Inventory; + +/** + * Created 2014-11-18 for PlotSquared + * + * @author Citymonstret + */ +public class InventoryListener implements Listener { + + @EventHandler + public void onInventoryAction(InventoryInteractEvent event) { + if (event.getInventory().getHolder() instanceof InfoInventory) { + event.setResult(Event.Result.DENY); + } + } + + @EventHandler + public void onInventoryClick(InventoryClickEvent event) { + final Inventory inventory = event.getInventory(); + final Player player = (Player) event.getWhoClicked(); + if (inventory.getHolder() instanceof InfoInventory) { + // TODO: Do stuff + } + } + +}