/
ServerPrestartScriptEvent.java
54 lines (45 loc) · 1.64 KB
/
ServerPrestartScriptEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.denizenscript.denizen.events.core;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.containers.core.WorldScriptContainer;
public class ServerPrestartScriptEvent extends BukkitScriptEvent {
// <--[event]
// @Events
// server prestart
//
// @Regex ^on server prestart$
//
// @Triggers before the server finishes starting... fired after some saves are loaded, but before other data is loaded. Use with extreme caution.
//
// @Warning This event uses special pre-loading tricks to fire before everything else. Use extreme caution.
//
// -->
public ServerPrestartScriptEvent() {
instance = this;
}
public static ServerPrestartScriptEvent instance;
@Override
public boolean couldMatch(ScriptPath path) {
if (!path.eventLower.startsWith("server prestart")) {
return false;
}
return true;
}
@Override
public String getName() {
return "ServerPrestart";
}
@Override
public ObjectTag getContext(String name) {
return super.getContext(name);
}
public void specialHackRunEvent() {
for (WorldScriptContainer container : ScriptEvent.worldContainers) {
if (container.contains("events.on server prestart")) {
ScriptPath path = new ScriptPath(container, "server prestart", "on server prestart");
clone().run(path);
}
}
}
}