本文整理汇总了Java中net.citizensnpcs.api.CitizensAPI.getNPCRegistry方法的典型用法代码示例。如果您正苦于以下问题:Java CitizensAPI.getNPCRegistry方法的具体用法?Java CitizensAPI.getNPCRegistry怎么用?Java CitizensAPI.getNPCRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.citizensnpcs.api.CitizensAPI
的用法示例。
在下文中一共展示了CitizensAPI.getNPCRegistry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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;
}
}
示例3: execute
import net.citizensnpcs.api.CitizensAPI; //导入方法依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC attacker = registry.getById(id.getSingle(evt).intValue());
if (attacker != null) {
attacker.getNavigator().setTarget(toBeAttacked.getSingle(evt), true);
}
}
示例4: 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;
}
}
示例5: 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;
}
示例6: execute
import net.citizensnpcs.api.CitizensAPI; //导入方法依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
if (registry.getById(id.getSingle(evt).intValue()) != null) {
try {
NPC despawn = registry.getById(id.getSingle(evt).intValue());
despawn.despawn(null);
} catch (NullPointerException exp) {
return;
}
}
}
示例7: 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());
npc.addTrait(SentryTrait.class);
SentryInstance st = npc.getTrait(SentryTrait.class).getInstance();
st.setGuardTarget(target.getSingle(evt).getName(), true);
}
示例8: 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)};
}
}
示例9: 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);
}
示例10: 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!");
}
}
示例11: 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)) {
if (shouldCrouch) {
// Make crouch here
((Player) npc.getEntity()).setSneaking(true);
} else {
// Make uncrouch here
((Player) npc.getEntity()).setSneaking(false);
}
}
}
示例12: 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)) {
if (type) {
PlayerAnimation.STOP_SLEEPING.play((Player) npc.getEntity());
} else {
PlayerAnimation.SLEEP.play((Player) npc.getEntity());
}
}
}
示例13: 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)) {
PlayerAnimation.ARM_SWING.play((Player) npc.getEntity());
}
}
示例14: execute
import net.citizensnpcs.api.CitizensAPI; //导入方法依赖的package包/类
@Override
protected void execute(Event evt) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npcName = registry.getById(id.getSingle(evt).intValue());
if (vun == true) {
npcName.setProtected(false);
}
if (vun == false) {
npcName.setProtected(true);
}
}
示例15: 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());
npc.addTrait(LookClose.class);
npc.getTrait(LookClose.class).setRealisticLooking(true);
npc.getTrait(LookClose.class).toggle();
}