-
-
Notifications
You must be signed in to change notification settings - Fork 104
/
ResourcePackStatusScriptEvent.java
74 lines (61 loc) · 1.99 KB
/
ResourcePackStatusScriptEvent.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.denizenscript.denizen.events.player;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.utilities.packets.NetworkInterceptHelper;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
public class ResourcePackStatusScriptEvent extends BukkitScriptEvent {
// <--[event]
// @Events
// resource pack status
//
// @Regex ^on resource pack status$
//
// @Group Player
//
// @Triggers when a player accepts, denies, successfully loads, or fails to download a resource pack.
//
// @Context
// <context.status> returns an ElementTag of the status. Can be: SUCCESSFULLY_LOADED, DECLINED, FAILED_DOWNLOAD, ACCEPTED.
//
// @Player Always.
//
// -->
public ResourcePackStatusScriptEvent() {
instance = this;
}
public static ResourcePackStatusScriptEvent instance;
public ElementTag status;
public PlayerTag player;
@Override
public boolean couldMatch(ScriptPath path) {
return path.eventLower.startsWith("resource pack status");
}
public boolean enabled;
@Override
public void init() {
NetworkInterceptHelper.enable();
enabled = true;
}
@Override
public void destroy() {
enabled = false;
}
@Override
public String getName() {
return "ResourcePackStatus";
}
@Override
public ObjectTag getContext(String name) {
if (name.equals("status")) {
return status;
}
return super.getContext(name);
}
@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(player, null);
}
}