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

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

源代码1 项目: MineTinker   文件: Webbed.java
private void effect(Player player, ItemStack tool, Entity entity, Event event) {
	if (!player.hasPermission("minetinker.modifiers.webbed.use")) {
		return;
	}

	if (entity.isDead()) {
		return;
	}

	if (!modManager.hasMod(tool, this)) {
		return;
	}

	if (modManager.hasMod(tool, Shrouded.instance())) { //Should not trigger twice
		return;
	}

	((LivingEntity) entity).addPotionEffect(getPotionEffect(event, entity, player, tool));
}
 
源代码2 项目: Sentinel   文件: SentinelTargetingHelper.java
/**
 * Updates the current avoids set for the NPC.
 */
public void updateAvoids() {
    for (SentinelCurrentTarget curTarg : new HashSet<>(currentAvoids)) {
        Entity e = SentinelUtilities.getEntityForID(curTarg.targetID);
        if (e == null) {
            currentAvoids.remove(curTarg);
            continue;
        }
        if (e.isDead()) {
            currentAvoids.remove(curTarg);
            continue;
        }
        if (curTarg.ticksLeft > 0) {
            curTarg.ticksLeft -= SentinelPlugin.instance.tickRate;
            if (curTarg.ticksLeft <= 0) {
                currentAvoids.remove(curTarg);
            }
        }
    }
}
 
源代码3 项目: Sentinel   文件: SentinelTargetingHelper.java
/**
 * Returns whether an entity is not able to be targeted at all.
 */
public static boolean isUntargetable(Entity e) {
    if (e == null) {
        return true;
    }
    if (e.isDead()) {
        return true;
    }
    if (e instanceof Player) {
        GameMode mode = ((Player) e).getGameMode();
        if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) {
            return true;
        }
    }
    return false;
}
 
源代码4 项目: Thermos   文件: CraftLivingEntity.java
public boolean setLeashHolder(Entity holder) {
    if ((getHandle() instanceof net.minecraft.entity.boss.EntityWither) || !(getHandle() instanceof net.minecraft.entity.EntityLiving)) {
        return false;
    }

    if (holder == null) {
        return unleash();
    }

    if (holder.isDead()) {
        return false;
    }

    unleash();
    ((net.minecraft.entity.EntityLiving) getHandle()).setLeashedToEntity(((CraftEntity) holder).getHandle(), true);
    return true;
}
 
源代码5 项目: SkyWarsReloaded   文件: MobSpawnEvent.java
@Override
public void endEvent(boolean force) {
	if (fired) {
		if (force) {
			br1.cancel();
			if (length != -1) {
				br2.cancel();
			}
		}
		for (Entity ent: mobsSpawned) {
			if (ent != null && !ent.isDead()) {
				ent.remove();
			}
		}
		mobsSpawned.clear();
		if (gMap.getMatchState() == MatchState.PLAYING) {
			MatchManager.get().message(gMap, ChatColor.translateAlternateColorCodes('&', endMessage));
		}
		if (repeatable || force) {
			setStartTime();
			this.startTime = this.startTime + gMap.getTimer();
			this.fired = false;
		}
	}
}
 
源代码6 项目: IridiumSkyblock   文件: EntitySpawnListener.java
public void monitorEntity(Entity entity) {
    if (entity == null) return;
    if (entity.isDead()) return;

    final UUID uuid = entity.getUniqueId();
    final Island startingIsland = IridiumSkyblock.getInstance().entities.get(uuid);
    if (startingIsland.isInIsland(entity.getLocation())) {
        //The entity is still in the island, so make a scheduler to check again
        Bukkit.getScheduler().scheduleSyncDelayedTask(IridiumSkyblock.getInstance(), () -> monitorEntity(entity), 20);
    } else {
        //The entity is not in the island, so remove it
        entity.remove();
        IridiumSkyblock.getInstance().entities.remove(uuid);
    }
}
 
源代码7 项目: GriefDefender   文件: GDClaim.java
public List<Entity> getEntities() {
    Collection<Entity> worldEntityList = Bukkit.getServer().getWorld(this.world.getUID()).getEntities();
    List<Entity> entityList = new ArrayList<>();
    for (Entity entity : worldEntityList) {
        if (!(entity.isDead() && this.contains(VecHelper.toVector3i(entity.getLocation())))) {
            entityList.add(entity);
        }
    }

    return entityList;
}
 
源代码8 项目: StackMob-3   文件: StackLogic.java
@Override
public boolean notSuitableForStacking(Entity entity){
    if(!(StackTools.hasValidStackData(entity))){
        return true;
    }
    if(entity.isDead()){
        return true;
    }
    if(StackTools.hasValidMetadata(entity, GlobalValues.NO_STACK) &&
            entity.getMetadata(GlobalValues.NO_STACK).get(0).asBoolean()){
        return true;
    }
    int stackSize = StackTools.getSize(entity);
    return (getMaxSize(entity) == stackSize);
}
 
源代码9 项目: HolographicDisplays   文件: MainListener.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onChunkUnload(ChunkUnloadEvent event) {
	for (Entity entity : event.getChunk().getEntities()) {
		if (!entity.isDead()) {
			NMSEntityBase entityBase = nmsManager.getNMSEntityBase(entity);
			
			if (entityBase != null) {
				((CraftHologram) entityBase.getHologramLine().getParent()).despawnEntities();
			}
		}
	}
}
 
源代码10 项目: NBTEditor   文件: BatBomb.java
@Override
public void onExplode(Item item, Location location) {
	List<Entity> passengers = item.getPassengers();
	if (passengers.size() != 0) {
		Entity bat = passengers.get(0);
		if (bat != null && bat instanceof Bat && !bat.isDead()) {
			bat.remove();
			spawnBatsAt(location, 10, 50);
		}
	}
}
 
源代码11 项目: Skript   文件: CondIsAlive.java
@Override
public boolean check(Entity e) {
	return isNegated == e.isDead();
}