Java 类org.bukkit.event.entity.ItemDespawnEvent 实例源码

项目:TCMinigames    文件:EntityListener.java   
@EventHandler
public void itemKillEvent(ItemDespawnEvent event){
    if(Minigame.getCurrentMinigame()!=null){
        switch(Minigame.getCurrentMinigame().getMap().getType()){
        case CIRCLE_OF_BOOM:
            if(Minigame.getCurrentMinigame().getState().equals(MatchState.STARTED)){
                event.setCancelled(true);
            }
            break;
        case KEY_QUEST:
            break;
        case WATER_THE_MONUMENT:
            break;
        default:
            break;
        }
    }
}
项目:CloudNet    文件:ArmorStandListener.java   
@EventHandler
public void handle(ItemDespawnEvent e)
{
    MobSelector.MobImpl mob = CollectionWrapper.filter(MobSelector.getInstance().getMobs().values(), new Acceptable<MobSelector.MobImpl>() {
        @Override
        public boolean isAccepted(MobSelector.MobImpl value)
        {
            return ((Entity) value.getDisplayMessage()).getPassenger() != null && e.getEntity().getEntityId() == ((Entity) value.getDisplayMessage()).getPassenger().getEntityId();
        }
    });
    if (mob != null)
    {
        e.setCancelled(true);
    }
}
项目:ZentrelaRPG    文件:DropManager.java   
@EventHandler
public void onItemDespawn(ItemDespawnEvent event) {
    if (event.getEntity().hasMetadata(RMetadata.META_NO_PICKUP)) {
        event.setCancelled(true);
        return;
    }
    removeLabel(event.getEntity());
}
项目:MystiCraft    文件:CraftingManager.java   
@EventHandler
public void onDespawn(ItemDespawnEvent event) {
    for (Entry<Block, CraftingOperation> entry : operations.entrySet()) {
        CraftingOperation op = entry.getValue();
        for (Item item : op.getItemEntities()) {
            if (item == event.getEntity()) {
                op.clear(true);
                operations.remove(entry.getKey());
                return;
            }
        }
    }
}
项目:BlockBall    文件:GameListener.java   
@EventHandler
public void onItemDespawnEvent(ItemDespawnEvent event) {
    for (final Game game : this.controller.games) {
        if (game.getArena().isLocationInArea(event.getLocation()))
            game.getArena().getBoostItemHandler().removeItem(event.getEntity());
    }
}
项目:NyaaUtils    文件:DropProtectListener.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onItemDespawn(ItemDespawnEvent e) {
    if (plugin.cfg.dropProtectMode == DropProtectMode.OFF) return;
    Item ent = e.getEntity();
    if (items.getIfPresent(ent.getEntityId()) != null) {
        e.setCancelled(true);
    }
}
项目:ExilePearl    文件:PlayerListener.java   
/**
 * Prevents a pearl from despawning
 * @param e The event args
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onItemDespawn(ItemDespawnEvent e) {
    ExilePearl pearl = pearlApi.getPearlFromItemStack(e.getEntity().getItemStack());
    if (pearl != null) {
        e.setCancelled(true);
        pearlApi.log("Prevented pearl from despawning at %s for player %s.", pearl.getLocation().toString(), pearl.getPlayerName());
    }
}
项目:COD-Warfare    文件:Listeners.java   
@EventHandler
public void onItemDespawn(ItemDespawnEvent e) {
    if (e.getEntity().hasMetadata("codnodespawn")) e.setCancelled(true);
    if (e.getEntity().hasMetadata("codredflag")) e.setCancelled(true);
    if (e.getEntity().hasMetadata("codblueflag")) e.setCancelled(true);
    if (e.getEntity().hasMetadata("codRedTag")) e.setCancelled(true);
    if (e.getEntity().hasMetadata("codBlueTag")) e.setCancelled(true);
}
项目:civcraft    文件:BonusGoodieManager.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onItemDespawn(ItemDespawnEvent event) {
    BonusGoodie goodie = CivGlobal.getBonusGoodie(event.getEntity().getItemStack());
    if (goodie == null) {
        return;
    }

    goodie.replenish(event.getEntity().getItemStack(), event.getEntity(), null, null);  
}
项目:DDCustomPlugin    文件:DirectionBook.java   
public void onDropsDespawn(ItemDespawnEvent event) {
    Entity item = event.getEntity();
    if (item.equals(droppedBook) || item.equals(droppedShovel) || item.equals(droppedStick)) {
        event.setCancelled(true);
        log("Renewing item");
    }
}
项目:NucleusFramework    文件:BukkitListener.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private void onItemDespawn(ItemDespawnEvent event) {

    final FloatingItem item = _floatingItems.get(event.getEntity().getUniqueId());
    if (item == null)
        return;

    if (item.isSpawned())
        event.setCancelled(true);
}
项目:xEssentials-deprecated-bukkit    文件:BackpackDespawningEvent.java   
@EventHandler
public void onItemDespawn(ItemDespawnEvent e) {
    if(pl.getManagers().getBackPackManager().isBackpack(e.getEntity().getItemStack())) {
        Backpack pack = pl.getManagers().getBackPackManager().getBackpackByItem(e.getEntity().getItemStack());
        pack.remove();
    }
}
项目:NBTEditor    文件:CustomItemListener.java   
@EventHandler
private void itemDespawnItem(ItemDespawnEvent event) {
    CustomItem customItem = CustomItemManager.getCustomItem(event.getEntity().getItemStack());
    if (verifyCustomItem(customItem, event.getEntity().getWorld())) {
        customItem.onDespawn(event);
    }
}
项目:Kineticraft    文件:ShearFinder.java   
public ShearFinder() {
    super(ItemDespawnEvent.getHandlerList());
}
项目:Kineticraft    文件:ShearFinder.java   
@EventHandler(ignoreCancelled = true) // Prevent Barley's shears from despawning.
public void onItemDespawn(ItemDespawnEvent evt) {
    evt.setCancelled(evt.getEntity().getItemStack().getType() == Material.SHEARS && isPuzzle(evt.getEntity()));
}
项目:GamePlate    文件:DeathDropModule.java   
@EventHandler
public void onItemDespawn(ItemDespawnEvent event) {
    if (bones.containsKey(event.getEntity())) {
        this.bones.remove(event.getEntity());
    }
}
项目:NPCs    文件:PersistenceHandler.java   
@EventHandler
public void onEntityDamage(ItemDespawnEvent event) {
  if (event.getEntity().hasMetadata(this.invulnerable)) {
    event.setCancelled(true);
  }
}
项目:PopulationDensity    文件:EntityEventHandler.java   
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true)
public void onItemDespawn(ItemDespawnEvent event) {
    //respect config option
    if (!ConfigData.regrowTrees)
        return;

    //only care about dropped items
    Entity entity = event.getEntity();
    if (entity.getType() != EntityType.DROPPED_ITEM)
        return;

    if (!(entity instanceof Item))
        return;

    //get info about the dropped item
    ItemStack item = ((Item) entity).getItemStack();

    //only care about saplings
    if (item.getType() != Material.SAPLING)
        return;

    //only care about the newest region
    if (!Region.getOpenRegion().equals(Region.fromLocation(entity.getLocation())))
        return;

    //only replace these blocks with saplings
    Block block = entity.getLocation().getBlock();
    if (block.getType() != Material.AIR && block.getType() != Material.LONG_GRASS && block.getType() != Material.SNOW)
        return;

    //don't plant saplings next to other saplings or logs
    Block[] neighbors = new Block[]{
            block.getRelative(BlockFace.EAST),
            block.getRelative(BlockFace.WEST),
            block.getRelative(BlockFace.NORTH),
            block.getRelative(BlockFace.SOUTH),
            block.getRelative(BlockFace.NORTH_EAST),
            block.getRelative(BlockFace.SOUTH_EAST),
            block.getRelative(BlockFace.SOUTH_WEST),
            block.getRelative(BlockFace.NORTH_WEST)};

    for (Block b : neighbors) {
        if (b.getType() == Material.SAPLING || b.getType() == Material.LOG)
            return;
    }

    //only plant trees in grass or dirt
    Block underBlock = block.getRelative(BlockFace.DOWN);
    if (underBlock.getType() == Material.GRASS || underBlock.getType() == Material.DIRT)
        block.setTypeIdAndData(item.getTypeId(), item.getData().getData(), false);
}
项目:DDCustomPlugin    文件:CustomPlugin.java   
@EventHandler
public void onItemDespawn(ItemDespawnEvent event) {
    if (directionBook != null)
        directionBook.onDropsDespawn(event);
}
项目:NBTEditor    文件:KingsCrown.java   
@Override
public void onDespawn(ItemDespawnEvent event) {
    if (shouldBroadcastMessage()) {
        UtilsMc.broadcastToWorld(event.getEntity().getWorld(), MessageFormat.format("The {0}§f has been lost forever!", getName()));
    }
}
项目:WowSuchCleaner    文件:PassiveCleaningItemListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void handlePassiveCleaning(ItemDespawnEvent e)
{

    auctionDataManager.addLot(e.getEntity());

}
项目:NBTEditor    文件:CustomItem.java   
public void onDespawn(ItemDespawnEvent event) { }