-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
ASkyBlockSupport.java
82 lines (71 loc) · 3.41 KB
/
ASkyBlockSupport.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
75
76
77
78
79
80
81
82
package com.morphanone.depenizenbukkit.support.plugins;
import com.morphanone.depenizenbukkit.events.askyblock.PlayerCompletesSkyBlockChallengeScriptEvent;
import com.morphanone.depenizenbukkit.events.askyblock.PlayerEntersSkyBlockScriptEvent;
import com.morphanone.depenizenbukkit.events.askyblock.PlayerExitsSkyBlockScriptEvent;
import com.morphanone.depenizenbukkit.events.askyblock.SkyBlockCreatedScriptEvent;
import com.morphanone.depenizenbukkit.events.askyblock.SkyBlockResetScriptEvent;
import com.wasteofplastic.askyblock.ASkyBlockAPI;
import net.aufdemrand.denizen.objects.dLocation;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.objects.dWorld;
import net.aufdemrand.denizencore.tags.TagContext;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.tags.Attribute;
import com.morphanone.depenizenbukkit.extensions.askyblock.ASkyBlockLocationExtension;
import com.morphanone.depenizenbukkit.extensions.askyblock.ASkyBlockPlayerExtension;
import com.morphanone.depenizenbukkit.extensions.askyblock.ASkyBlockWorldExtension;
import com.morphanone.depenizenbukkit.support.Support;
public class ASkyBlockSupport extends Support {
public ASkyBlockSupport() {
registerProperty(ASkyBlockPlayerExtension.class, dPlayer.class);
registerProperty(ASkyBlockLocationExtension.class, dLocation.class);
registerProperty(ASkyBlockWorldExtension.class, dWorld.class);
registerScriptEvents(new SkyBlockCreatedScriptEvent());
registerScriptEvents(new SkyBlockResetScriptEvent());
registerScriptEvents(new PlayerEntersSkyBlockScriptEvent());
registerScriptEvents(new PlayerExitsSkyBlockScriptEvent());
registerScriptEvents(new PlayerCompletesSkyBlockChallengeScriptEvent());
// TODO: Skyblock Command
}
ASkyBlockAPI api = ASkyBlockAPI.getInstance();
@Override
public String additionalTags(Attribute attribute, TagContext tagContext) {
if (attribute == null) {
return null;
}
if (attribute.startsWith("skyblock")) {
attribute = attribute.fulfill(1);
// <--[tag]
// @attribute <skyblock.island_world>
// @returns dWorld
// @description
// Returns the world that A Skyblock uses for islands.
// @plugin Depenizen, A SkyBlock
// -->
if (attribute.startsWith("island_world")) {
return new dWorld(api.getIslandWorld()).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <skyblock.nether_world>
// @returns dWorld
// @description
// Returns the world that A Skyblock uses for the nether.
// @plugin Depenizen, A SkyBlock
// -->
else if (attribute.startsWith("nether_world")) {
return new dWorld(api.getNetherWorld()).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <skyblock.island_count>
// @returns Element(Number)
// @description
// Returns the number of Skyblock Islands that exist.
// @plugin Depenizen, A SkyBlock
// -->
else if (attribute.startsWith("island_count")) {
return new Element(api.getIslandCount()).getAttribute(attribute.fulfill(1));
}
}
return null;
}
}