当前位置: 首页>>代码示例>>Java>>正文


Java PlayerDeathEvent.getDrops方法代码示例

本文整理汇总了Java中org.bukkit.event.entity.PlayerDeathEvent.getDrops方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerDeathEvent.getDrops方法的具体用法?Java PlayerDeathEvent.getDrops怎么用?Java PlayerDeathEvent.getDrops使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.entity.PlayerDeathEvent的用法示例。


在下文中一共展示了PlayerDeathEvent.getDrops方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    World world = player.getWorld();
    Location location = player.getLocation();
    Collection<ItemStack> drops = event.getDrops();
    if (!drops.isEmpty()) {
        Iterator<ItemStack> iterator = drops.iterator();

        // Drop the items manually so we can add meta to prevent
        // PVP Protected players from collecting them.
        long stamp = System.currentTimeMillis() + +ITEM_PICKUP_DELAY;
        while (iterator.hasNext()) {
            itemUUIDPickupDelays.put(world.dropItemNaturally(location, iterator.next()).getUniqueId(), stamp);
            iterator.remove();
        }
    }

    clearCooldown(player);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:21,代码来源:InvincibilityTimer.java

示例2: deathDrop

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void deathDrop(PlayerDeathEvent e) {
    World w = e.getEntity().getWorld();
    Location l = e.getEntity().getLocation();
    EntityItem ei;
    NBTTagCompound nbt;
    NBTTagShort nbts = new NBTTagShort(itemAge);
    for (ItemStack d : e.getDrops()) {
        ei = ((EntityItem)((CraftItem)w.dropItemNaturally(l, d)).getHandle());
        nbt = new NBTTagCompound();
        ei.b(nbt);
        nbt.set("Age", nbts);
        ei.a(nbt);
    }
    e.getDrops().clear();
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:17,代码来源:WorldListener.java

示例3: onPlayerDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerDeath(PlayerDeathEvent event) {
    if (!InventoryManager.playerIsLoaded(event.getEntity())) {
        return;
    }

    List<ItemStack> drops = event.getDrops();
    for (int i = 0; i < drops.size(); i++) {
        ItemStack drop = drops.get(i);
        if (drop != null && (InventoryLocker.isLockedSlot(drop) || InventoryManager.isEmptySlot(drop))) {
            event.getDrops().set(i, new ItemStack(Material.AIR));
        }
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:15,代码来源:LockerListener.java

示例4: onDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler
public void onDeath(PlayerDeathEvent event) {
    event.setDeathMessage(null);

    for (ItemStack i : event.getDrops()) {
        i.setType(Material.AIR);
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:9,代码来源:PlayerListener.java

示例5: onDeath

import org.bukkit.event.entity.PlayerDeathEvent; //导入方法依赖的package包/类
@EventHandler		(priority = EventPriority.HIGH)
public void onDeath(PlayerDeathEvent e){
	final Player player = e.getEntity();
	final Location loc = player.getLocation();
	final GamePlayer target = SkyWarsReloaded.getPC().getPlayer(player.getUniqueId());
	Entity ent = e.getEntity();
	Location spawn = SkyWarsReloaded.getCfg().getSpawn();
	if (spawn != null) {
		String world = spawn.getWorld().getName();
		if(player.getLocation().getWorld().getName().equalsIgnoreCase(world)) {
			List<ItemStack> drops = e.getDrops();
			ListIterator<ItemStack> litr = drops.listIterator();
			while(litr.hasNext()){
	 	            ItemStack item = litr.next();
	     	    if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getKitMenuItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getKitMenuItem().getEnchantments().keySet()))) {
					litr.remove();
	         	} else if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getExitGameItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getExitGameItem().getEnchantments().keySet()))) {
	         		litr.remove();
		     	} else if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getSpectateItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getSpectateItem().getEnchantments().keySet()))) {
		     		litr.remove();
		     	} else if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getJoinItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getJoinItem().getEnchantments().keySet()))) {
		     		litr.remove();
				} else if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getOptionsItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getOptionsItem().getEnchantments().keySet()))) {
					litr.remove();
				} else if ((item.getData().getItemType().equals(SkyWarsReloaded.getCfg().getLobbyMenuItem().getData().getItemType()) &&  item.getEnchantments().keySet().equals(SkyWarsReloaded.getCfg().getLobbyMenuItem().getEnchantments().keySet()))) {
					litr.remove();
				}
	        }
		}
	}

	DamageCause damageCause = DamageCause.CUSTOM;
	if (ent.getLastDamageCause() != null) {
		damageCause = ent.getLastDamageCause().getCause();
	} 
	final DamageCause dCause = damageCause;
	if (target.inGame()) {
		e.setDeathMessage("");
		Game game = target.getGame();
		if (game.getState() == GameState.PLAYING) {
			target.getGame().onPlayerDeath(target, dCause, loc);
		}
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:45,代码来源:PlayerListener.java


注:本文中的org.bukkit.event.entity.PlayerDeathEvent.getDrops方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。