@EventHandler private void onPlayerPickupItem(PlayerPickupItemEvent event) { if (event.getItem().getItemStack() != null && event.getItem().getItemStack().getItemMeta() != null && event.getItem().getItemStack().getItemMeta().getDisplayName() != null) { if (this.alive && event.getItem().getItemStack().getItemMeta().getDisplayName().equals(this.uuid.toString())) { event.setCancelled(true); HandlerList.unregisterAll(this); this.remove(true); this.parent.onPickup(event.getPlayer()); } } }
@EventHandler public void onClose( InventoryCloseEvent event ) { if ( event.getInventory().equals( gui.getInventory() ) ) { gui.getEvents().forEach( e -> e.onClose( new ContainerCloseEvent( gui, event.getPlayer() ) ) ); HandlerList.unregisterAll(this); gui.setNativeListenerRegistered(false); } }
/** * Clear the list and stop listening for events. This map should not be used after this method is called. */ public void disable() { if(this.enabled) { this.clear(); HandlerList.unregisterAll(this); } }
private void doComplete() { countDown--; if (countDown == -1) { bar.setProgress(1.0); if (yes > no) { bar.setTitle(ChatColor.GREEN + "Vote passed!"); bar.setColor(BarColor.GREEN); updateAll(voters, Messages.votePassed()); world.setTime(0); if (world.hasStorm()) world.setStorm(false); } else { bar.setTitle(ChatColor.DARK_RED + "Vote failed!"); bar.setColor(BarColor.RED); updateAll(voters, Messages.voteFailed()); } plugin.getServer().getScheduler().runTaskLater(plugin, this, 20); } if (countDown == -2) plugin.getServer().getScheduler().runTaskLater(plugin, this, 20); if (countDown == -3) { HandlerList.unregisterAll(this); bar.removeAll(); bar = null; voters = null; } }
/** * load / reload a new instance of EntityProtectionListener and register it */ public void loadEntityProtectionListener() { if (entityProtectionListener != null) { HandlerList.unregisterAll(entityProtectionListener); } entityProtectionListener = new EntityProtectionListener(); manager.registerEvents(entityProtectionListener, this); }
/** * load / reload a new instance of PlayerListener and register it */ public void loadPlayerListener() { if (playerListener != null) { HandlerList.unregisterAll(playerListener); } playerListener = new PlayerListener(this); manager.registerEvents(playerListener, this); }
@EventHandler public void onClose(InventoryCloseEvent event) { if(gui == null || gui.getPlayer() == null || !event.getPlayer().getUniqueId().equals(gui.getPlayer().getUniqueId())) return; globalEvents.forEach(e -> e.onClose(new ContainerCloseEvent(gui, event.getPlayer()))); if (event.getInventory().equals(gui.getInventory())) { gui.getEvents().forEach(e -> e.onClose(new ContainerCloseEvent(gui, event.getPlayer()))); HandlerList.unregisterAll(this); gui.setNativeListenerRegistered(false); } }
public static HandlerList getHandlerList() { return handlers; }
public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return HANDLERS; }
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlerList; }
@Override public HandlerList getHandlers() { return handlerList; }
@Override public void onDisable() { HandlerList.unregisterAll(this); }
@Override public final HandlerList getHandlers() { return handlers; }
public static HandlerList getHanlerList() { return handlers; }
@Override public HandlerList getHandlers() { return FireGunEvent.handlers; }
public static HandlerList getHandlerList() { return EntrantRegisterEvent.handlers; }
public static HandlerList getHandlerList() { return handler; }