mirror of
https://e.coding.net/circlecloud/MenuProtect.git
synced 2024-11-21 10:48:46 +00:00
修复点击事件...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
db1e3edb4e
commit
dfc198d43a
@ -4,10 +4,16 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.inventory.AnvilInventory;
|
||||||
|
import org.bukkit.inventory.CraftingInventory;
|
||||||
|
import org.bukkit.inventory.DoubleChestInventory;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
@ -30,22 +36,23 @@ public class ProtectListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
* @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
public void onItemClick(final InventoryClickEvent e) {
|
||||||
* public void onItemClick(final InventoryClickEvent e) {
|
final Player p = (Player) e.getWhoClicked();
|
||||||
* final Player p = (Player) e.getWhoClicked();
|
final ItemStack ci = e.getCurrentItem();
|
||||||
* final ItemStack ci = e.getCurrentItem();
|
final Inventory inv = e.getInventory();
|
||||||
* final Inventory inv = e.getInventory();
|
if (inv.getHolder() == null || !(inv instanceof PlayerInventory || inv instanceof CraftingInventory || inv instanceof AnvilInventory || inv instanceof DoubleChestInventory)) {
|
||||||
* final int solt = e.getSlot();
|
return;
|
||||||
* try {
|
}
|
||||||
* if (MarkUtil.hasMark(ci)) {
|
final int solt = e.getSlot();
|
||||||
* inv.setItem(solt, new ItemStack(Material.AIR));
|
try {
|
||||||
* p.closeInventory();
|
if (MarkUtil.hasMark(ci)) {
|
||||||
* }
|
inv.setItem(solt, new ItemStack(Material.AIR));
|
||||||
* } catch (final Exception ex) {
|
p.closeInventory();
|
||||||
* }
|
}
|
||||||
* }
|
} catch (final Exception ex) {
|
||||||
*/
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
|
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user