public static void start(Callback callback, Conversable player, List<NPC> possible) {
   final Conversation conversation =
       new ConversationFactory(CitizensAPI.getPlugin())
           .withLocalEcho(false)
           .withEscapeSequence("exit")
           .withModality(false)
           .withFirstPrompt(new NPCCommandSelector(callback, possible))
           .buildConversation(player);
   conversation.begin();
 }
Exemplo n.º 2
0
 @Override
 public void die(DamageSource damagesource) {
   // players that die are not normally removed from the world. when the
   // NPC dies, we are done with the instance and it should be removed.
   if (dead) {
     return;
   }
   super.die(damagesource);
   Bukkit.getScheduler()
       .runTaskLater(
           CitizensAPI.getPlugin(),
           new Runnable() {
             @Override
             public void run() {
               world.removeEntity(EntityHumanNPC.this);
             }
           },
           35); // give enough time for death and smoke animation
 }
Exemplo n.º 3
0
 @Override
 public boolean damageEntity(DamageSource damagesource, float f) {
   // knock back velocity is cancelled and sent to client for handling when
   // the entity is a player. there is no client so make this happen
   // manually.
   boolean damaged = super.damageEntity(damagesource, f);
   if (damaged && velocityChanged) {
     velocityChanged = false;
     Bukkit.getScheduler()
         .runTask(
             CitizensAPI.getPlugin(),
             new Runnable() {
               @Override
               public void run() {
                 EntityHumanNPC.this.velocityChanged = true;
               }
             });
   }
   return damaged;
 }