-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
McMMOSupport.java
41 lines (35 loc) · 1.64 KB
/
McMMOSupport.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
package net.gnomeffinway.depenizen.support.plugins;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizencore.events.ScriptEvent;
import net.aufdemrand.denizencore.tags.Attribute;
import net.gnomeffinway.depenizen.commands.McMMOCommands;
import net.gnomeffinway.depenizen.events.mcMMO.mcMMOPlayerLevelChangeScriptEvent;
import net.gnomeffinway.depenizen.events.mcMMO.mcMMOPlayerLevelDownScriptEvent;
import net.gnomeffinway.depenizen.events.mcMMO.mcMMOPlayerLevelUpScriptEvent;
import net.gnomeffinway.depenizen.extensions.mcmmo.McMMOPlayerExtension;
import net.gnomeffinway.depenizen.objects.dParty;
import net.gnomeffinway.depenizen.support.Support;
public class McMMOSupport extends Support {
public McMMOSupport() {
registerObjects(dParty.class);
registerAdditionalTags("party");
registerProperty(McMMOPlayerExtension.class, dPlayer.class);
new McMMOCommands().activate().as("MCMMO").withOptions("see documentation", 1);
ScriptEvent.registerScriptEvent(new mcMMOPlayerLevelChangeScriptEvent());
ScriptEvent.registerScriptEvent(new mcMMOPlayerLevelUpScriptEvent());
ScriptEvent.registerScriptEvent(new mcMMOPlayerLevelDownScriptEvent());
}
public String additionalTags(Attribute attribute) {
if (attribute == null) {
return null;
}
if (attribute.startsWith("party") && attribute.hasContext(1)) {
dParty party = dParty.valueOf(attribute.getContext(1));
if (party == null) {
return null;
}
return party.getAttribute(attribute.fulfill(1));
}
return null;
}
}