本文整理汇总了Java中net.citizensnpcs.api.CitizensAPI类的典型用法代码示例。如果您正苦于以下问题:Java CitizensAPI类的具体用法?Java CitizensAPI怎么用?Java CitizensAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CitizensAPI类属于net.citizensnpcs.api包,在下文中一共展示了CitizensAPI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findTellers
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
public List<NPC> findTellers() {
List<NPC> tellers = new ArrayList<>();
for(Chunk c : chunks) {
Entity[] entities = c.getEntities();
for(Entity e : entities) {
//We don't care about entities that are not within the bank area, and that aren't human.
if(!bankArea.contains(e.getLocation().getBlock()) || !(e instanceof HumanEntity)) continue;
if(CitizensAPI.getNPCRegistry().isNPC(e)) {
NPC n = CitizensAPI.getNPCRegistry().getNPC(e);
if(n != null) tellers.add(n);
}
}
}
return tellers;
}
开发者ID:GoldRushMC,项目名称:GoldRushPlugin,代码行数:17,代码来源:Bank.java
示例2: reset
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
private void reset() {
scriptingManager.reset();
scriptEventManager.reset();
entityEventManager.reset();
inventoryEventManager.reset();
CitizensAPI.getNPCRegistry().forEach((npc) -> npc.despawn(DespawnReason.PLUGIN));
commandManager.removeAll();
timerManager.removeAll();
dialogs.reset();
trackingShots.reset();
abilities.reset();
weakPlayerMaps.reset();
try {
storage.getStorage().reload();
} catch (StorageException e) {
getLogger().log(Level.SEVERE, "Reloading the storage failed", e);
}
}
开发者ID:leMaik,项目名称:RpgPlus,代码行数:19,代码来源:RpgPlus.java
示例3: onNpcKill
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@EventHandler
public void onNpcKill(MobKilledEvent event) {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
if (npc == null) {
return;
}
if (npc.getId() != ID) {
return;
}
String playerID = PlayerConverter.getID(event.getPlayer());
NPCData playerData = (NPCData) dataMap.get(playerID);
if (containsPlayer(playerID) && checkConditions(playerID)) {
playerData.kill();
if (playerData.killed()) {
completeObjective(playerID);
}
}
}
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:19,代码来源:NPCKillObjective.java
示例4: run
import net.citizensnpcs.api.CitizensAPI; //导入依赖的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);
}
}
}
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:27,代码来源:NPCMoveEvent.java
示例5: applyVisibility
import net.citizensnpcs.api.CitizensAPI; //导入依赖的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());
}
}
}
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:31,代码来源:NPCHider.java
示例6: createWorkers
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
protected void createWorkers() {
for (Chunk c : this.chunks) {
Entity[] entities = c.getEntities();
for (Entity e : entities) {
if (this.trainArea.contains(e.getLocation().getBlock())) {
//See if the Entity is convertable to an NPC.
if (CitizensAPI.getNPCRegistry().isNPC(e)) {
//We only want NPC Humans to be converted and used... We don't want cows and chickens...
if (e instanceof HumanEntity) {
//Convert it!!!
this.workers.add(CitizensAPI.getNPCRegistry().getNPC(e));
}
}
}
}
}
}
开发者ID:GoldRushMC,项目名称:GoldRushPlugin,代码行数:20,代码来源:HybridTrainStation.java
示例7: createMount
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
/**
* Create a mount for the jockey
* @param mountName
* @param spawn
*/
private void createMount(String mountName, Location spawn, boolean enabled) {
if (this.mountType.hasBukkitMapping()) {
// Make their mounts
this.mount = CitizensAPI.getNPCRegistry().createNPC(this.mountType.getBukkitMapping(), mountName == null ? "Error" : mountName);
this.mount.setProtected(true);
this.mount.addTrait(NmsHandler.getNmsHandler().newMount(true));
this.mount.spawn(spawn);
this.race.getCourse().getMountData().applyMountData(this.mount.getEntity());
// Set the owner of the mount to the jockey
Owner owner = this.mount.getTrait(Owner.class);
owner.setOwner(this.player.getName());
// Make the NPC controllable and mount the player
Mount trait = this.mount.getTrait(NmsHandler.getNmsHandler().getMountClass());
trait.mount(this.player);
trait.setEnabled(enabled); // disable it until the race has started
}
}
开发者ID:CodingBadgers,项目名称:MineKart,代码行数:25,代码来源:Jockey.java
示例8: onPlayerInteractEntity
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
Entity entity = event.getRightClicked();
Player player = event.getPlayer();
if(createNewQuestEntity != null && createNewQuestEntity == player){
if(CitizensAPI.getNPCRegistry().isNPC(entity)){
QuestEntity qEntity = new QuestEntity(entity);
qEntity.SetBasics(createNewQuestEntityQuest);
player.sendMessage(ChatColor.GREEN + QuestEntityHandler.getEntityName(entity) + " is now a quest giver.");
}else{
player.sendMessage(ChatColor.RED + "That isn't a citizens NPC. Try again.");
}
createNewQuestEntity = null;
return;
}
EpicPlayer epicPlayer = EpicSystem.getEpicPlayer(player.getUniqueId());
if(QuestEntityHandler.entityList.containsKey(entity)){
QuestEntityHandler.GetQuestEntity(entity).NextInteraction(epicPlayer);
event.setCancelled(true);
}
}
开发者ID:Randehh,项目名称:EpicQuest,代码行数:25,代码来源:PlayerInteractListener.java
示例9: check
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
public boolean check(Event e) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
if (registry.isNPC(entity.getSingle(e))) {
return isNegated();
} else {
return !isNegated();
}
}
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:9,代码来源:CondEntityIsNpc.java
示例10: RpgPlusEntity
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
public RpgPlusEntity(Location location, EntityType type) {
this.location = location;
this.type = type;
npc = CitizensAPI.getNPCRegistry().createNPC(type, "");
npc.addTrait(new NameTagTrait(type));
if (type == EntityType.PLAYER) {
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
} else {
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
}
}
开发者ID:leMaik,项目名称:RpgPlus,代码行数:15,代码来源:RpgPlusEntity.java
示例11: check
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
public boolean check(Event evt) {
if (test.getSingle(evt) != null && id.getSingle(evt) != null
&& test.getSingle(evt).hasMetadata("NPC")) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
if (registry.getNPC(test.getSingle(evt)).getId() == id.getSingle(evt).intValue()) {
return true;
}
return false;
} else {
return false;
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:CondIsNpcIdGeneral.java
示例12: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@Nullable
protected Location[] get(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npc = registry.getById(id.getSingle(evt).intValue());
BuilderTrait bt = npc.getTrait(BuilderTrait.class);
if (bt.schematic != null) {
Location topLeft = loc.getSingle(evt).add((Math.round(bt.schematic.width() / 2)),
bt.schematic.height() - 1, (Math.round(bt.schematic.length() / 2)));
return new Location[] {topLeft};
} else {
Skript.error("A schematic has yet to be loaded for this Builder");
return new Location[] {loc.getSingle(evt)};
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:ExprTopLeftSchematic.java
示例13: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@org.eclipse.jdt.annotation.Nullable
protected Entity[] get(org.bukkit.event.Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
try {
NPC npc = registry.getById(this.id.getSingle(evt).intValue());
return new Entity[] {npc.getEntity()};
} catch (NullPointerException exception) {
return null;
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:ExprGeneralCitizen.java
示例14: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@Nullable
protected Number[] get(Event evt) {
if (entity.getSingle(evt) != null && entity.getSingle(evt).hasMetadata("NPC")) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
return new Number[] {registry.getNPC(entity.getSingle(evt)).getId()};
}
return null;
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:10,代码来源:ExprCitizenIdFromEntity.java
示例15: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@Nullable
protected String[] get(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npcName = registry.getById(id.getSingle(evt).intValue());
return new String[] {npcName.getName()};
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:8,代码来源:ExprNameOfCitizen.java
示例16: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@Nullable
protected String[] get(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npc = registry.getById(id.getSingle(evt).intValue());
if (npc.hasTrait(Owner.class)) {
return new String[] {npc.getTrait(Owner.class).getOwner()};
}
return new String[] {};
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:11,代码来源:ExprOwnerOfCitizen.java
示例17: get
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
@Nullable
protected Location[] get(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npc = registry.getById(id.getSingle(evt).intValue());
BuilderTrait bt = npc.getTrait(BuilderTrait.class);
if (bt.schematic != null) {
Location bottomRight = loc.getSingle(evt).add((-1 * Math.floor(bt.schematic.width() / 2)), -1,
(-1 * Math.floor(bt.schematic.length() / 2)));
return new Location[] {bottomRight};
} else {
Skript.error("A schematic has yet to be loaded for this Builder");
return new Location[] {loc.getSingle(evt)};
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:ExprBottomRightSchematic.java
示例18: execute
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npcSpeak = registry.getById(id.getSingle(evt).intValue());
SpeechContext sp =
new SpeechContext(npcSpeak, speak.getSingle(evt).replace("\"", ""), target.getSingle(evt));
npcSpeak.getDefaultSpeechController().speak(sp);
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:9,代码来源:EffCitizenSpeak.java
示例19: execute
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npc = registry.getById(id.getSingle(evt).intValue());
if (npc != null && npc.getEntity().getType().equals(EntityType.PLAYER)) {
((Player) npc.getEntity()).setSneaking(!((Player) npc.getEntity()).isSneaking());
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:9,代码来源:EffCitizenToggleCrouch.java
示例20: execute
import net.citizensnpcs.api.CitizensAPI; //导入依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC getter = registry.getById(id.getSingle(evt).intValue());
if (getter.getEntity().getType().equals(EntityType.PLAYER)
|| getter.getEntity().getType() == EntityType.ENDERMAN
|| getter.getEntity().getType() == EntityType.ZOMBIE
|| getter.getEntity().getType() == EntityType.SKELETON) {
Equipment equ = getter.getTrait(Equipment.class);
equ.set(EquipmentSlot.HAND, item.getSingle(evt));
} else {
Skript.error("Entity must be equipable!");
}
}
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:EffCitizenHold.java
注:本文中的net.citizensnpcs.api.CitizensAPI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论