mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Added a listener
This commit is contained in:
parent
f555f194e1
commit
4e552b870d
@ -1292,15 +1292,15 @@ public class PlotMain extends JavaPlugin {
|
||||
return plots;
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||
PlotMain.plots = plots;
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||
PlotMain.plots = new LinkedHashMap<>(plots);
|
||||
// PlotMain.plots.putAll(plots);
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> 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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user