当前位置: 首页>>代码示例>>Java>>正文


Java CitizensAPI.getNPCRegistry方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:9,代码来源:CondEntityIsNpc.java

示例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;
  }
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:CondIsNpcIdGeneral.java

示例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);
  }
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:9,代码来源:EffCitizenAttack.java

示例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;
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:ExprGeneralCitizen.java

示例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;
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:10,代码来源:ExprCitizenIdFromEntity.java

示例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;
    }
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:EffDespawnCitizen.java

示例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);

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:10,代码来源:EffSentryProtect.java

示例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)};
  }
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:ExprBottomRightSchematic.java

示例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);
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:9,代码来源:EffCitizenSpeak.java

示例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!");
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:EffCitizenHold.java

示例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);
    }
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:16,代码来源:EffCitizenSetCrouch.java

示例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());
    }
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:14,代码来源:EffCitizenSleep.java

示例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());
  }

}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:10,代码来源:EffCitizenSwing.java

示例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);
  }
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:12,代码来源:EffCitizenVulnerablity.java

示例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();
}
 
开发者ID:eyesniper2,项目名称:skRayFall,代码行数:9,代码来源:EffGiveLookCloseTrait.java


注:本文中的net.citizensnpcs.api.CitizensAPI.getNPCRegistry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。