Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Events
- implements Listener
- {
- private AutoLapis plugin;
- private ItemStack lapis;
- public Events(AutoLapis plugin)
- {
- this.plugin = plugin;
- Dye d = new Dye();
- d.setColor(DyeColor.BLUE);
- this.lapis = d.toItemStack();
- this.lapis.setAmount(3);
- }
- @EventHandler
- public void openInventoryEvent(InventoryOpenEvent e)
- {
- if (((e.getInventory() instanceof EnchantingInventory)) && (
- (e.getPlayer().hasPermission("autolapis.autofill")) ||
- (e.getPlayer().isOp()) || (e.getPlayer().hasPermission("*"))))
- {
- e.getInventory().setItem(1, this.lapis);
- this.plugin.inventories.add(
- (EnchantingInventory)e.getInventory());
- }
- }
- @EventHandler
- public void closeInventoryEvent(InventoryCloseEvent e)
- {
- if ((e.getInventory() instanceof EnchantingInventory)) {
- if (this.plugin.inventories.contains((EnchantingInventory)e.getInventory()))
- {
- e.getInventory().setItem(1, null);
- this.plugin.inventories.remove(
- (EnchantingInventory)e.getInventory());
- }
- }
- }
- @EventHandler
- public void inventoryClickEvent(InventoryClickEvent e)
- {
- if ((e.getClickedInventory() instanceof EnchantingInventory)) {
- if ((this.plugin.inventories.contains((EnchantingInventory)e.getInventory())) &&
- (e.getSlot() == 1)) {
- e.setCancelled(true);
- }
- }
- }
- @EventHandler
- public void enchantItemEvent(EnchantItemEvent e)
- {
- if (this.plugin.inventories.contains((EnchantingInventory)e.getInventory())) {
- e.getInventory().setItem(1, this.lapis);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement