Example #1
0
 public void startAttacking(final LivingEntity e) {
   if (this.attackingID != -1) this.stopAttacking();
   this.attackingID =
       Bukkit.getScheduler()
           .scheduleSyncRepeatingTask(
               DragonsLairMain.getInstance(), new NPCAttackTask(this, e), 0, 10L);
 }
 @Override
 public String getPromptText(final ConversationContext arg0) {
   final ScheduledEvent[] events =
       DragonsLairMain.getEventScheduler().getEvents().values().toArray(new ScheduledEvent[0]);
   Arrays.sort(
       events,
       new Comparator<ScheduledEvent>() {
         @Override
         public int compare(final ScheduledEvent arg0, final ScheduledEvent arg1) {
           if (arg0.getID() > arg1.getID()) return 1;
           else if (arg0.getID() < arg1.getID()) return -1;
           else return 0;
         }
       });
   arg0.getForWhom()
       .sendRawMessage(
           ChatColor.GREEN + "There is/are " + events.length + " scheduled event(s) available:");
   if (12 * this.page > events.length) this.page = events.length / 12;
   for (int i = 12 * this.page; i < events.length && i < 12 * this.page + 12; i++)
     arg0.getForWhom()
         .sendRawMessage(
             "   " + events[i].getID() + " - event ids:" + events[i].getEventIDString());
   return "---------------- Page " + (this.page + 1) + "/" + (events.length / 12 + 1);
 }