Java 类org.bukkit.entity.NPC 实例源码

项目:MineZ    文件:VillagerListener.java   
@EventHandler
public void onPlayerInteractEntityEvent(PlayerInteractEntityEvent event) { Entity entity = event.getRightClicked();
  if (!(entity instanceof NPC))
    return;
  final Player p = event.getPlayer();
  event.setCancelled(true);
  Bukkit.getServer().getScheduler().runTaskLater((Plugin) this, new Runnable(){
      public void run(){
       p.sendMessage(ChatColor.GRAY + "0o==================" + ChatColor.GREEN + ChatColor.BOLD + "MineZ" + ChatColor.GRAY + "==================o0");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "Welcome to MineZ");
       p.sendMessage(ChatColor.GREEN + "This is a quick tutorial about the gamemode");
       p.sendMessage(ChatColor.GREEN + "Let's get started!");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GRAY + "0o=================================================o0");
      }
     }, 200);
     Bukkit.getServer().getScheduler().runTaskLater((Plugin) this, new Runnable(){
      public void run(){
       p.sendMessage(ChatColor.GRAY + "0o===============" + ChatColor.GREEN + ChatColor.BOLD + "Gameplay" + ChatColor.GRAY + "==============o0");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");// Add message here
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GREEN + "");
       p.sendMessage(ChatColor.GRAY + "0o=================================================o0");
      }
     }, 400);

}
项目:GlowNPC    文件:GlowNPCPlugin.java   
@Override
public void onDisable() {
    getServer().getWorlds().forEach(world -> world.getEntitiesByClass(NPC.class).forEach(e -> e.remove()));
}
项目:McMMOPlus    文件:Misc.java   
public static boolean isNPCEntity(Entity entity) {
    return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
}
项目:Ghosts    文件:Misc.java   
public static boolean isNPCEntity(Entity entity) {
    return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC);
}
项目:well-auction    文件:EntityShopEntity.java   
/**
 * Checks if an entity can be shop.
 * 
 * @param entity
 *            the entity
 * @return true, if successful
 */
public static boolean canBeShop(Entity entity) {
    return entity instanceof Animals || entity instanceof NPC;
}