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

项目:ProjectAres    文件:RaindropListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void handleItemDespawn(final EntityDespawnInVoidEvent event) {
    Entity entity = event.getEntity();
    if (!(entity instanceof Item)) return;
    ItemStack stack = ((Item) entity).getItemStack();

    PlayerId playerId = this.droppedWools.remove(entity);
    if (playerId == null) return;

    ParticipantState player = PGM.getMatchManager().getParticipantState(playerId);
    if (player == null) return;

    if(isDestroyableWool(stack, player.getParty())) {
        giveWoolDestroyRaindrops(player, ((Wool) stack.getData()).getColor());
    }
}
项目:Cardinal-Plus    文件:Snowflakes.java   
@EventHandler
public void onItemDespawnInVoid(EntityDespawnInVoidEvent event) {
    if (event.getEntity() instanceof Item) {
        for (Player player : items.keySet()) {
            if (player != null && TeamUtils.getTeamByPlayer(player) != null) {
                for (Item item : items.get(player)) {
                    if (item.equals(event.getEntity())) {
                        for (TeamModule team : TeamUtils.getTeams()) {
                            if (!team.isObserver() && TeamUtils.getTeamByPlayer(player) != team) {
                                for (GameObjective obj : TeamUtils.getShownObjectives(team)) {
                                    if (obj instanceof WoolObjective && item.getItemStack().getData().getData() == ((WoolObjective) obj).getColor().getData() && (!destroyed.containsKey(player) || !destroyed.get(player).contains(((WoolObjective) obj).getColor()))) {
                                        if (!destroyed.containsKey(player)) {
                                            destroyed.put(player, new ArrayList<DyeColor>());
                                        }
                                        List<DyeColor> list = destroyed.get(player);
                                        list.add(((WoolObjective) obj).getColor());
                                        destroyed.put(player, list);

                                        Bukkit.getServer().getPluginManager().callEvent(new SnowflakeChangeEvent(player, ChangeReason.DESTROY_WOOL, 8, MiscUtils.convertDyeColorToChatColor(((WoolObjective) obj).getColor()) + ((WoolObjective) obj).getColor().name().toUpperCase().replaceAll("_", " ") + " WOOL" + ChatColor.GRAY));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
项目:CardinalPGM    文件:Snowflakes.java   
@EventHandler
public void onItemDespawnInVoid(EntityDespawnInVoidEvent event) {
    if (!(event.getEntity() instanceof Item) || !event.getEntity().hasMetadata(ITEM_THROWER_META)) return;
    Player player = Bukkit.getPlayer((UUID) event.getEntity().getMetadata(ITEM_THROWER_META).get(0).value());
    Item item = (Item) event.getEntity();
    if (testDestroy(player, item.getItemStack())) {
        addDestroyed(player, ((Wool) item.getItemStack().getData()).getColor());
    }
}
项目:ProjectAres    文件:BlockDropsMatchModule.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockFallInVoid(EntityDespawnInVoidEvent event) {
    if(event.getEntity() instanceof FallingBlock) {
        this.fallingBlocksThatWillNotLand.remove(event.getEntity());
    }
}