本文整理汇总了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;
}