RuneHive-Game
Loading...
Searching...
No Matches
HunterTask.java
Go to the documentation of this file.
1package com.runehive.game.task.impl;
2
3import com.runehive.content.skill.impl.hunter.trap.Trap;
4import com.runehive.content.skill.impl.hunter.trap.TrapExecution;
5import com.runehive.content.skill.impl.hunter.trap.TrapManager;
6import com.runehive.game.task.Task;
7import com.runehive.game.world.World;
8
9import java.util.Iterator;
10
11public class HunterTask extends Task {
12 private static boolean RUNNING;
13
14 public static void intialize() {
15 if (!RUNNING) {
16 RUNNING = true;
18 }
19 }
20
21 public HunterTask() {
22 super(false, 1);
23 }
24
25 @Override
26 protected void execute() {
27 final Iterator<Trap> iterator = TrapManager.traps.iterator();
28 while (iterator.hasNext()) {
29 final Trap trap = iterator.next();
30 if (trap == null)
31 continue;
32 if (trap.getOwner() == null || !trap.getOwner().isRegistered())
36 }
37
38 if (TrapManager.traps.isEmpty()) {
39 cancel();
40 }
41 }
42
43 @Override
44 protected void onCancel(boolean logout) {
45 RUNNING = false;
46 }
47}
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
Task(boolean instant, int delay)
Creates a new Task.
Definition Task.java:41
void onCancel(boolean logout)
A function executed on cancellation.
void execute()
A function representing the unit of work that will be carried out.
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247