/
ServerPrestartScriptEvent.java
50 lines (42 loc) · 1.52 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
package com.denizenscript.denizen.events.server;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.denizencore.scripts.containers.core.WorldScriptContainer;
public class ServerPrestartScriptEvent extends BukkitScriptEvent {
// <--[event]
// @Events
// server prestart
//
// @Regex ^on server prestart$
//
// @Group Server
//
// @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";
}
public void specialHackRunEvent() {
for (WorldScriptContainer container : ScriptEvent.worldContainers) {
if (container.containsScriptSection("events.on server prestart")) {
ScriptPath path = new ScriptPath(container, "server prestart", "on server prestart");
clone().run(path);
}
}
}
}