Java Code Examples for org.bukkit.event.HandlerList

The following are top voted examples for showing how to use org.bukkit.event.HandlerList. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: SamaGamesAPI   File: ActivePowerup.java   Source Code and License 6 votes vote down vote up
@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());
        }
    }
}
 
Example 2
Project: InventoryAPI   File: GuiAnvilListener.java   Source Code and License 5 votes vote down vote up
@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);
    }
}
 
Example 3
Project: ProjectAres   File: ListeningMapAdapter.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 4
Project: SkipNight   File: Vote.java   Source Code and License 5 votes vote down vote up
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;
    }
}
 
Example 5
Project: FactionsXL   File: FactionsXL.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 6
Project: FactionsXL   File: FactionsXL.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Project: InventoryAPI   File: McGuiListener.java   Source Code and License 5 votes vote down vote up
@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);
    }
}
 
Example 8
Project: Arcadia-Spigot   File: GameStateUpdateEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handlers;
}
 
Example 9
Project: VanillaPlus   File: VPPLoginEvent.java   Source Code and License 4 votes vote down vote up
public HandlerList getHandlers() {
    return handlers;
}
 
Example 10
Project: OpenRPG   File: RegionEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return HANDLERS;
}
 
Example 11
Project: KingdomFactions   File: ChannelPasswordSetEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
	return handlers;
}
 
Example 12
Project: KingdomFactions   File: ChannelEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
	return handlers;
}
 
Example 13
Project: mczone   File: SignClickEvent.java   Source Code and License 4 votes vote down vote up
public HandlerList getHandlers() {
    return handlers;
}
 
Example 14
Project: skript-mirror   File: CustomExpression.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
  return handlers;
}
 
Example 15
Project: PetBlocks   File: SpigotEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handlers;
}
 
Example 16
Project: EchoPet   File: PetTeleportEvent.java   Source Code and License 4 votes vote down vote up
@Override
  public HandlerList getHandlers() {
return handlers;
  }
 
Example 17
Project: HCFCore   File: PvpClassEquipEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
    return handlers;
}
 
Example 18
Project: bskyblock   File: IslandBaseEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
    return handlers;
}
 
Example 19
Project: CloudNet   File: BukkitPlayerLoginNetworkEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList()
{
    return handlerList;
}
 
Example 20
Project: CloudNet   File: BukkitServerAddEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers()
{
    return handlerList;
}
 
Example 21
Project: HCFCore   File: LoggerRemovedEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList()
{
    return handlers;
}
 
Example 22
Project: OpenUHC   File: BaldChickens.java   Source Code and License 4 votes vote down vote up
@Override
public void onDisable() {
  HandlerList.unregisterAll(this);
}
 
Example 23
Project: AlphaLibary   File: GameStatusChangeEvent.java   Source Code and License 4 votes vote down vote up
@Override
public final HandlerList getHandlers() {
    return handlers;
}
 
Example 24
Project: McLink   File: McLinkInitEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
	return handlers;
}
 
Example 25
Project: KingdomFactions   File: ChannelLeaveEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHanlerList() {
	return handlers;
}
 
Example 26
Project: OpenRPG   File: LevelEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return HANDLERS;
}
 
Example 27
Project: EchoPet   File: EchoPetSendMessageEvent.java   Source Code and License 4 votes vote down vote up
@Override
  public HandlerList getHandlers() {
return handlers;
  }
 
Example 28
Project: AddGun   File: FireGunEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
	return FireGunEvent.handlers;
}
 
Example 29
Project: ProjectAres   File: GoalTouchEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handlers;
}
 
Example 30
Project: CloudNet   File: BukkitProxyAddEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers()
{
    return handlerList;
}
 
Example 31
Project: CloudNet   File: BukkitProxyAddEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList()
{
    return handlerList;
}
 
Example 32
Project: ProjectAres   File: ConfigLoadEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handlers;
}
 
Example 33
Project: ProjectAres   File: EntrantRegisterEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return EntrantRegisterEvent.handlers;
}
 
Example 34
Project: KillerPoint-Reloaded   File: PointChangedEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() 
{
    return handlers;
}
 
Example 35
Project: CloudNet   File: BukkitProxyInfoUpdateEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers()
{
    return handlerList;
}
 
Example 36
Project: HCFCore   File: LoggerRemovedEvent.java   Source Code and License 4 votes vote down vote up
public HandlerList getHandlers()
{
    return handlers;
}
 
Example 37
Project: HCFCore   File: TimerClearEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
    return handlers;
}
 
Example 38
Project: KillRanking   File: PlayerLevelUpEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handler;
}
 
Example 39
Project: ProjectAres   File: CapturingTeamChangeEvent.java   Source Code and License 4 votes vote down vote up
public static HandlerList getHandlerList() {
    return handlers;
}
 
Example 40
Project: HCFCore   File: PlayerJoinedFactionEvent.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerList getHandlers() {
    return handlers;
}