-
-
Notifications
You must be signed in to change notification settings - Fork 51
SuperiorSkyblock Integration #446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
b077e0a
77713ed
d3988fa
082a86e
1be5361
a96c4e1
fb1e0ea
826bdf7
2faa8fc
245f6ef
ba66262
8d2e3c4
cd7d7b0
4dc2a71
c34f2b1
2c99ea3
e3a2831
d08a232
65267ff
22680ed
07f19b9
82fa337
d6aeff6
ef8ee36
b70b5aa
b1720f6
ddeffb0
f382088
995ca0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package com.denizenscript.depenizen.bukkit.bridges; | ||
|
|
||
| import com.denizenscript.denizencore.events.ScriptEvent; | ||
| import com.denizenscript.denizencore.objects.ObjectFetcher; | ||
| import com.denizenscript.denizencore.tags.TagManager; | ||
| import com.denizenscript.depenizen.bukkit.Bridge; | ||
| import com.denizenscript.depenizen.bukkit.events.superiorskyblock.*; | ||
| import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; | ||
| import com.denizenscript.depenizen.bukkit.properties.superiorskyblock.SuperiorSkyblockPlayerExtensions; | ||
|
|
||
| public class SuperiorSkyblockBridge extends Bridge { | ||
|
|
||
| @Override | ||
| public void init() { | ||
| ScriptEvent.registerScriptEvent(SuperiorSkyblockIslandCreatedScriptEvent.class); | ||
| ScriptEvent.registerScriptEvent(SuperiorSkyblockIslandDisbandedScriptEvent.class); | ||
| SuperiorSkyblockPlayerExtensions.register(); | ||
| ObjectFetcher.registerWithObjectFetcher(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.tagProcessor); | ||
|
|
||
| // <--[tag] | ||
| // @attribute <island[<name>]> | ||
| // @returns SuperiorSkyblockIslandTag | ||
| // @plugin Depenizen, SuperiorSkyblock | ||
| // @description | ||
| // Returns the superiorskyblock island tag with the given name. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an object link, |
||
| // --> | ||
| TagManager.registerTagHandler(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.class, "island", (attribute, param) -> { | ||
| return param; | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package com.denizenscript.depenizen.bukkit.events.superiorskyblock; | ||
|
|
||
| import com.bgsoftware.superiorskyblock.api.events.IslandCreateEvent; | ||
| import com.denizenscript.denizen.events.BukkitScriptEvent; | ||
| import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData; | ||
| import com.denizenscript.denizencore.objects.ObjectTag; | ||
| import com.denizenscript.denizencore.objects.core.ElementTag; | ||
| import com.denizenscript.denizencore.scripts.ScriptEntryData; | ||
| import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; | ||
| import org.bukkit.event.EventHandler; | ||
| import org.bukkit.event.Listener; | ||
|
|
||
| public class SuperiorSkyblockIslandCreatedScriptEvent extends BukkitScriptEvent implements Listener { | ||
|
|
||
| // <--[event] | ||
| // @Events | ||
| // superiorskyblock island created | ||
| // | ||
| // @Triggers when an island is created | ||
| // | ||
| // @Cancellable true | ||
| // | ||
| // @Context | ||
| // <context.island> returns a SuperiorSkyblockIslandTag of the island. | ||
| // | ||
| // @Determine | ||
| // "NAME:<ElementTag>" to change the name of the island. | ||
| // | ||
| // @Plugin Depenizen, SuperiorSkyblock | ||
| // | ||
| // @Player Always. | ||
| // | ||
| // @Group Depenizen | ||
| // | ||
| // --> | ||
|
|
||
| public SuperiorSkyblockIslandCreatedScriptEvent() { | ||
| registerCouldMatcher("superiorskyblock island created"); | ||
| this.<SuperiorSkyblockIslandCreatedScriptEvent, ElementTag>registerDetermination("name", ElementTag.class, (evt, context, name) -> { | ||
| evt.event.getIsland().setName(name.asString()); | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having utility determinations is nice, but I'd probably prioritize the event's actual options - e.g. looking at the JD it seems to let you control whether the player will automatically teleport to their Island & get what schematic the island was created from. |
||
| } | ||
|
|
||
| public IslandCreateEvent event; | ||
|
|
||
| @Override | ||
| public ScriptEntryData getScriptEntryData() { | ||
| return new BukkitScriptEntryData(event.getPlayer().asPlayer()); | ||
| } | ||
|
|
||
| @Override | ||
| public ObjectTag getContext(String name) { | ||
| return switch (name) { | ||
| case "island" -> new SuperiorSkyblockIslandTag(event.getIsland()); | ||
| default -> super.getContext(name); | ||
| }; | ||
| } | ||
|
|
||
| @EventHandler | ||
| public void onIslandCreate(IslandCreateEvent event) { | ||
| this.event = event; | ||
| fire(event); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package com.denizenscript.depenizen.bukkit.events.superiorskyblock; | ||
|
|
||
| import com.bgsoftware.superiorskyblock.api.events.IslandDisbandEvent; | ||
| import com.denizenscript.denizen.events.BukkitScriptEvent; | ||
| import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData; | ||
| import com.denizenscript.denizencore.objects.ObjectTag; | ||
| import com.denizenscript.denizencore.scripts.ScriptEntryData; | ||
| import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; | ||
| import org.bukkit.event.EventHandler; | ||
| import org.bukkit.event.Listener; | ||
|
|
||
| public class SuperiorSkyblockIslandDisbandedScriptEvent extends BukkitScriptEvent implements Listener { | ||
|
|
||
| // <--[event] | ||
| // @Events | ||
| // superiorskyblock island disbanded | ||
| // | ||
| // @Triggers when an island is disbanded | ||
| // | ||
| // @Cancellable true | ||
| // | ||
| // @Context | ||
| // <context.island> returns a SuperiorSkyblockIslandTag of the island. | ||
| // | ||
| // @Plugin Depenizen, SuperiorSkyblock | ||
| // | ||
| // @Player Always. | ||
| // | ||
| // @Group Depenizen | ||
| // | ||
| // --> | ||
|
|
||
| public SuperiorSkyblockIslandDisbandedScriptEvent() { | ||
| registerCouldMatcher("superiorskyblock island disbanded"); | ||
| } | ||
|
|
||
| public IslandDisbandEvent event; | ||
|
|
||
| @Override | ||
| public ScriptEntryData getScriptEntryData() { | ||
| return new BukkitScriptEntryData(event.getPlayer().asPlayer()); | ||
| } | ||
|
|
||
| @Override | ||
| public ObjectTag getContext(String name) { | ||
| return switch (name) { | ||
| case "island" -> new SuperiorSkyblockIslandTag(event.getIsland()); | ||
| default -> super.getContext(name); | ||
| }; | ||
| } | ||
|
|
||
| @EventHandler | ||
| public void onIslandDisband(IslandDisbandEvent event) { | ||
| this.event = event; | ||
| fire(event); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should prefix this tag