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); }
public void stopAttacking() { if (this.attackingID != -1) Bukkit.getScheduler().cancelTask(this.attackingID); }