-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
BungeeServerConnectScriptEvent.java
60 lines (49 loc) · 1.59 KB
/
BungeeServerConnectScriptEvent.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
55
56
57
58
59
60
package com.denizenscript.depenizen.bukkit.events.bungee;
import com.denizenscript.denizen.BukkitScriptEntryData;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizencore.objects.ElementTag;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
public class BungeeServerConnectScriptEvent extends BukkitScriptEvent {
// <--[event]
// @Events
// bungee server connects
//
// @Regex ^on bungee server connects$
//
// @Triggers when another server on the Bungee network becomes connected.
//
// @Context
// <context.server> returns the name of the newly connected server.
//
// -->
public BungeeServerConnectScriptEvent() {
instance = this;
}
public static BungeeServerConnectScriptEvent instance;
public String serverName;
@Override
public boolean couldMatch(ScriptContainer scriptContainer, String s) {
return s.startsWith("bungee server connects");
}
@Override
public boolean matches(ScriptPath path) {
return true;
}
@Override
public String getName() {
return "BungeeServerConnects";
}
@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(null, null);
}
@Override
public ObjectTag getContext(String name) {
if (name.equals("server")) {
return new ElementTag(serverName);
}
return super.getContext(name);
}
}