Make specific action-related methods final.

This commit is contained in:
Major-
2014-08-10 02:58:30 +01:00
parent 7505aa7332
commit 969b203e5d
3 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ public abstract class Action<T extends Mob> extends ScheduledTask {
*
* @return The mob.
*/
public T getMob() {
public final T getMob() {
return mob;
}
@@ -54,12 +54,11 @@ public abstract class DistancedAction<T extends Mob> extends Action<T> {
}
@Override
public void execute() {
if (reached) {
// some actions (e.g. agility) will cause the player to move away again
// so we don't check once the player got close enough once
executeAction(); // TODO checking the walking queue size is a really cheap fix, and relies on the client not
// being edited... this class needs to be completely re-written.
public final void execute() {
if (reached) { // Don't check again in case the player has moved away since it was reached
executeAction();
// TODO checking the walking queue size is a really cheap fix, and relies on the client not
// being edited... this class needs to be completely re-written.
} else if (mob.getPosition().getDistance(position) <= distance && mob.getWalkingQueue().size() == 0) {
reached = true;
setDelay(delay);
@@ -65,7 +65,7 @@ public abstract class ScheduledTask {
* @param delay The delay.
* @throws IllegalArgumentException If the delay is less than or equal to zero.
*/
public void setDelay(int delay) {
public final void setDelay(int delay) {
if (delay < 0) {
throw new IllegalArgumentException("Delay cannot be less than 0.");
}