本文整理汇总了Java中net.citizensnpcs.api.npc.NPC.isSpawned方法的典型用法代码示例。如果您正苦于以下问题:Java NPC.isSpawned方法的具体用法?Java NPC.isSpawned怎么用?Java NPC.isSpawned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.citizensnpcs.api.npc.NPC
的用法示例。
在下文中一共展示了NPC.isSpawned方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import net.citizensnpcs.api.npc.NPC; //导入方法依赖的package包/类
@Override
public void run(String playerID) throws QuestRuntimeException {
// this event should not run if the player is offline
if (PlayerConverter.getPlayer(playerID) == null) {
currentPlayer = null;
return;
}
NPC npc = CitizensAPI.getNPCRegistry().getById(id);
if (npc == null) {
BetonQuest.getInstance().getLogger().warning("NPC with ID " + id + " does not exist");
return;
}
if (!npc.isSpawned()) {
return;
}
if (currentPlayer == null) {
npc.getNavigator().setTarget(loc.getLocation(playerID));
currentPlayer = playerID;
movingNPCs.add(npc);
Bukkit.getPluginManager().registerEvents(ths, BetonQuest.getInstance());
} else {
for (EventID event : failEvents) {
BetonQuest.event(playerID, event);
}
}
}
示例2: applyVisibility
import net.citizensnpcs.api.npc.NPC; //导入方法依赖的package包/类
/**
* Updates the visibility of the specified NPC for this player.
*
* @param player the player
* @param npcID ID of the NPC
*/
public void applyVisibility(Player player, Integer npcID) {
boolean hidden = true;
Set<ConditionID> conditions = npcs.get(npcID);
if (conditions == null || conditions.isEmpty()) {
hidden = false;
} else {
for (ConditionID condition : conditions) {
if (!BetonQuest.condition(PlayerConverter.getID(player), condition)) {
hidden = false;
break;
}
}
}
NPC npc = CitizensAPI.getNPCRegistry().getById(npcID);
if (npc.isSpawned()) {
if (hidden) {
hider.hideEntity(player, npc.getEntity());
} else {
hider.showEntity(player, npc.getEntity());
}
}
}
示例3: execute
import net.citizensnpcs.api.npc.NPC; //导入方法依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC respawn = registry.getById(id.getSingle(evt).intValue());
if (respawn.isSpawned() == true) {
Skript.warning("This NPC is still alive!");
} else {
respawn.spawn(location.getSingle(evt));
}
}
示例4: activateEffects
import net.citizensnpcs.api.npc.NPC; //导入方法依赖的package包/类
private void activateEffects() {
// display effects for all players
for (Player player : Bukkit.getOnlinePlayers()) {
// get NPC-effect assignments for this player
Map<Integer, Effect> assignments = players.get(player.getUniqueId());
// skip if there are no assignments for this player
if (assignments == null) {
continue;
}
// display effects on all NPCs
for (Entry<Integer, Effect> entry : assignments.entrySet()) {
Integer id = entry.getKey();
Effect effect = entry.getValue();
// skip this effect if it's not its time
if (tick % effect.interval != 0) {
continue;
}
// get the NPC from its ID
NPC npc = CitizensAPI.getNPCRegistry().getById(id);
// skip if there are no such NPC or it's not spawned or not visible
if (npc == null || !npc.isSpawned() ||
(NPCHider.getInstance() != null && NPCHider.getInstance().isInvisible(player, npc))) {
continue;
}
// prepare effect location
Location loc = npc.getStoredLocation().clone();
loc.setPitch(-90);
// fire the effect
EffectLibIntegrator.getEffectManager().start(
effect.name,
effect.settings,
new DynamicLocation(loc, null),
new DynamicLocation(null, null),
null,
player);
}
}
}