org.bukkit.entity.Entity#getEntityId ( )源码实例Demo

下面列出了org.bukkit.entity.Entity#getEntityId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Remove the given entity from the underlying map.
 *
 * @param entity - the entity to remove.
 */
private void removeEntity(final Entity entity)
{
    final int entityID = entity.getEntityId();

    for (final Map<Integer, Boolean> maps : observerEntityMap.rowMap().values()) {
        maps.remove(entityID);
    }
}
 
源代码2 项目: BetonQuest   文件: EntityHider.java
/**
 * Remove the given entity from the underlying map.
 *
 * @param entity    - the entity to remove.
 * @param destroyed - TRUE if the entity was killed, FALSE if it is merely unloading.
 */
protected void removeEntity(Entity entity, boolean destroyed) {
    int entityID = entity.getEntityId();

    List<Map.Entry<Integer, Map<Integer, Boolean>>> list = new CopyOnWriteArrayList<>(observerEntityMap.rowMap().entrySet());
    Iterator<Map.Entry<Integer, Map<Integer, Boolean>>> iterator = list.iterator();

    while (iterator.hasNext()) {
        iterator.next().getValue().remove(entityID);
    }
}
 
源代码3 项目: ce   文件: Shuffle.java
@Override
public void effect(Event e, ItemStack item, final int level) {
	if(e instanceof EntityDamageByEntityEvent) {
	EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
	Entity target = event.getEntity();
	Player p = (Player) ((Projectile) event.getDamager()).getShooter();
	
	if(target.getEntityId() == p.getEntityId())
		return;
	
	Location pLoc = p.getLocation();
	Location tLoc = target.getLocation();
	
	target.teleport(pLoc);
	p.teleport(tLoc);
	
	EffectManager.playSound(tLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f);
	EffectManager.playSound(pLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f);

	
	for(int i = 10; i>0; i--) {
		p.getWorld().playEffect(tLoc, Effect.ENDER_SIGNAL, 10);
		p.getWorld().playEffect(pLoc, Effect.ENDER_SIGNAL, 10);
	}
	
	if(target instanceof Player) {
		p.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + target.getName() + "!");
		target.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + p.getName() + "!");
	}
	
	
	}
}
 
源代码4 项目: Shopkeepers   文件: LivingEntityShop.java
public static String getId(Entity entity) {
	if (entity != null) {
		return "entity" + entity.getEntityId();
	}
	return null;
}