RuneHive-Game
Loading...
Searching...
No Matches
DoubleExperienceEvent.java
Go to the documentation of this file.
1
package
com.runehive.game.task.impl;
2
3
import
com.runehive.content.WellOfGoodwill;
4
import
com.runehive.game.task.Task;
5
import
com.runehive.game.world.World;
6
7
/**
8
* An randomevent which starts double experience for 1 hour.
9
*
10
* @author Daniel | Obey
11
*/
12
public
class
DoubleExperienceEvent
extends
Task
{
13
14
public
DoubleExperienceEvent
() {
15
super(100);
16
}
17
18
@Override
19
public
void
execute
() {
20
if
(!
WellOfGoodwill
.
isActive
()) {
21
cancel
();
22
return
;
23
}
24
25
WellOfGoodwill
.
activeTime
++;
26
27
if
(
WellOfGoodwill
.
activeTime
== 15) {
28
World
.
sendMessage
(
"<col=2b58a0>WOG</col>: 15 Minutes left until the well is expired."
);
29
}
else
if
(
WellOfGoodwill
.
activeTime
== 25) {
30
World
.
sendMessage
(
"<col=2b58a0>WOG</col>: 5 Minutes left until the well is expired."
);
31
}
else
if
(
WellOfGoodwill
.
activeTime
== 30) {
32
cancel
();
33
}
34
}
35
36
@Override
37
protected
void
onCancel
(
boolean
logout) {
38
World
.
sendMessage
(
"<col=2b58a0>WOG</col>: The well has expired and needs replenishing!"
);
39
WellOfGoodwill.activeTime
= -1;
40
WellOfGoodwill.CONTRIBUTION
= 0;
41
}
42
43
}
com.runehive.content.WellOfGoodwill
Handles contribution towards the well of goodwill.
Definition
WellOfGoodwill.java:24
com.runehive.content.WellOfGoodwill.CONTRIBUTION
static int CONTRIBUTION
The current contribution amount for the well.
Definition
WellOfGoodwill.java:27
com.runehive.content.WellOfGoodwill.activeTime
static int activeTime
Definition
WellOfGoodwill.java:29
com.runehive.content.WellOfGoodwill.isActive
static boolean isActive()
Definition
WellOfGoodwill.java:138
com.runehive.game.task.Task.cancel
synchronized final void cancel()
Cancels all subsequent executions.
Definition
Task.java:113
com.runehive.game.task.Task.Task
Task(boolean instant, int delay)
Creates a new Task.
Definition
Task.java:41
com.runehive.game.task.impl.DoubleExperienceEvent.DoubleExperienceEvent
DoubleExperienceEvent()
Definition
DoubleExperienceEvent.java:14
com.runehive.game.task.impl.DoubleExperienceEvent.onCancel
void onCancel(boolean logout)
A function executed on cancellation.
Definition
DoubleExperienceEvent.java:37
com.runehive.game.task.impl.DoubleExperienceEvent.execute
void execute()
A function representing the unit of work that will be carried out.
Definition
DoubleExperienceEvent.java:19
com.runehive.game.world.World
Represents the game world.
Definition
World.java:46
com.runehive.game.world.World.sendMessage
static void sendMessage(String... messages)
Sends a global message.
Definition
World.java:396