本文整理匯總了Java中org.bukkit.event.HandlerList類的典型用法代碼示例。如果您正苦於以下問題:Java HandlerList類的具體用法?Java HandlerList怎麽用?Java HandlerList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HandlerList類屬於org.bukkit.event包,在下文中一共展示了HandlerList類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerPickupItem
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@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());
}
}
}
示例2: onClose
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@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);
}
}
示例3: disable
import org.bukkit.event.HandlerList; //導入依賴的package包/類
/**
* 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);
}
}
示例4: doComplete
import org.bukkit.event.HandlerList; //導入依賴的package包/類
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;
}
}
示例5: loadEntityProtectionListener
import org.bukkit.event.HandlerList; //導入依賴的package包/類
/**
* 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);
}
示例6: loadPlayerListener
import org.bukkit.event.HandlerList; //導入依賴的package包/類
/**
* 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);
}
示例7: onClose
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@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);
}
}
示例8: getHandlerList
import org.bukkit.event.HandlerList; //導入依賴的package包/類
public static HandlerList getHandlerList() {
return handlers;
}
示例9: getHandlers
import org.bukkit.event.HandlerList; //導入依賴的package包/類
public HandlerList getHandlers() {
return handlers;
}
示例10: getHandlerList
import org.bukkit.event.HandlerList; //導入依賴的package包/類
public static HandlerList getHandlerList() {
return HANDLERS;
}
示例11: getHandlerList
import org.bukkit.event.HandlerList; //導入依賴的package包/類
public static HandlerList getHandlerList() {
return handlers;
}
示例12: getHandlers
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@Override
public HandlerList getHandlers() {
return handlers;
}
示例13: getHandlerList
import org.bukkit.event.HandlerList; //導入依賴的package包/類
public static HandlerList getHandlerList() {
return handlers;
}
示例14: getHandlers
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@Override
public HandlerList getHandlers() {
return handlers;
}
示例15: getHandlers
import org.bukkit.event.HandlerList; //導入依賴的package包/類
@Override
public HandlerList getHandlers() {
return handlers;
}