From b077e0a2bd3b6c1f1283fc85856ee8bf6c8cbaa1 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Fri, 9 May 2025 20:14:49 -0700 Subject: [PATCH 01/25] SuperiorSkyblock Compatibility --- Docs/BukkitPlugins.md | 1 + pom.xml | 7 + .../depenizen/bukkit/Depenizen.java | 1 + .../bridges/SuperiorSkyblockBridge.java | 31 ++ ...eriorSkyblockIslandCreatedScriptEvent.java | 64 +++ ...iorSkyblockIslandDisbandedScriptEvent.java | 57 +++ .../SuperiorSkyblockIslandTag.java | 386 ++++++++++++++++++ .../SuperiorSkyblockPlayerExtensions.java | 134 ++++++ src/main/resources/plugin.yml | 1 + 9 files changed, 682 insertions(+) create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandDisbandedScriptEvent.java create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java diff --git a/Docs/BukkitPlugins.md b/Docs/BukkitPlugins.md index 3ff76ffb7..89f793f33 100644 --- a/Docs/BukkitPlugins.md +++ b/Docs/BukkitPlugins.md @@ -35,6 +35,7 @@ Supported Plugins: (And the sources we acquired Jar files from.) - Sentinel (https://www.spigotmc.org/resources/sentinel.22017/) - ShopKeepers (https://www.spigotmc.org/resources/shopkeepers.80756/) - SkillAPI (http://dev.bukkit.org/bukkit-plugins/skillapi/) +- SuperiorSkyblock2 (https://www.spigotmc.org/resources/⚡%EF%B8%8F-superiorskyblock2-⚡%EF%B8%8F-the-best-core-on-market-⚡%EF%B8%8F-1-21-5-support.87411) - TerrainControl/OpenTerrainGenerator (https://github.com/PG85/OpenTerrainGenerator) - Towny (https://github.com/TownyAdvanced/Towny) - TownyChat (https://github.com/TownyAdvanced/Towny) diff --git a/pom.xml b/pom.xml index 10bf06f15..0288a169d 100644 --- a/pom.xml +++ b/pom.xml @@ -316,6 +316,13 @@ system ${basedir}/lib/SkillAPI.jar + + com.bgsoftware + SuperiorSkyblock + 2025.1 + system + ${basedir}/lib/SuperiorSkyblock2.jar + com.khorn TerrainControl diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/Depenizen.java b/src/main/java/com/denizenscript/depenizen/bukkit/Depenizen.java index eb68c5730..265aab6e1 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/Depenizen.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/Depenizen.java @@ -150,6 +150,7 @@ public void registerCoreBridges() { registerBridge("Sentinel", () -> new SentinelBridge()); registerBridge("Shopkeepers", () -> new ShopkeepersBridge()); registerBridge("SkillAPI", () -> new SkillAPIBridge()); + registerBridge("SuperiorSkyblock2", () -> new SuperiorSkyblockBridge()); registerBridge("TerrainControl", () -> new TerrainControlBridge()); registerBridge("Towny", () -> new TownyBridge()); registerBridge("TownyChat", () -> new TownyChatBridge()); diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java new file mode 100644 index 000000000..8f16eedac --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java @@ -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 ]> + // @returns SuperiorSkyblockIslandTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the superiorskyblock island tag with the given name. + // --> + TagManager.registerTagHandler(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.class, "island", (attribute, param) -> { + return param; + }); + } +} diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java new file mode 100644 index 000000000..215c1cf51 --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java @@ -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 + // returns a SuperiorSkyblockIslandTag of the island. + // + // @Determine + // "NAME:" to change the name of the island. + // + // @Plugin Depenizen, SuperiorSkyblock + // + // @Player Always. + // + // @Group Depenizen + // + // --> + + public SuperiorSkyblockIslandCreatedScriptEvent() { + registerCouldMatcher("superiorskyblock island created"); + this.registerDetermination("name", ElementTag.class, (evt, context, name) -> { + evt.event.getIsland().setName(name.asString()); + }); + } + + 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); + } +} diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandDisbandedScriptEvent.java b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandDisbandedScriptEvent.java new file mode 100644 index 000000000..c95918a33 --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandDisbandedScriptEvent.java @@ -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 + // 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); + } +} diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java new file mode 100644 index 000000000..cf1b806d3 --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -0,0 +1,386 @@ +package com.denizenscript.depenizen.bukkit.objects.superiorskyblock; + +import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; +import com.bgsoftware.superiorskyblock.api.enums.Rating; +import com.bgsoftware.superiorskyblock.api.island.Island; +import com.denizenscript.denizen.objects.PlayerTag; +import com.denizenscript.denizencore.objects.Adjustable; +import com.denizenscript.denizencore.objects.Fetchable; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.ObjectTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.denizencore.objects.core.ListTag; +import com.denizenscript.denizencore.tags.Attribute; +import com.denizenscript.denizencore.tags.ObjectTagProcessor; +import com.denizenscript.denizencore.tags.TagContext; + +public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { + + // <--[ObjectType] + // @name SuperiorSkyblockIslandTag + // @prefix island + // @base ElementTag + // @format + // The identity format for group is + // For example, 'island@denizen_scripters'. + // + // @plugin Depenizen, SuperiorSkyblock + // @description + // A SuperiorSkyblockIslandTag represents a SuperiorSkyblock island. + // + // --> + + @Fetchable("island") + public static SuperiorSkyblockIslandTag valueOf(String string, TagContext context) { + if (string.startsWith("island@")) { + string = string.substring(7); + } + Island island = SuperiorSkyblockAPI.getIsland(string); + if (island == null) { + return null; + } + return new SuperiorSkyblockIslandTag(island); + } + + public static boolean matches(String string) { + string = string.replace("island@", ""); + return SuperiorSkyblockAPI.getIsland(string) != null; + } + + public SuperiorSkyblockIslandTag(Island island) { + this.island = island; + } + + Island island; + + String prefix = "SuperiorSkyblockIsland"; + + @Override + public String getPrefix() { + return prefix; + } + + @Override + public ObjectTag setPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + @Override + public boolean isUnique() { + return true; + } + + @Override + public String identify() { + return "island@" + island.getName(); + } + + @Override + public String identifySimple() { + return identify(); + } + + @Override + public String toString() { + return identify(); + } + + @Override + public ObjectTag getObjectAttribute(Attribute attribute) { + return tagProcessor.getObjectAttribute(this, attribute); + } + + @Override + public void adjust(Mechanism mechanism) { + tagProcessor.processMechanism(this, mechanism); + } + + @Override + public void applyProperty(Mechanism mechanism) { + mechanism.echoError("Cannot apply Properties to a Superior Skyblock Island!"); + } + + public Island getIsland() { + return island; + } + + public static void register() { + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.balance + // @description + // Returns the balance of the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "balance", (attribute, object) -> { + return new ElementTag(object.getIsland().getIslandBank().getBalance()); + }); + + // <--[tag] + // @attribute + // @returns ListTag(PlayerTag) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns a list of players banned on the specified island. + // --> + tagProcessor.registerTag(ListTag.class, "banned_players", (attribute, object) -> { + return new ListTag(object.getIsland().getBannedPlayers(), players -> new PlayerTag(players.asPlayer())); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the bonus level of an island. + // --> + tagProcessor.registerTag(ElementTag.class, "bonus_level", (attribute, object) -> { + return new ElementTag(object.getIsland().getBonusLevel()); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the bonus worth of an island. + // --> + tagProcessor.registerTag(ElementTag.class, "bonus_worth", (attribute, object) -> { + return new ElementTag(object.getIsland().getBonusWorth()); + }); + + // <--[tag] + // @attribute + // @returns ListTag(PlayerTag) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the coop members of the specified island, if any. + // --> + tagProcessor.registerTag(ListTag.class, "coop_members", (attribute, object) -> { + return new ListTag(object.getIsland().getCoopPlayers(), players -> new PlayerTag(players.asPlayer())); + }); + + // <--[tag] + // @attribute + // @returns ListTag(PlayerTag) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the players currently within the bounds of the specified island. + // --> + tagProcessor.registerTag(ListTag.class, "current_visitors", (attribute, object) -> { + return new ListTag(object.getIsland().getAllPlayersInside(), players -> new PlayerTag(players.asPlayer())); + }); + + // <--[tag] + // @attribute + // @returns ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the description of the specified island, if any. + // --> + tagProcessor.registerTag(ElementTag.class, "description", (attribute, object) -> { + return object.getIsland().getDescription().isBlank() ? null : new ElementTag(object.getIsland().getDescription(), true); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the level of the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "level", (attribute, object) -> { + return new ElementTag(object.getIsland().getIslandLevel()); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.locked + // @description + // Returns whether an island is locked to visitors. + // --> + tagProcessor.registerTag(ElementTag.class, "locked", (attribute, object) -> { + return new ElementTag(object.getIsland().isLocked()); + }); + + // <--[tag] + // @attribute + // @returns ListTag(PlayerTag) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the members of the specified island, including the leader. + // --> + tagProcessor.registerTag(ListTag.class, "members", (attribute, object) -> { + return new ListTag(object.getIsland().getIslandMembers(true), players -> new PlayerTag(players.asPlayer())); + }); + + // <--[tag] + // @attribute + // @returns ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.name + // @description + // Returns the name of the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "name", (attribute, object) -> { + return new ElementTag(object.getIsland().getName(), true); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the net worth of the specified island. Includes money in the bank. + // --> + tagProcessor.registerTag(ElementTag.class, "net_worth", (attribute, object) -> { + return new ElementTag(object.getIsland().getWorth()); + }); + + // <--[tag] + // @attribute + // @returns PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the owner of the specified island. + // --> + tagProcessor.registerTag(PlayerTag.class, "owner", (attribute, object) -> { + return new PlayerTag(object.getIsland().getOwner().asPlayer()); + }); + + // <--[tag] + // @attribute ]> + // @returns ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the rating a player gave the specified island, if any. + // --> + tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { + Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); + if (rating.getValue() > -1) { + return new ElementTag(rating.getValue()); + } + return null; + }); + + // <--[tag] + // @attribute + // @returns ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the schematic used to create the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "schematic", (attribute, object) -> { + return new ElementTag(object.getIsland().getSchematicName(), true); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.size + // @description + // Returns the size of the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "size", (attribute, object) -> { + return new ElementTag(object.getIsland().getIslandSize()); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the current average rating of the specified island. + // --> + tagProcessor.registerTag(ElementTag.class, "total_rating", (attribute, object) -> { + return new ElementTag(object.getIsland().getTotalRating()); + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name balance + // @input ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes an island's bank balance. + // @tags + // + // --> + tagProcessor.registerMechanism("balance", false, ElementTag.class, (object, mechanism, value) -> { + if (mechanism.requireDouble()) { + object.getIsland().getIslandBank().setBalance(mechanism.getValue().asBigDecimal()); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name description + // @input ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes an island's description. Leave blank to remove. + // @tags + // + // --> + tagProcessor.registerMechanism("description", false, ElementTag.class, (object, mechanism, value) -> { + object.getIsland().setDescription(mechanism.getValue().asString()); + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name locked + // @input ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes whether an island is locked to visitors. + // @tags + // + // --> + tagProcessor.registerMechanism("locked", false, ElementTag.class, (object, mechanism, value) -> { + if (mechanism.requireBoolean()) { + object.getIsland().setLocked(mechanism.getValue().asBoolean()); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name name + // @input ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes an island's name. + // @tags + // + // --> + tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { + if (!mechanism.getValue().asString().isEmpty()) { + object.getIsland().setName(mechanism.getValue().toString()); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name size + // @input ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes an island's border size. + // @tags + // + // --> + tagProcessor.registerMechanism("size", false, ElementTag.class, (object, mechanism, value) -> { + if (mechanism.requireInteger() && mechanism.getValue().asInt() >= 1) { + object.getIsland().setIslandSize(mechanism.getValue().asInt()); + } + }); + } + + public static final ObjectTagProcessor tagProcessor = new ObjectTagProcessor<>(); + +} diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java new file mode 100644 index 000000000..8a87c5d8a --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -0,0 +1,134 @@ +package com.denizenscript.depenizen.bukkit.properties.superiorskyblock; + +import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; +import com.bgsoftware.superiorskyblock.api.island.Island; +import com.bgsoftware.superiorskyblock.api.island.PlayerRole; +import com.denizenscript.denizen.objects.PlayerTag; +import com.denizenscript.denizencore.objects.core.ElementTag; +import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; + +public class SuperiorSkyblockPlayerExtensions { + + public SuperiorSkyblockPlayerExtensions(PlayerTag player) { + this.player = player; + } + + PlayerTag player; + + public static void register() { + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism PlayerTag.bypass_mode + // @description + // Returns whether a player can build on islands that they are not a part of. + // --> + PlayerTag.tagProcessor.registerTag(ElementTag.class, "bypass_mode", (attribute, player) -> { + return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasBypassModeEnabled()); + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism PlayerTag.disbands + // @description + // Returns the amount of disbands a player has left. + // --> + PlayerTag.tagProcessor.registerTag(ElementTag.class, "disbands", (attribute, player) -> { + return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).getDisbands()); + }); + + // <--[tag] + // @attribute + // @returns SuperiorSkyblockIslandTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the island a player belongs to, if any. + // --> + PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "island", (attribute, player) -> { + Island island = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getIsland(); + if (island != null) { + return new SuperiorSkyblockIslandTag(island); + } + return null; + }); + + // <--[tag] + // @attribute + // @returns ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the role a player has on an island, if any. + // --> + PlayerTag.tagProcessor.registerTag(ElementTag.class, "island_role", (attribute, player) -> { + PlayerRole role = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getPlayerRole(); + if (role != null) { + return new ElementTag(role.getName(), true); + } + return null; + }); + + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism PlayerTag.spy_mode + // @description + // Returns whether a player can see team chat from all islands. + // --> + PlayerTag.tagProcessor.registerTag(ElementTag.class, "spy_mode", (attribute, player) -> { + return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasAdminSpyEnabled()); + }); + + // <--[mechanism] + // @object PlayerTag + // @name bypass_mode + // @input ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes whether a player can build on islands that are not a part of. + // @tags + // + // --> + PlayerTag.registerOnlineOnlyMechanism("bypass_mode", ElementTag.class, (player, mechanism, value) -> { + if (mechanism.requireBoolean()) { + SuperiorSkyblockAPI.getPlayer(player.getUUID()).setBypassMode(mechanism.getValue().asBoolean()); + } + }); + + // <--[mechanism] + // @object PlayerTag + // @name disbands + // @input ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes how many disbands a player can use. + // @tags + // + // --> + PlayerTag.registerOnlineOnlyMechanism("disbands", ElementTag.class, (player, mechanism, value) -> { + if (mechanism.requireInteger()) { + SuperiorSkyblockAPI.getPlayer(player.getUUID()).setDisbands(mechanism.getValue().asInt()); + } + }); + + // <--[mechanism] + // @object PlayerTag + // @name spy_mode + // @input ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes whether a player can see team chats from all islands. + // @tags + // + // --> + PlayerTag.registerOnlineOnlyMechanism("spy_mode", ElementTag.class, (player, mechanism, value) -> { + if (mechanism.requireBoolean()) { + SuperiorSkyblockAPI.getPlayer(player.getUUID()).setAdminSpy(mechanism.getValue().asBoolean()); + } + }); + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b8fac5c72..ff6df9deb 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -41,6 +41,7 @@ softdepend: - Sentinel - Shopkeepers - SkillAPI + - SuperiorSkyblock2 - TerrainControl - Towny - TownyChat From 77713ede4351eefb4774df28cf7dbc4d447d024f Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Fri, 9 May 2025 20:47:45 -0700 Subject: [PATCH 02/25] plugin identifier added --- .../bridges/SuperiorSkyblockBridge.java | 4 +- .../SuperiorSkyblockIslandTag.java | 16 +++---- .../SuperiorSkyblockPlayerExtensions.java | 44 +++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java index 8f16eedac..9319b53e1 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java @@ -18,13 +18,13 @@ public void init() { ObjectFetcher.registerWithObjectFetcher(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.tagProcessor); // <--[tag] - // @attribute ]> + // @attribute ]> // @returns SuperiorSkyblockIslandTag // @plugin Depenizen, SuperiorSkyblock // @description // Returns the superiorskyblock island tag with the given name. // --> - TagManager.registerTagHandler(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.class, "island", (attribute, param) -> { + TagManager.registerTagHandler(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, param) -> { return param; }); } diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index cf1b806d3..f6db84f36 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -18,11 +18,11 @@ public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { // <--[ObjectType] // @name SuperiorSkyblockIslandTag - // @prefix island + // @prefix superiorskyblock_island // @base ElementTag // @format // The identity format for group is - // For example, 'island@denizen_scripters'. + // For example, 'superiorskyblock_island@denizen_scripters'. // // @plugin Depenizen, SuperiorSkyblock // @description @@ -30,10 +30,10 @@ public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { // // --> - @Fetchable("island") + @Fetchable("superiorskyblock_island") public static SuperiorSkyblockIslandTag valueOf(String string, TagContext context) { - if (string.startsWith("island@")) { - string = string.substring(7); + if (string.startsWith("superiorskyblock_island@")) { + string = string.substring("superiorskyblock_island@".length()); } Island island = SuperiorSkyblockAPI.getIsland(string); if (island == null) { @@ -43,7 +43,7 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } public static boolean matches(String string) { - string = string.replace("island@", ""); + string = string.replace("superiorskyblock_island@", ""); return SuperiorSkyblockAPI.getIsland(string) != null; } @@ -73,7 +73,7 @@ public boolean isUnique() { @Override public String identify() { - return "island@" + island.getName(); + return "superiorskyblock_island@" + island.getName(); } @Override @@ -359,7 +359,7 @@ public static void register() { // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { - if (!mechanism.getValue().asString().isEmpty()) { + if (!mechanism.getValue().asString().isEmpty() && SuperiorSkyblockAPI.getIsland(mechanism.getValue().asString()) != null) { object.getIsland().setName(mechanism.getValue().toString()); } }); diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index 8a87c5d8a..bdd144732 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -18,37 +18,37 @@ public SuperiorSkyblockPlayerExtensions(PlayerTag player) { public static void register() { // <--[tag] - // @attribute + // @attribute // @returns ElementTag(Boolean) // @plugin Depenizen, SuperiorSkyblock - // @mechanism PlayerTag.bypass_mode + // @mechanism PlayerTag.superiorskyblock_bypass_mode // @description // Returns whether a player can build on islands that they are not a part of. // --> - PlayerTag.tagProcessor.registerTag(ElementTag.class, "bypass_mode", (attribute, player) -> { + PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_bypass_mode", (attribute, player) -> { return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasBypassModeEnabled()); }); // <--[tag] - // @attribute + // @attribute // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock - // @mechanism PlayerTag.disbands + // @mechanism PlayerTag.superiorskyblock_disbands // @description // Returns the amount of disbands a player has left. // --> - PlayerTag.tagProcessor.registerTag(ElementTag.class, "disbands", (attribute, player) -> { + PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_disbands", (attribute, player) -> { return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).getDisbands()); }); // <--[tag] - // @attribute + // @attribute // @returns SuperiorSkyblockIslandTag // @plugin Depenizen, SuperiorSkyblock // @description // Returns the island a player belongs to, if any. // --> - PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "island", (attribute, player) -> { + PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, player) -> { Island island = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getIsland(); if (island != null) { return new SuperiorSkyblockIslandTag(island); @@ -57,13 +57,13 @@ public static void register() { }); // <--[tag] - // @attribute + // @attribute // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock // @description // Returns the role a player has on an island, if any. // --> - PlayerTag.tagProcessor.registerTag(ElementTag.class, "island_role", (attribute, player) -> { + PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_island_role", (attribute, player) -> { PlayerRole role = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getPlayerRole(); if (role != null) { return new ElementTag(role.getName(), true); @@ -72,28 +72,28 @@ public static void register() { }); // <--[tag] - // @attribute + // @attribute // @returns ElementTag(Boolean) // @plugin Depenizen, SuperiorSkyblock - // @mechanism PlayerTag.spy_mode + // @mechanism PlayerTag.superiorskyblock_spy_mode // @description // Returns whether a player can see team chat from all islands. // --> - PlayerTag.tagProcessor.registerTag(ElementTag.class, "spy_mode", (attribute, player) -> { + PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_spy_mode", (attribute, player) -> { return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasAdminSpyEnabled()); }); // <--[mechanism] // @object PlayerTag - // @name bypass_mode + // @name superiorskyblock_bypass_mode // @input ElementTag(Boolean) // @plugin Depenizen, SuperiorSkyblock // @description // Changes whether a player can build on islands that are not a part of. // @tags - // + // // --> - PlayerTag.registerOnlineOnlyMechanism("bypass_mode", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_bypass_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { SuperiorSkyblockAPI.getPlayer(player.getUUID()).setBypassMode(mechanism.getValue().asBoolean()); } @@ -101,15 +101,15 @@ public static void register() { // <--[mechanism] // @object PlayerTag - // @name disbands + // @name superiorskyblock_disbands // @input ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @description // Changes how many disbands a player can use. // @tags - // + // // --> - PlayerTag.registerOnlineOnlyMechanism("disbands", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_disbands", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireInteger()) { SuperiorSkyblockAPI.getPlayer(player.getUUID()).setDisbands(mechanism.getValue().asInt()); } @@ -117,15 +117,15 @@ public static void register() { // <--[mechanism] // @object PlayerTag - // @name spy_mode + // @name superiorskyblock_spy_mode // @input ElementTag(Boolean) // @plugin Depenizen, SuperiorSkyblock // @description // Changes whether a player can see team chats from all islands. // @tags - // + // // --> - PlayerTag.registerOnlineOnlyMechanism("spy_mode", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_spy_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { SuperiorSkyblockAPI.getPlayer(player.getUUID()).setAdminSpy(mechanism.getValue().asBoolean()); } From d3988fabe3611be229dcf4021748432e0b3dba4c Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sat, 10 May 2025 10:58:00 -0700 Subject: [PATCH 03/25] helper method added --- .../SuperiorSkyblockPlayerExtensions.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index bdd144732..09f9600d8 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -3,6 +3,7 @@ import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; import com.bgsoftware.superiorskyblock.api.island.Island; import com.bgsoftware.superiorskyblock.api.island.PlayerRole; +import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; import com.denizenscript.denizen.objects.PlayerTag; import com.denizenscript.denizencore.objects.core.ElementTag; import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; @@ -15,6 +16,10 @@ public SuperiorSkyblockPlayerExtensions(PlayerTag player) { PlayerTag player; + public static SuperiorPlayer getSuperiorPlayer(PlayerTag player) { + return SuperiorSkyblockAPI.getPlayer(player.getUUID()); + } + public static void register() { // <--[tag] @@ -26,7 +31,7 @@ public static void register() { // Returns whether a player can build on islands that they are not a part of. // --> PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_bypass_mode", (attribute, player) -> { - return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasBypassModeEnabled()); + return new ElementTag(getSuperiorPlayer(player).hasBypassModeEnabled()); }); // <--[tag] @@ -38,7 +43,7 @@ public static void register() { // Returns the amount of disbands a player has left. // --> PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_disbands", (attribute, player) -> { - return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).getDisbands()); + return new ElementTag(getSuperiorPlayer(player).getDisbands()); }); // <--[tag] @@ -49,7 +54,7 @@ public static void register() { // Returns the island a player belongs to, if any. // --> PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, player) -> { - Island island = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getIsland(); + Island island = getSuperiorPlayer(player).getIsland(); if (island != null) { return new SuperiorSkyblockIslandTag(island); } @@ -64,7 +69,7 @@ public static void register() { // Returns the role a player has on an island, if any. // --> PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_island_role", (attribute, player) -> { - PlayerRole role = SuperiorSkyblockAPI.getPlayer(player.getUUID()).getPlayerRole(); + PlayerRole role = getSuperiorPlayer(player).getPlayerRole(); if (role != null) { return new ElementTag(role.getName(), true); } @@ -80,7 +85,7 @@ public static void register() { // Returns whether a player can see team chat from all islands. // --> PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_spy_mode", (attribute, player) -> { - return new ElementTag(SuperiorSkyblockAPI.getPlayer(player.getUUID()).hasAdminSpyEnabled()); + return new ElementTag(getSuperiorPlayer(player).hasAdminSpyEnabled()); }); // <--[mechanism] @@ -95,7 +100,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_bypass_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { - SuperiorSkyblockAPI.getPlayer(player.getUUID()).setBypassMode(mechanism.getValue().asBoolean()); + getSuperiorPlayer(player).setBypassMode(mechanism.getValue().asBoolean()); } }); @@ -111,7 +116,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_disbands", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireInteger()) { - SuperiorSkyblockAPI.getPlayer(player.getUUID()).setDisbands(mechanism.getValue().asInt()); + getSuperiorPlayer(player).setDisbands(mechanism.getValue().asInt()); } }); @@ -127,7 +132,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_spy_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { - SuperiorSkyblockAPI.getPlayer(player.getUUID()).setAdminSpy(mechanism.getValue().asBoolean()); + getSuperiorPlayer(player).setAdminSpy(mechanism.getValue().asBoolean()); } }); } From 082a86ef32d497f58acc30370bfd06cb287e1e6d Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sat, 10 May 2025 11:01:42 -0700 Subject: [PATCH 04/25] -_- --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index f6db84f36..7b02faff7 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -359,7 +359,7 @@ public static void register() { // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { - if (!mechanism.getValue().asString().isEmpty() && SuperiorSkyblockAPI.getIsland(mechanism.getValue().asString()) != null) { + if (!mechanism.getValue().asString().isEmpty() && SuperiorSkyblockAPI.getIsland(mechanism.getValue().asString()) == null) { object.getIsland().setName(mechanism.getValue().toString()); } }); From 1be5361599d5e14a8cd551bc88e1c888b3717258 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sat, 10 May 2025 13:45:30 -0700 Subject: [PATCH 05/25] - mechanism.getValue() -> value - mechanism.echoError additions --- .../SuperiorSkyblockIslandTag.java | 26 +++++++++++++------ .../SuperiorSkyblockPlayerExtensions.java | 6 ++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 7b02faff7..2ca83189c 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -314,7 +314,7 @@ public static void register() { // --> tagProcessor.registerMechanism("balance", false, ElementTag.class, (object, mechanism, value) -> { if (mechanism.requireDouble()) { - object.getIsland().getIslandBank().setBalance(mechanism.getValue().asBigDecimal()); + object.getIsland().getIslandBank().setBalance(value.asBigDecimal()); } }); @@ -329,7 +329,7 @@ public static void register() { // // --> tagProcessor.registerMechanism("description", false, ElementTag.class, (object, mechanism, value) -> { - object.getIsland().setDescription(mechanism.getValue().asString()); + object.getIsland().setDescription(value.asString()); }); // <--[mechanism] @@ -344,7 +344,7 @@ public static void register() { // --> tagProcessor.registerMechanism("locked", false, ElementTag.class, (object, mechanism, value) -> { if (mechanism.requireBoolean()) { - object.getIsland().setLocked(mechanism.getValue().asBoolean()); + object.getIsland().setLocked(value.asBoolean()); } }); @@ -354,13 +354,18 @@ public static void register() { // @input ElementTag // @plugin Depenizen, SuperiorSkyblock // @description - // Changes an island's name. + // Changes an island's name. Multiple islands cannot have the same name. // @tags // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { - if (!mechanism.getValue().asString().isEmpty() && SuperiorSkyblockAPI.getIsland(mechanism.getValue().asString()) == null) { - object.getIsland().setName(mechanism.getValue().toString()); + if (!mechanism.getValue().asString().isEmpty()) { + if (SuperiorSkyblockAPI.getIsland(value.asString()) == null) { + object.getIsland().setName(value.toString()); + } + else { + mechanism.echoError("There is already an island with the name '" + value.asString() + "'."); + } } }); @@ -375,8 +380,13 @@ public static void register() { // // --> tagProcessor.registerMechanism("size", false, ElementTag.class, (object, mechanism, value) -> { - if (mechanism.requireInteger() && mechanism.getValue().asInt() >= 1) { - object.getIsland().setIslandSize(mechanism.getValue().asInt()); + if (mechanism.requireInteger()) { + if (value.asInt() >= 1) { + object.getIsland().setIslandSize(value.asInt()); + } + else { + mechanism.echoError("Island size must be a positive integer."); + } } }); } diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index 09f9600d8..e407a340b 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -100,7 +100,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_bypass_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { - getSuperiorPlayer(player).setBypassMode(mechanism.getValue().asBoolean()); + getSuperiorPlayer(player).setBypassMode(value.asBoolean()); } }); @@ -116,7 +116,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_disbands", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireInteger()) { - getSuperiorPlayer(player).setDisbands(mechanism.getValue().asInt()); + getSuperiorPlayer(player).setDisbands(value.asInt()); } }); @@ -132,7 +132,7 @@ public static void register() { // --> PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_spy_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { - getSuperiorPlayer(player).setAdminSpy(mechanism.getValue().asBoolean()); + getSuperiorPlayer(player).setAdminSpy(value.asBoolean()); } }); } From a96c4e140fdadd726a909ca86ad4086313541d22 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sat, 10 May 2025 22:27:18 -0700 Subject: [PATCH 06/25] Added `LocationTag.superiorskyblock_island` to get island at the provided location --- .../bridges/SuperiorSkyblockBridge.java | 3 ++- .../SuperiorSkyblockLocationExtensions.java | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java index 9319b53e1..3bcb227d8 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java @@ -6,7 +6,7 @@ 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; +import com.denizenscript.depenizen.bukkit.properties.superiorskyblock.*; public class SuperiorSkyblockBridge extends Bridge { @@ -14,6 +14,7 @@ public class SuperiorSkyblockBridge extends Bridge { public void init() { ScriptEvent.registerScriptEvent(SuperiorSkyblockIslandCreatedScriptEvent.class); ScriptEvent.registerScriptEvent(SuperiorSkyblockIslandDisbandedScriptEvent.class); + SuperiorSkyblockLocationExtensions.register(); SuperiorSkyblockPlayerExtensions.register(); ObjectFetcher.registerWithObjectFetcher(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.tagProcessor); diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java new file mode 100644 index 000000000..8304a0717 --- /dev/null +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java @@ -0,0 +1,27 @@ +package com.denizenscript.depenizen.bukkit.properties.superiorskyblock; + +import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; +import com.bgsoftware.superiorskyblock.api.island.Island; +import com.denizenscript.denizen.objects.LocationTag; +import com.denizenscript.depenizen.bukkit.objects.superiorskyblock.SuperiorSkyblockIslandTag; + +public class SuperiorSkyblockLocationExtensions { + + public static void register() { + + // <--[tag] + // @attribute + // @returns SuperiorSkyblockIslandTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the island that is at the provided location, if any. + // --> + LocationTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, location) -> { + Island island = SuperiorSkyblockAPI.getIslandAt(location); + if (island != null) { + return new SuperiorSkyblockIslandTag(island); + } + return null; + }); + } +} From fb1e0eae370d1fa3b4a0091b80c9184378f54168 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 14 May 2025 08:54:56 -0700 Subject: [PATCH 07/25] fixed empty check --- .../SuperiorSkyblockIslandTag.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 2ca83189c..c36abfb89 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -359,13 +359,14 @@ public static void register() { // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { - if (!mechanism.getValue().asString().isEmpty()) { - if (SuperiorSkyblockAPI.getIsland(value.asString()) == null) { - object.getIsland().setName(value.toString()); - } - else { - mechanism.echoError("There is already an island with the name '" + value.asString() + "'."); - } + if (mechanism.getValue().asString().isEmpty()) { + mechanism.echoError("You cannot have an island with no name."); + } + else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { + mechanism.echoError("There is already an island with the name '" + value.asString() + "'."); + } + else { + object.getIsland().setName(value.toString()); } }); From 826bdf7323dcf1cbe1c5a9c72874188d04939016 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Thu, 15 May 2025 11:54:06 -0700 Subject: [PATCH 08/25] aya update --- .../bridges/SuperiorSkyblockBridge.java | 5 +- ...eriorSkyblockIslandCreatedScriptEvent.java | 10 ++- .../SuperiorSkyblockIslandTag.java | 68 ++++++++++++------- .../SuperiorSkyblockPlayerExtensions.java | 2 +- 4 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java index 3bcb227d8..1a9b4b802 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/bridges/SuperiorSkyblockBridge.java @@ -19,11 +19,12 @@ public void init() { ObjectFetcher.registerWithObjectFetcher(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.tagProcessor); // <--[tag] - // @attribute ]> + // @attribute ]> // @returns SuperiorSkyblockIslandTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the superiorskyblock island tag with the given name. + // Returns the superiorskyblock island tag with the given uuid. + // Refer to <@link objecttype SuperiorSkyblockIslandTag> for more information. // --> TagManager.registerTagHandler(SuperiorSkyblockIslandTag.class, SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, param) -> { return param; diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java index 215c1cf51..5a93c3097 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/events/superiorskyblock/SuperiorSkyblockIslandCreatedScriptEvent.java @@ -24,7 +24,7 @@ public class SuperiorSkyblockIslandCreatedScriptEvent extends BukkitScriptEvent // returns a SuperiorSkyblockIslandTag of the island. // // @Determine - // "NAME:" to change the name of the island. + // "TELEPORT:" to set whether the player will automatically teleport to the island once it's generated. // // @Plugin Depenizen, SuperiorSkyblock // @@ -36,8 +36,12 @@ public class SuperiorSkyblockIslandCreatedScriptEvent extends BukkitScriptEvent public SuperiorSkyblockIslandCreatedScriptEvent() { registerCouldMatcher("superiorskyblock island created"); - this.registerDetermination("name", ElementTag.class, (evt, context, name) -> { - evt.event.getIsland().setName(name.asString()); + this.registerOptionalDetermination("teleport", ElementTag.class, (evt, context, value) -> { + if (value.isBoolean()) { + evt.event.setTeleport(value.asBoolean()); + return true; + } + return false; }); } diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index c36abfb89..cd9085887 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -13,6 +13,10 @@ import com.denizenscript.denizencore.tags.Attribute; import com.denizenscript.denizencore.tags.ObjectTagProcessor; import com.denizenscript.denizencore.tags.TagContext; +import com.denizenscript.denizencore.utilities.CoreUtilities; +import com.denizenscript.denizencore.utilities.debugging.Debug; + +import java.util.UUID; public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { @@ -21,8 +25,8 @@ public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { // @prefix superiorskyblock_island // @base ElementTag // @format - // The identity format for group is - // For example, 'superiorskyblock_island@denizen_scripters'. + // The identity format is . + // For example, 'superiorskyblock_island@460e96b9-7a0e-416d-b2c3-4508164b8b1b'. // // @plugin Depenizen, SuperiorSkyblock // @description @@ -35,16 +39,19 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex if (string.startsWith("superiorskyblock_island@")) { string = string.substring("superiorskyblock_island@".length()); } - Island island = SuperiorSkyblockAPI.getIsland(string); + Island island = SuperiorSkyblockAPI.getIslandByUUID(UUID.fromString(string)); if (island == null) { + Debug.echoError("No island with the uuid '" + string + "' exists."); return null; } return new SuperiorSkyblockIslandTag(island); } public static boolean matches(String string) { - string = string.replace("superiorskyblock_island@", ""); - return SuperiorSkyblockAPI.getIsland(string) != null; + if (string.startsWith("superiorskyblock_island@")) { + return true; + } + return valueOf(string, CoreUtilities.noDebugContext) != null; } public SuperiorSkyblockIslandTag(Island island) { @@ -73,7 +80,7 @@ public boolean isUnique() { @Override public String identify() { - return "superiorskyblock_island@" + island.getName(); + return "superiorskyblock_island@" + island.getUniqueId(); } @Override @@ -113,7 +120,7 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.balance // @description - // Returns the balance of the specified island. + // Returns the balance of this island. // --> tagProcessor.registerTag(ElementTag.class, "balance", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandBank().getBalance()); @@ -124,10 +131,10 @@ public static void register() { // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns a list of players banned on the specified island. + // Returns a list of players banned on this island. // --> tagProcessor.registerTag(ListTag.class, "banned_players", (attribute, object) -> { - return new ListTag(object.getIsland().getBannedPlayers(), players -> new PlayerTag(players.asPlayer())); + return new ListTag(object.getIsland().getBannedPlayers(), player -> new PlayerTag(player.asPlayer())); }); // <--[tag] @@ -157,7 +164,7 @@ public static void register() { // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the coop members of the specified island, if any. + // Returns the coop members of this island. // --> tagProcessor.registerTag(ListTag.class, "coop_members", (attribute, object) -> { return new ListTag(object.getIsland().getCoopPlayers(), players -> new PlayerTag(players.asPlayer())); @@ -168,7 +175,7 @@ public static void register() { // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the players currently within the bounds of the specified island. + // Returns the players currently within the bounds of this island. // --> tagProcessor.registerTag(ListTag.class, "current_visitors", (attribute, object) -> { return new ListTag(object.getIsland().getAllPlayersInside(), players -> new PlayerTag(players.asPlayer())); @@ -179,10 +186,10 @@ public static void register() { // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the description of the specified island, if any. + // Returns the description of this island, if any. // --> tagProcessor.registerTag(ElementTag.class, "description", (attribute, object) -> { - return object.getIsland().getDescription().isBlank() ? null : new ElementTag(object.getIsland().getDescription(), true); + return new ElementTag(object.getIsland().getDescription(), true); }); // <--[tag] @@ -190,7 +197,7 @@ public static void register() { // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the level of the specified island. + // Returns the level of this island. // --> tagProcessor.registerTag(ElementTag.class, "level", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandLevel()); @@ -213,10 +220,10 @@ public static void register() { // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the members of the specified island, including the leader. + // Returns the members of this island, including the leader. // --> tagProcessor.registerTag(ListTag.class, "members", (attribute, object) -> { - return new ListTag(object.getIsland().getIslandMembers(true), players -> new PlayerTag(players.asPlayer())); + return new ListTag(object.getIsland().getIslandMembers(true), player -> new PlayerTag(player.asPlayer())); }); // <--[tag] @@ -225,7 +232,7 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.name // @description - // Returns the name of the specified island. + // Returns the name of this island. // --> tagProcessor.registerTag(ElementTag.class, "name", (attribute, object) -> { return new ElementTag(object.getIsland().getName(), true); @@ -236,7 +243,7 @@ public static void register() { // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the net worth of the specified island. Includes money in the bank. + // Returns the net worth of this island. Includes money in the bank. // --> tagProcessor.registerTag(ElementTag.class, "net_worth", (attribute, object) -> { return new ElementTag(object.getIsland().getWorth()); @@ -247,7 +254,7 @@ public static void register() { // @returns PlayerTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the owner of the specified island. + // Returns the owner of this island. // --> tagProcessor.registerTag(PlayerTag.class, "owner", (attribute, object) -> { return new PlayerTag(object.getIsland().getOwner().asPlayer()); @@ -258,7 +265,7 @@ public static void register() { // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the rating a player gave the specified island, if any. + // Returns the rating a player gave an island, if any. // --> tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); @@ -273,7 +280,7 @@ public static void register() { // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the schematic used to create the specified island. + // Returns the schematic used to create an island. // --> tagProcessor.registerTag(ElementTag.class, "schematic", (attribute, object) -> { return new ElementTag(object.getIsland().getSchematicName(), true); @@ -285,7 +292,7 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.size // @description - // Returns the size of the specified island. + // Returns the size of this island. // --> tagProcessor.registerTag(ElementTag.class, "size", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandSize()); @@ -296,12 +303,23 @@ public static void register() { // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the current average rating of the specified island. + // Returns the current average rating of an island. // --> tagProcessor.registerTag(ElementTag.class, "total_rating", (attribute, object) -> { return new ElementTag(object.getIsland().getTotalRating()); }); + // <--[tag] + // @attribute + // @returns ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the uuid of an island. + // --> + tagProcessor.registerTag(ElementTag.class, "uuid", (attribute, object) -> { + return new ElementTag(object.getIsland().getUniqueId().toString()); + }); + // <--[mechanism] // @object SuperiorSkyblockIslandTag // @name balance @@ -359,11 +377,11 @@ public static void register() { // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { - if (mechanism.getValue().asString().isEmpty()) { + if (value.asString().isEmpty()) { mechanism.echoError("You cannot have an island with no name."); } else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { - mechanism.echoError("There is already an island with the name '" + value.asString() + "'."); + mechanism.echoError("There is already an island with the name '" + value + "'."); } else { object.getIsland().setName(value.toString()); diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index e407a340b..601a40822 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -94,7 +94,7 @@ public static void register() { // @input ElementTag(Boolean) // @plugin Depenizen, SuperiorSkyblock // @description - // Changes whether a player can build on islands that are not a part of. + // Changes whether a player can build on islands they are not a part of. // @tags // // --> From 2faa8fcf0da96a94a99bcdb9dfd30bac929e361d Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Fri, 16 May 2025 09:09:48 -0700 Subject: [PATCH 09/25] meta update --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index cd9085887..dc6953191 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -186,7 +186,7 @@ public static void register() { // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the description of this island, if any. + // Returns the description of this island. This may be empty if an island does not have one set. // --> tagProcessor.registerTag(ElementTag.class, "description", (attribute, object) -> { return new ElementTag(object.getIsland().getDescription(), true); From 245f6ef56bff2d5cbe924bdceb174a3b27047661 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 28 May 2025 20:49:19 -0700 Subject: [PATCH 10/25] preventing spawn islands from having mechanisms adjusted and tags resulting in errors --- .../SuperiorSkyblockIslandTag.java | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index dc6953191..0fab2d7e3 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -123,6 +123,10 @@ public static void register() { // Returns the balance of this island. // --> tagProcessor.registerTag(ElementTag.class, "balance", (attribute, object) -> { + if (object.getIsland().isSpawn()) { + Debug.echoError("Spawn islands cannot have a balance."); + return null; + } return new ElementTag(object.getIsland().getIslandBank().getBalance()); }); @@ -257,6 +261,10 @@ public static void register() { // Returns the owner of this island. // --> tagProcessor.registerTag(PlayerTag.class, "owner", (attribute, object) -> { + if (object.getIsland().isSpawn()) { + Debug.echoError("Spawn islands do not have an owner."); + return null; + } return new PlayerTag(object.getIsland().getOwner().asPlayer()); }); @@ -265,7 +273,7 @@ public static void register() { // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the rating a player gave an island, if any. + // Returns the rating a player gave an island, or 'null' if the player hasn't. // --> tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); @@ -292,7 +300,7 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.size // @description - // Returns the size of this island. + // Returns the world border width of the island. // --> tagProcessor.registerTag(ElementTag.class, "size", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandSize()); @@ -317,7 +325,7 @@ public static void register() { // Returns the uuid of an island. // --> tagProcessor.registerTag(ElementTag.class, "uuid", (attribute, object) -> { - return new ElementTag(object.getIsland().getUniqueId().toString()); + return new ElementTag(object.getIsland().getUniqueId().toString(), true); }); // <--[mechanism] @@ -331,6 +339,10 @@ public static void register() { // // --> tagProcessor.registerMechanism("balance", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a balance."); + return; + } if (mechanism.requireDouble()) { object.getIsland().getIslandBank().setBalance(value.asBigDecimal()); } @@ -347,6 +359,10 @@ public static void register() { // // --> tagProcessor.registerMechanism("description", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a description."); + return; + } object.getIsland().setDescription(value.asString()); }); @@ -361,6 +377,10 @@ public static void register() { // // --> tagProcessor.registerMechanism("locked", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot be locked."); + return; + } if (mechanism.requireBoolean()) { object.getIsland().setLocked(value.asBoolean()); } @@ -377,6 +397,10 @@ public static void register() { // // --> tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a name."); + return; + } if (value.asString().isEmpty()) { mechanism.echoError("You cannot have an island with no name."); } @@ -399,6 +423,10 @@ else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { // // --> tagProcessor.registerMechanism("size", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have their size adjusted."); + return; + } if (mechanism.requireInteger()) { if (value.asInt() >= 1) { object.getIsland().setIslandSize(value.asInt()); From ba6626249c5ffb2853dc39db0a1fa4791c4c0682 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 28 May 2025 21:00:26 -0700 Subject: [PATCH 11/25] adjusted being able to input spawn uuid in the raw superiorskyblockislandtag, slight meta clarification --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 0fab2d7e3..6e302895f 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -39,7 +39,7 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex if (string.startsWith("superiorskyblock_island@")) { string = string.substring("superiorskyblock_island@".length()); } - Island island = SuperiorSkyblockAPI.getIslandByUUID(UUID.fromString(string)); + Island island = string.equals("00000000-0000-0000-0000-000000000000") ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(UUID.fromString(string)); if (island == null) { Debug.echoError("No island with the uuid '" + string + "' exists."); return null; @@ -273,7 +273,7 @@ public static void register() { // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the rating a player gave an island, or 'null' if the player hasn't. + // Returns the rating a player gave an island, or 'null' if the player hasn't given one. // --> tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); From 8d2e3c407e3b9a53f526c57b94f7064d96892e5a Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Fri, 30 May 2025 09:58:39 -0700 Subject: [PATCH 12/25] attribute --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 6e302895f..11647f6b0 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -124,7 +124,7 @@ public static void register() { // --> tagProcessor.registerTag(ElementTag.class, "balance", (attribute, object) -> { if (object.getIsland().isSpawn()) { - Debug.echoError("Spawn islands cannot have a balance."); + attribute.echoError("Spawn islands cannot have a balance."); return null; } return new ElementTag(object.getIsland().getIslandBank().getBalance()); @@ -262,7 +262,7 @@ public static void register() { // --> tagProcessor.registerTag(PlayerTag.class, "owner", (attribute, object) -> { if (object.getIsland().isSpawn()) { - Debug.echoError("Spawn islands do not have an owner."); + attribute.echoError("Spawn islands do not have an owner."); return null; } return new PlayerTag(object.getIsland().getOwner().asPlayer()); From cd7d7b0722758ec178b0e61287cf5c9a3a95d424 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 18 Jun 2025 07:24:41 -0700 Subject: [PATCH 13/25] core tag changes, couple tag changes, and slight meta change --- .../SuperiorSkyblockIslandTag.java | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 11647f6b0..6700afccc 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -39,12 +39,24 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex if (string.startsWith("superiorskyblock_island@")) { string = string.substring("superiorskyblock_island@".length()); } - Island island = string.equals("00000000-0000-0000-0000-000000000000") ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(UUID.fromString(string)); - if (island == null) { - Debug.echoError("No island with the uuid '" + string + "' exists."); + try { + UUID uuid = UUID.fromString(string); + UUID spawnUUID = UUID.fromString("00000000-0000-0000-0000-000000000000"); + Island island = uuid.equals(spawnUUID) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); + if (island == null) { + if (context == null || context.showErrors()) { + Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); + } + return null; + } + return new SuperiorSkyblockIslandTag(island); + } + catch (IllegalArgumentException e) { + if (context == null || context.showErrors()) { + Debug.echoError("SuperiorSkyblockIslandTag returning null: Invalid UUID '" + string + "' specified."); + } return null; } - return new SuperiorSkyblockIslandTag(island); } public static boolean matches(String string) { @@ -114,6 +126,17 @@ public Island getIsland() { public static void register() { + // <--[tag] + // @attribute + // @returns ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the current average rating of an island. + // --> + tagProcessor.registerTag(ElementTag.class, "average_rating", (attribute, object) -> { + return new ElementTag(object.getIsland().getTotalRating()); + }); + // <--[tag] // @attribute // @returns ElementTag(Decimal) @@ -196,6 +219,17 @@ public static void register() { return new ElementTag(object.getIsland().getDescription(), true); }); + // <--[tag] + // @attribute + // @returns ElementTag(Boolean) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns whether this is the spawn island. + // --> + tagProcessor.registerTag(ElementTag.class, "is_spawn_island", (attribute, object) -> { + return new ElementTag(object.getIsland().isSpawn()); + }); + // <--[tag] // @attribute // @returns ElementTag(Decimal) @@ -224,7 +258,7 @@ public static void register() { // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the members of this island, including the leader. + // Returns the members of this island, including the owner. // --> tagProcessor.registerTag(ListTag.class, "members", (attribute, object) -> { return new ListTag(object.getIsland().getIslandMembers(true), player -> new PlayerTag(player.asPlayer())); @@ -306,17 +340,6 @@ public static void register() { return new ElementTag(object.getIsland().getIslandSize()); }); - // <--[tag] - // @attribute - // @returns ElementTag(Decimal) - // @plugin Depenizen, SuperiorSkyblock - // @description - // Returns the current average rating of an island. - // --> - tagProcessor.registerTag(ElementTag.class, "total_rating", (attribute, object) -> { - return new ElementTag(object.getIsland().getTotalRating()); - }); - // <--[tag] // @attribute // @returns ElementTag From 4dc2a71d63f6a9565a5355a849163a614d55aa83 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 18 Jun 2025 07:34:31 -0700 Subject: [PATCH 14/25] removed special spawn island handling --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 6700afccc..607e5468c 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -41,8 +41,7 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } try { UUID uuid = UUID.fromString(string); - UUID spawnUUID = UUID.fromString("00000000-0000-0000-0000-000000000000"); - Island island = uuid.equals(spawnUUID) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); + Island island = SuperiorSkyblockAPI.getIslandByUUID(uuid); if (island == null) { if (context == null || context.showErrors()) { Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); From c34f2b15f0546e04384c7d8f3d8ca79199c8aa40 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Wed, 18 Jun 2025 17:30:05 -0700 Subject: [PATCH 15/25] revert previous commit --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 607e5468c..6700afccc 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -41,7 +41,8 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } try { UUID uuid = UUID.fromString(string); - Island island = SuperiorSkyblockAPI.getIslandByUUID(uuid); + UUID spawnUUID = UUID.fromString("00000000-0000-0000-0000-000000000000"); + Island island = uuid.equals(spawnUUID) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); if (island == null) { if (context == null || context.showErrors()) { Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); From 2c99ea361f3260ba7e33c647da443270328839cd Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Thu, 10 Jul 2025 11:38:53 -0700 Subject: [PATCH 16/25] removed redundant section and moved uuid --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 5 +++-- .../superiorskyblock/SuperiorSkyblockPlayerExtensions.java | 6 ------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 6700afccc..2dacfc415 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -41,8 +41,7 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } try { UUID uuid = UUID.fromString(string); - UUID spawnUUID = UUID.fromString("00000000-0000-0000-0000-000000000000"); - Island island = uuid.equals(spawnUUID) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); + Island island = uuid.equals(spawnIsland) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); if (island == null) { if (context == null || context.showErrors()) { Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); @@ -59,6 +58,8 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } } + public static final UUID spawnIsland = UUID.fromString("00000000-0000-0000-0000-000000000000"); + public static boolean matches(String string) { if (string.startsWith("superiorskyblock_island@")) { return true; diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index 601a40822..eb5350d4d 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -10,12 +10,6 @@ public class SuperiorSkyblockPlayerExtensions { - public SuperiorSkyblockPlayerExtensions(PlayerTag player) { - this.player = player; - } - - PlayerTag player; - public static SuperiorPlayer getSuperiorPlayer(PlayerTag player) { return SuperiorSkyblockAPI.getPlayer(player.getUUID()); } From e3a283153dcf643aed44d743ea8fee0494e73168 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sat, 12 Jul 2025 19:53:58 -0700 Subject: [PATCH 17/25] shortened download link --- Docs/BukkitPlugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/BukkitPlugins.md b/Docs/BukkitPlugins.md index 89f793f33..477d9abe3 100644 --- a/Docs/BukkitPlugins.md +++ b/Docs/BukkitPlugins.md @@ -35,7 +35,7 @@ Supported Plugins: (And the sources we acquired Jar files from.) - Sentinel (https://www.spigotmc.org/resources/sentinel.22017/) - ShopKeepers (https://www.spigotmc.org/resources/shopkeepers.80756/) - SkillAPI (http://dev.bukkit.org/bukkit-plugins/skillapi/) -- SuperiorSkyblock2 (https://www.spigotmc.org/resources/⚡%EF%B8%8F-superiorskyblock2-⚡%EF%B8%8F-the-best-core-on-market-⚡%EF%B8%8F-1-21-5-support.87411) +- SuperiorSkyblock2 (https://www.spigotmc.org/resources/superiorskyblock2.87411/) - TerrainControl/OpenTerrainGenerator (https://github.com/PG85/OpenTerrainGenerator) - Towny (https://github.com/TownyAdvanced/Towny) - TownyChat (https://github.com/TownyAdvanced/Towny) From d08a232c9383099bef2950557cf414118908efb4 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Tue, 11 Nov 2025 19:47:49 -0800 Subject: [PATCH 18/25] pom bump --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0288a169d..94bb141ca 100644 --- a/pom.xml +++ b/pom.xml @@ -319,7 +319,7 @@ com.bgsoftware SuperiorSkyblock - 2025.1 + 2025.2 system ${basedir}/lib/SuperiorSkyblock2.jar From 65267ff2414bc8f846020488b658186bb59dcdee Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Tue, 11 Nov 2025 20:00:38 -0800 Subject: [PATCH 19/25] slight formatting changes --- .../SuperiorSkyblockIslandTag.java | 20 +++++++------------ .../SuperiorSkyblockLocationExtensions.java | 5 +---- .../SuperiorSkyblockPlayerExtensions.java | 10 ++-------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 2dacfc415..513ad241c 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -58,6 +58,7 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex } } + // Yes, this is the actual UUID that is associated with the spawn island. public static final UUID spawnIsland = UUID.fromString("00000000-0000-0000-0000-000000000000"); public static boolean matches(String string) { @@ -308,14 +309,11 @@ public static void register() { // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the rating a player gave an island, or 'null' if the player hasn't given one. + // Returns the rating a player gave an island, or null if the player hasn't given one. // --> tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); - if (rating.getValue() > -1) { - return new ElementTag(rating.getValue()); - } - return null; + return rating.getValue() > -1 ? new ElementTag(rating.getValue()) : null; }); // <--[tag] @@ -365,9 +363,8 @@ public static void register() { tagProcessor.registerMechanism("balance", false, ElementTag.class, (object, mechanism, value) -> { if (object.getIsland().isSpawn()) { mechanism.echoError("Spawn islands cannot have a balance."); - return; } - if (mechanism.requireDouble()) { + else if (mechanism.requireDouble()) { object.getIsland().getIslandBank().setBalance(value.asBigDecimal()); } }); @@ -403,9 +400,8 @@ public static void register() { tagProcessor.registerMechanism("locked", false, ElementTag.class, (object, mechanism, value) -> { if (object.getIsland().isSpawn()) { mechanism.echoError("Spawn islands cannot be locked."); - return; } - if (mechanism.requireBoolean()) { + else if (mechanism.requireBoolean()) { object.getIsland().setLocked(value.asBoolean()); } }); @@ -423,9 +419,8 @@ public static void register() { tagProcessor.registerMechanism("name", false, ElementTag.class, (object, mechanism, value) -> { if (object.getIsland().isSpawn()) { mechanism.echoError("Spawn islands cannot have a name."); - return; } - if (value.asString().isEmpty()) { + else if (value.asString().isEmpty()) { mechanism.echoError("You cannot have an island with no name."); } else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { @@ -449,9 +444,8 @@ else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { tagProcessor.registerMechanism("size", false, ElementTag.class, (object, mechanism, value) -> { if (object.getIsland().isSpawn()) { mechanism.echoError("Spawn islands cannot have their size adjusted."); - return; } - if (mechanism.requireInteger()) { + else if (mechanism.requireInteger()) { if (value.asInt() >= 1) { object.getIsland().setIslandSize(value.asInt()); } diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java index 8304a0717..2459d674f 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockLocationExtensions.java @@ -18,10 +18,7 @@ public static void register() { // --> LocationTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, location) -> { Island island = SuperiorSkyblockAPI.getIslandAt(location); - if (island != null) { - return new SuperiorSkyblockIslandTag(island); - } - return null; + return island != null ? new SuperiorSkyblockIslandTag(island) : null; }); } } diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index eb5350d4d..db996442f 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -49,10 +49,7 @@ public static void register() { // --> PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, player) -> { Island island = getSuperiorPlayer(player).getIsland(); - if (island != null) { - return new SuperiorSkyblockIslandTag(island); - } - return null; + return island != null ? new SuperiorSkyblockIslandTag(island) : null; }); // <--[tag] @@ -64,10 +61,7 @@ public static void register() { // --> PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_island_role", (attribute, player) -> { PlayerRole role = getSuperiorPlayer(player).getPlayerRole(); - if (role != null) { - return new ElementTag(role.getName(), true); - } - return null; + return role != null ? new ElementTag(role.getName(), true) : null; }); // <--[tag] From 22680ede296c7d26f6b2437cdca819e75929617d Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Thu, 13 Nov 2025 19:50:59 -0800 Subject: [PATCH 20/25] cosmetic change --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 513ad241c..892db9785 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -196,7 +196,7 @@ public static void register() { // Returns the coop members of this island. // --> tagProcessor.registerTag(ListTag.class, "coop_members", (attribute, object) -> { - return new ListTag(object.getIsland().getCoopPlayers(), players -> new PlayerTag(players.asPlayer())); + return new ListTag(object.getIsland().getCoopPlayers(), player -> new PlayerTag(player.asPlayer())); }); // <--[tag] @@ -207,7 +207,7 @@ public static void register() { // Returns the players currently within the bounds of this island. // --> tagProcessor.registerTag(ListTag.class, "current_visitors", (attribute, object) -> { - return new ListTag(object.getIsland().getAllPlayersInside(), players -> new PlayerTag(players.asPlayer())); + return new ListTag(object.getIsland().getAllPlayersInside(), player -> new PlayerTag(player.asPlayer())); }); // <--[tag] From 07f19b9072199a12be65dc1c4d536301fc8a5d2f Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sun, 21 Dec 2025 08:37:02 -0800 Subject: [PATCH 21/25] added a few more tags and mechanisms --- pom.xml | 2 +- .../SuperiorSkyblockIslandTag.java | 448 ++++++++++++++++-- .../SuperiorSkyblockPlayerExtensions.java | 43 +- 3 files changed, 441 insertions(+), 52 deletions(-) diff --git a/pom.xml b/pom.xml index 94bb141ca..c19e7dc02 100644 --- a/pom.xml +++ b/pom.xml @@ -319,7 +319,7 @@ com.bgsoftware SuperiorSkyblock - 2025.2 + 2025.2.1 system ${basedir}/lib/SuperiorSkyblock2.jar diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 892db9785..5945bdca1 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -1,21 +1,29 @@ package com.denizenscript.depenizen.bukkit.objects.superiorskyblock; +import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin; import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; +import com.bgsoftware.superiorskyblock.api.enums.MemberRemoveReason; import com.bgsoftware.superiorskyblock.api.enums.Rating; import com.bgsoftware.superiorskyblock.api.island.Island; -import com.denizenscript.denizen.objects.PlayerTag; -import com.denizenscript.denizencore.objects.Adjustable; -import com.denizenscript.denizencore.objects.Fetchable; -import com.denizenscript.denizencore.objects.Mechanism; -import com.denizenscript.denizencore.objects.ObjectTag; -import com.denizenscript.denizencore.objects.core.ElementTag; -import com.denizenscript.denizencore.objects.core.ListTag; +import com.bgsoftware.superiorskyblock.api.island.IslandFlag; +import com.bgsoftware.superiorskyblock.api.world.Dimension; +import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; +import com.denizenscript.denizen.objects.*; +import com.denizenscript.denizencore.objects.*; +import com.denizenscript.denizencore.objects.core.*; import com.denizenscript.denizencore.tags.Attribute; import com.denizenscript.denizencore.tags.ObjectTagProcessor; import com.denizenscript.denizencore.tags.TagContext; +import com.bgsoftware.superiorskyblock.api.wrappers.WorldPosition; import com.denizenscript.denizencore.utilities.CoreUtilities; import com.denizenscript.denizencore.utilities.debugging.Debug; +import com.denizenscript.denizencore.utilities.text.StringHolder; +import org.bukkit.Registry; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.Map; import java.util.UUID; public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { @@ -31,7 +39,6 @@ public class SuperiorSkyblockIslandTag implements ObjectTag, Adjustable { // @plugin Depenizen, SuperiorSkyblock // @description // A SuperiorSkyblockIslandTag represents a SuperiorSkyblock island. - // // --> @Fetchable("superiorskyblock_island") @@ -42,13 +49,13 @@ public static SuperiorSkyblockIslandTag valueOf(String string, TagContext contex try { UUID uuid = UUID.fromString(string); Island island = uuid.equals(spawnIsland) ? SuperiorSkyblockAPI.getSpawnIsland() : SuperiorSkyblockAPI.getIslandByUUID(uuid); - if (island == null) { - if (context == null || context.showErrors()) { - Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); - } - return null; + if (island != null) { + return new SuperiorSkyblockIslandTag(island); } - return new SuperiorSkyblockIslandTag(island); + if (context == null || context.showErrors()) { + Debug.echoError("SuperiorSkyblockIslandTag returning null: UUID '" + string + "' is valid, but doesn't match any island."); + } + return null; } catch (IllegalArgumentException e) { if (context == null || context.showErrors()) { @@ -126,6 +133,10 @@ public Island getIsland() { return island; } + public static SuperiorPlayer getSuperiorPlayer(PlayerTag player) { + return SuperiorSkyblockAPI.getPlayer(player.getUUID()); + } + public static void register() { // <--[tag] @@ -145,11 +156,11 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.balance // @description - // Returns the balance of this island. + // Returns the bank balance of an island. // --> tagProcessor.registerTag(ElementTag.class, "balance", (attribute, object) -> { if (object.getIsland().isSpawn()) { - attribute.echoError("Spawn islands cannot have a balance."); + attribute.echoError("Spawn islands do not have a balance."); return null; } return new ElementTag(object.getIsland().getIslandBank().getBalance()); @@ -159,17 +170,32 @@ public static void register() { // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @mechanism // @description - // Returns a list of players banned on this island. + // Returns the players banned on an island. // --> tagProcessor.registerTag(ListTag.class, "banned_players", (attribute, object) -> { return new ListTag(object.getIsland().getBannedPlayers(), player -> new PlayerTag(player.asPlayer())); }); + // <--[tag] + // @attribute + // @returns BiomeTag + // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @description + // Returns the current biome of an island. + // --> + tagProcessor.registerTag(BiomeTag.class, "biome", (attribute, object) -> { + return new BiomeTag(object.getIsland().getBiome()); + }); + // <--[tag] // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock + // @mechanism // @description // Returns the bonus level of an island. // --> @@ -181,6 +207,7 @@ public static void register() { // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock + // @mechanism // @description // Returns the bonus worth of an island. // --> @@ -188,23 +215,59 @@ public static void register() { return new ElementTag(object.getIsland().getBonusWorth()); }); + // <--[tag] + // @attribute ]> + // @returns LocationTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the center of an island in the provided dimension. + // Valid dimensions are NORMAL, NETHER, and THE_END. + // --> + tagProcessor.registerTag(LocationTag.class, ElementTag.class, "center", (attribute, object, value) -> { + return new LocationTag(object.getIsland().getCenter(Dimension.getByName(value.toString()))); + }); + // <--[tag] // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @mechanism // @description - // Returns the coop members of this island. + // Returns the coop members of an island. // --> tagProcessor.registerTag(ListTag.class, "coop_members", (attribute, object) -> { return new ListTag(object.getIsland().getCoopPlayers(), player -> new PlayerTag(player.asPlayer())); }); + // <--[tag] + // @attribute + // @returns TimeTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the time an island was created. + // --> + tagProcessor.registerTag(TimeTag.class, "creation_time", (attribute, object) -> { + return new TimeTag(LocalDateTime.parse(object.getIsland().getCreationTimeDate(), DateTimeFormatter.ofPattern(SuperiorSkyblockPlugin.getPlugin().getSettings().getDateFormat())).atZone(ZoneOffset.UTC)); + }); + + // <--[tag] + // @attribute + // @returns CuboidTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the boundaries of an island. + // --> + tagProcessor.registerTag(CuboidTag.class, "cuboid", (attribute, object) -> { + return new CuboidTag(object.getIsland().getMinimum(), object.getIsland().getMaximum()); + }); + // <--[tag] // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the players currently within the bounds of this island. + // Returns the players currently within the bounds of an island. // --> tagProcessor.registerTag(ListTag.class, "current_visitors", (attribute, object) -> { return new ListTag(object.getIsland().getAllPlayersInside(), player -> new PlayerTag(player.asPlayer())); @@ -215,12 +278,28 @@ public static void register() { // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the description of this island. This may be empty if an island does not have one set. + // Returns the description of an island. This may be empty if an island does not have one set. // --> tagProcessor.registerTag(ElementTag.class, "description", (attribute, object) -> { return new ElementTag(object.getIsland().getDescription(), true); }); + // <--[tag] + // @attribute + // @returns ListTag(LocationTag) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Returns the home locations of an island, with the "world" being the dimension. + // --> + tagProcessor.registerTag(ListTag.class, "homes", (attribute, object) -> { + ListTag values = new ListTag(); + for (Map.Entry map : object.getIsland().getIslandHomes().entrySet()) { + WorldPosition pos = map.getValue(); + values.addObject(new LocationTag(pos.getX(), pos.getY(), pos.getZ(), map.getKey().getName())); + } + return values; + }); + // <--[tag] // @attribute // @returns ElementTag(Boolean) @@ -232,12 +311,28 @@ public static void register() { return new ElementTag(object.getIsland().isSpawn()); }); + // <--[tag] + // @attribute + // @returns PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @description + // Returns the leader of an island. + // --> + tagProcessor.registerTag(PlayerTag.class, "leader", (attribute, object) -> { + if (object.getIsland().isSpawn()) { + attribute.echoError("Spawn islands do not have a leader."); + return null; + } + return new PlayerTag(object.getIsland().getOwner().asPlayer()); + }); + // <--[tag] // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the level of this island. + // Returns the level of an island. // --> tagProcessor.registerTag(ElementTag.class, "level", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandLevel()); @@ -259,8 +354,10 @@ public static void register() { // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @mechanism // @description - // Returns the members of this island, including the owner. + // Returns the members of an island, including the leader. // --> tagProcessor.registerTag(ListTag.class, "members", (attribute, object) -> { return new ListTag(object.getIsland().getIslandMembers(true), player -> new PlayerTag(player.asPlayer())); @@ -272,7 +369,7 @@ public static void register() { // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.name // @description - // Returns the name of this island. + // Returns the name of an island. // --> tagProcessor.registerTag(ElementTag.class, "name", (attribute, object) -> { return new ElementTag(object.getIsland().getName(), true); @@ -283,27 +380,12 @@ public static void register() { // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the net worth of this island. Includes money in the bank. + // Returns the net worth of an island. Includes money in the bank. // --> tagProcessor.registerTag(ElementTag.class, "net_worth", (attribute, object) -> { return new ElementTag(object.getIsland().getWorth()); }); - // <--[tag] - // @attribute - // @returns PlayerTag - // @plugin Depenizen, SuperiorSkyblock - // @description - // Returns the owner of this island. - // --> - tagProcessor.registerTag(PlayerTag.class, "owner", (attribute, object) -> { - if (object.getIsland().isSpawn()) { - attribute.echoError("Spawn islands do not have an owner."); - return null; - } - return new PlayerTag(object.getIsland().getOwner().asPlayer()); - }); - // <--[tag] // @attribute ]> // @returns ElementTag(Number) @@ -312,7 +394,7 @@ public static void register() { // Returns the rating a player gave an island, or null if the player hasn't given one. // --> tagProcessor.registerTag(ElementTag.class, PlayerTag.class, "rating", (attribute, object, player) -> { - Rating rating = object.getIsland().getRating(SuperiorSkyblockAPI.getPlayer(player.getUUID())); + Rating rating = object.getIsland().getRating(getSuperiorPlayer(player)); return rating.getValue() > -1 ? new ElementTag(rating.getValue()) : null; }); @@ -327,18 +409,46 @@ public static void register() { return new ElementTag(object.getIsland().getSchematicName(), true); }); + // <--[tag] + // @attribute + // @returns MapTag + // @plugin Depenizen, SuperiorSkyblock + // @mechanism + // @description + // Returns the settings of an island. + // --> + tagProcessor.registerTag(MapTag.class, "settings", (attribute, object) -> { + MapTag values = new MapTag(); + for (IslandFlag flag : IslandFlag.values()) { + values.putObject(flag.getName(), new ElementTag(object.getIsland().hasSettingsEnabled(flag))); + } + return values; + }); + // <--[tag] // @attribute // @returns ElementTag(Number) // @plugin Depenizen, SuperiorSkyblock // @mechanism SuperiorSkyblockIslandTag.size // @description - // Returns the world border width of the island. + // Returns the world border width of an island. // --> tagProcessor.registerTag(ElementTag.class, "size", (attribute, object) -> { return new ElementTag(object.getIsland().getIslandSize()); }); + // <--[tag] + // @attribute + // @returns ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.team_limit + // @description + // Returns the maximum amount of players on an island's team. + // --> + tagProcessor.registerTag(ElementTag.class, "team_limit", (attribute, object) -> { + return new ElementTag(object.getIsland().getTeamLimit()); + }); + // <--[tag] // @attribute // @returns ElementTag @@ -350,6 +460,50 @@ public static void register() { return new ElementTag(object.getIsland().getUniqueId().toString(), true); }); + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name add_coop_member + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Adds a coop member to an island's team. + // @tags + // + // --> + tagProcessor.registerMechanism("add_coop_member", false, PlayerTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a team of players."); + } + else if (object.getIsland().getCoopPlayers().contains(getSuperiorPlayer(value))) { + mechanism.echoError("This player is already part of the island."); + } + else { + object.getIsland().addCoop(getSuperiorPlayer(value)); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name add_member + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Adds a member to an island's team. + // @tags + // + // --> + tagProcessor.registerMechanism("add_member", false, PlayerTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a team of players."); + } + else if (object.getIsland().getIslandMembers(true).contains(getSuperiorPlayer(value))) { + mechanism.echoError("This player is already part of the island."); + } + else { + object.getIsland().addMember(getSuperiorPlayer(value), SuperiorSkyblockPlugin.getPlugin().getRoles().getDefaultRole()); + } + }); + // <--[mechanism] // @object SuperiorSkyblockIslandTag // @name balance @@ -369,6 +523,74 @@ else if (mechanism.requireDouble()) { } }); + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name ban_player + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Bans a player from an island. + // @tags + // + // --> + tagProcessor.registerMechanism("ban_player", false, PlayerTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have banned players."); + } + else if (object.getIsland().getBannedPlayers().contains(getSuperiorPlayer(value))) { + mechanism.echoError("This player is already banned from the island."); + } + else { + object.getIsland().banMember(getSuperiorPlayer(value)); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name biome + // @input BiomeTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Sets the biome of an island. + // @tags + // + // --> + tagProcessor.registerMechanism("biome", false, BiomeTag.class, (object, mechanism, value) -> { + object.getIsland().setBiome(Registry.BIOME.get(value.getBiome().getKey())); + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name bonus_level + // @input ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Sets the bonus level given to an island. + // @tags + // + // --> + tagProcessor.registerMechanism("bonus_level", false, ElementTag.class, (object, mechanism, value) -> { + if (mechanism.requireDouble()) { + object.getIsland().setBonusLevel(value.asBigDecimal()); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name bonus_worth + // @input ElementTag(Decimal) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Controls the bonus worth given to an island. + // @tags + // + // --> + tagProcessor.registerMechanism("bonus_worth", false, ElementTag.class, (object, mechanism, value) -> { + if (mechanism.requireDouble()) { + object.getIsland().setBonusWorth(value.asBigDecimal()); + } + }); + // <--[mechanism] // @object SuperiorSkyblockIslandTag // @name description @@ -382,9 +604,63 @@ else if (mechanism.requireDouble()) { tagProcessor.registerMechanism("description", false, ElementTag.class, (object, mechanism, value) -> { if (object.getIsland().isSpawn()) { mechanism.echoError("Spawn islands cannot have a description."); - return; } - object.getIsland().setDescription(value.asString()); + else { + object.getIsland().setDescription(value.asString()); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name kick_coop_member + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Kick a coop member from an island's team. + // @tags + // + // --> + tagProcessor.registerMechanism("kick_coop_member", false, PlayerTag.class, (object, mechanism, value) -> { + if (!(object.getIsland().getCoopPlayers().contains(getSuperiorPlayer(value)))) { + mechanism.echoError("This player is already not a part of this island."); + } + else { + object.getIsland().removeCoop(getSuperiorPlayer(value)); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name kick_member + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Kick a member from an island's team. + // @tags + // + // --> + tagProcessor.registerMechanism("kick_member", false, PlayerTag.class, (object, mechanism, value) -> { + if (!(object.getIsland().getIslandMembers(true).contains(getSuperiorPlayer(value)))) { + mechanism.echoError("This player is already not a part of this island."); + } + else { + object.getIsland().removeMember(getSuperiorPlayer(value), MemberRemoveReason.KICK); + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name leader + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Transfers island leadership to the specified player. + // Since only one player can have the 'Leader' role at a time, the current leader will be shifted to the 'Admin' role. + // @tags + // + // --> + tagProcessor.registerMechanism("leader", false, PlayerTag.class, (object, mechanism, value) -> { + object.getIsland().transferIsland(getSuperiorPlayer(value)); }); // <--[mechanism] @@ -431,6 +707,44 @@ else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { } }); + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name settings + // @input MapTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Controls the settings of an island. + // Valid settings are ALWAYS_DAY, ALWAYS_MIDDLE_DAY, ALWAYS_MIDDLE_NIGHT, ALWAYS_NIGHT, ALWAYS_RAIN, ALWAYS_SHINY, CREEPER_EXPLOSION, CROPS_GROWTH, EGG_LAY, ENDERMAN_GRIEF, FIRE_SPREAD, + // GHAST_FIREBALL, LAVA_FLOW, NATURAL_ANIMALS_SPAWN, NATURAL_MONSTER_SPAWN, PVP, SPAWNER_ANIMALS_SPAWN, SPAWNER_MONSTER_SPAWN, TNT_EXPLOSION, TREE_GROWTH, WATER_FLOW, and WITHER_EXPLOSION. + // @example + // # Enables pvp and disables creeper explosions. + // - adjust <[island]> settings: + // @tags + // + // --> + tagProcessor.registerMechanism("settings", false, MapTag.class, (object, mechanism, map) -> { + for (Map.Entry setting : map.entrySet()) { + IslandFlag key; + try { + key = IslandFlag.getByName(setting.getKey().toString()); + } + catch (NullPointerException e) { + mechanism.echoError("'" + setting.getKey() + "' is not a valid island setting."); + continue; + } + ElementTag value = setting.getValue().asElement(); + if (!(value.isBoolean())) { + mechanism.echoError("The setting for '" + key.getName() + "' is not a boolean."); + } + else if (value.asBoolean()) { + object.getIsland().enableSettings(key); + } + else { + object.getIsland().disableSettings(key); + } + } + }); + // <--[mechanism] // @object SuperiorSkyblockIslandTag // @name size @@ -446,14 +760,58 @@ else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { mechanism.echoError("Spawn islands cannot have their size adjusted."); } else if (mechanism.requireInteger()) { - if (value.asInt() >= 1) { + int max = SuperiorSkyblockPlugin.getPlugin().getSettings().getMaxIslandSize(); + if (value.asInt() >= 1 && value.asInt() <= max) { object.getIsland().setIslandSize(value.asInt()); } else { - mechanism.echoError("Island size must be a positive integer."); + mechanism.echoError("Island size must be between 1 and " + max + "."); + } + } + }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name team_limit + // @input ElementTag(Number) + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes the maximum amount of players on an island's team. + // @tags + // + // --> + tagProcessor.registerMechanism("team_limit", false, ElementTag.class, (object, mechanism, value) -> { + if (object.getIsland().isSpawn()) { + mechanism.echoError("Spawn islands cannot have a team."); + } + else if (mechanism.requireInteger()) { + if (value.asInt() >= 1) { + object.getIsland().setTeamLimit(value.asInt()); + } + else { + mechanism.echoError("Island team limit must be a positive integer."); } } }); + + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name unban_player + // @input PlayerTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Unbans a player from an island. + // @tags + // + // --> + tagProcessor.registerMechanism("unban_player", false, PlayerTag.class, (object, mechanism, value) -> { + if (!(object.getIsland().getBannedPlayers().contains(getSuperiorPlayer(value)))) { + mechanism.echoError("This player is not banned from the island."); + } + else { + object.getIsland().unbanMember(getSuperiorPlayer(value)); + } + }); } public static final ObjectTagProcessor tagProcessor = new ObjectTagProcessor<>(); diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index db996442f..7eef4618b 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -1,5 +1,6 @@ package com.denizenscript.depenizen.bukkit.properties.superiorskyblock; +import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin; import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; import com.bgsoftware.superiorskyblock.api.island.Island; import com.bgsoftware.superiorskyblock.api.island.PlayerRole; @@ -47,7 +48,7 @@ public static void register() { // @description // Returns the island a player belongs to, if any. // --> - PlayerTag.tagProcessor.registerTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, player) -> { + PlayerTag.registerOnlineOnlyTag(SuperiorSkyblockIslandTag.class, "superiorskyblock_island", (attribute, player) -> { Island island = getSuperiorPlayer(player).getIsland(); return island != null ? new SuperiorSkyblockIslandTag(island) : null; }); @@ -56,10 +57,11 @@ public static void register() { // @attribute // @returns ElementTag // @plugin Depenizen, SuperiorSkyblock + // @mechanism // @description - // Returns the role a player has on an island, if any. + // Returns the role a player has on their island, if they are part of one. // --> - PlayerTag.tagProcessor.registerTag(ElementTag.class, "superiorskyblock_island_role", (attribute, player) -> { + PlayerTag.registerOnlineOnlyTag(ElementTag.class, "superiorskyblock_island_role", (attribute, player) -> { PlayerRole role = getSuperiorPlayer(player).getPlayerRole(); return role != null ? new ElementTag(role.getName(), true) : null; }); @@ -86,7 +88,7 @@ public static void register() { // @tags // // --> - PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_bypass_mode", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOfflineMechanism("superiorskyblock_bypass_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { getSuperiorPlayer(player).setBypassMode(value.asBoolean()); } @@ -102,12 +104,41 @@ public static void register() { // @tags // // --> - PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_disbands", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOfflineMechanism("superiorskyblock_disbands", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireInteger()) { getSuperiorPlayer(player).setDisbands(value.asInt()); } }); + // <--[mechanism] + // @object PlayerTag + // @name superiorskyblock_island_role + // @input ElementTag + // @plugin Depenizen, SuperiorSkyblock + // @description + // Changes what role a player has on their island. + // Valid roles are Guest, Coop, Member, Moderator, and Admin. + // See <@link mechanism SuperiorSkyblockIslandTag.leader> to transfer the island's 'Leader' role. + // @tags + // + // --> + PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_island_role", ElementTag.class, (player, mechanism, value) -> { + if (!(getSuperiorPlayer(player).hasIsland())) { + mechanism.echoError("This player is not part of an island."); + return; + } + PlayerRole role = SuperiorSkyblockPlugin.getPlugin().getRoles().getPlayerRole(value.toString()); + if (role == null) { + mechanism.echoError("'" + value + "' is not a valid player role."); + } + else if (getSuperiorPlayer(player).getPlayerRole().isLastRole() || role.isLastRole()) { + mechanism.echoError("Changes involving the 'leader' role cannot be transferred through the 'PlayerTag.superiorskyblock_island_role' mechanism. Use the 'SuperiorSkyblockIslandTag.leader' mechanism instead."); + } + else { + getSuperiorPlayer(player).setPlayerRole(role); + } + }); + // <--[mechanism] // @object PlayerTag // @name superiorskyblock_spy_mode @@ -118,7 +149,7 @@ public static void register() { // @tags // // --> - PlayerTag.registerOnlineOnlyMechanism("superiorskyblock_spy_mode", ElementTag.class, (player, mechanism, value) -> { + PlayerTag.registerOfflineMechanism("superiorskyblock_spy_mode", ElementTag.class, (player, mechanism, value) -> { if (mechanism.requireBoolean()) { getSuperiorPlayer(player).setAdminSpy(value.asBoolean()); } From 82fa337fca2b121e6152e82eec785b62f9596442 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sun, 21 Dec 2025 09:01:53 -0800 Subject: [PATCH 22/25] slight change to 'SuperiorSkyblockIslandTag.homes' --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 5945bdca1..5d460577a 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -19,6 +19,7 @@ import com.denizenscript.denizencore.utilities.debugging.Debug; import com.denizenscript.denizencore.utilities.text.StringHolder; import org.bukkit.Registry; +import org.bukkit.World; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -289,13 +290,14 @@ public static void register() { // @returns ListTag(LocationTag) // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the home locations of an island, with the "world" being the dimension. + // Returns the home locations of an island. // --> tagProcessor.registerTag(ListTag.class, "homes", (attribute, object) -> { ListTag values = new ListTag(); for (Map.Entry map : object.getIsland().getIslandHomes().entrySet()) { WorldPosition pos = map.getValue(); - values.addObject(new LocationTag(pos.getX(), pos.getY(), pos.getZ(), map.getKey().getName())); + World world = SuperiorSkyblockAPI.getProviders().getWorldsProvider().getIslandsWorld(object.getIsland(), map.getKey()); + values.addObject(new LocationTag(pos.getX(), pos.getY(), pos.getZ(), world.getName())); } return values; }); From d6aeff634b8595b2f7c6bcf7d6274646a6b5d3c3 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Sun, 21 Dec 2025 09:09:33 -0800 Subject: [PATCH 23/25] minor error message fix --- .../superiorskyblock/SuperiorSkyblockPlayerExtensions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java index 7eef4618b..71dc0ea08 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/properties/superiorskyblock/SuperiorSkyblockPlayerExtensions.java @@ -132,7 +132,7 @@ public static void register() { mechanism.echoError("'" + value + "' is not a valid player role."); } else if (getSuperiorPlayer(player).getPlayerRole().isLastRole() || role.isLastRole()) { - mechanism.echoError("Changes involving the 'leader' role cannot be transferred through the 'PlayerTag.superiorskyblock_island_role' mechanism. Use the 'SuperiorSkyblockIslandTag.leader' mechanism instead."); + mechanism.echoError("Changes involving the 'leader' role cannot be done through the 'PlayerTag.superiorskyblock_island_role' mechanism. Use the 'SuperiorSkyblockIslandTag.leader' mechanism instead."); } else { getSuperiorPlayer(player).setPlayerRole(role); From ef8ee369142e493d4677497d4d9bb0add94e5468 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Mon, 22 Dec 2025 18:31:33 -0800 Subject: [PATCH 24/25] added a new mechanism, fixed some small details --- .../SuperiorSkyblockIslandTag.java | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index 5d460577a..a3491c2eb 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -171,8 +171,8 @@ public static void register() { // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock - // @mechanism - // @mechanism + // @mechanism SuperiorSkyblockIslandTag.ban_player + // @mechanism SuperiorSkyblockIslandTag.unban_player // @description // Returns the players banned on an island. // --> @@ -184,7 +184,7 @@ public static void register() { // @attribute // @returns BiomeTag // @plugin Depenizen, SuperiorSkyblock - // @mechanism + // @mechanism SuperiorSkyblockIslandTag.biome // @description // Returns the current biome of an island. // --> @@ -196,7 +196,7 @@ public static void register() { // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock - // @mechanism + // @mechanism SuperiorSkyblockIslandTag.bonus_level // @description // Returns the bonus level of an island. // --> @@ -208,7 +208,7 @@ public static void register() { // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock - // @mechanism + // @mechanism SuperiorSkyblockIslandTag.bonus_worth // @description // Returns the bonus worth of an island. // --> @@ -217,23 +217,28 @@ public static void register() { }); // <--[tag] - // @attribute ]> + // @attribute ]> // @returns LocationTag // @plugin Depenizen, SuperiorSkyblock // @description - // Returns the center of an island in the provided dimension. - // Valid dimensions are NORMAL, NETHER, and THE_END. + // Returns the center of an island in the provided world. // --> - tagProcessor.registerTag(LocationTag.class, ElementTag.class, "center", (attribute, object, value) -> { - return new LocationTag(object.getIsland().getCenter(Dimension.getByName(value.toString()))); + tagProcessor.registerTag(LocationTag.class, WorldTag.class, "center", (attribute, object, value) -> { + if (SuperiorSkyblockAPI.getProviders().getWorldsProvider().isIslandsWorld(value.getWorld())) { + return new LocationTag(object.getIsland().getCenter(SuperiorSkyblockAPI.getProviders().getWorldsProvider().getIslandsWorldDimension(value.getWorld()))); + } + else { + attribute.echoError("The provided world does not contain islands."); + return null; + } }); // <--[tag] // @attribute // @returns ListTag(PlayerTag) // @plugin Depenizen, SuperiorSkyblock - // @mechanism - // @mechanism + // @mechanism SuperiorSkyblockIslandTag.add_coop_member + // @mechanism SuperiorSkyblockIslandTag.kick_coop_member // @description // Returns the coop members of an island. // --> @@ -381,6 +386,7 @@ public static void register() { // @attribute // @returns ElementTag(Decimal) // @plugin Depenizen, SuperiorSkyblock + // @mechanism SuperiorSkyblockIslandTag.recalculate_worth // @description // Returns the net worth of an island. Includes money in the bank. // --> @@ -709,6 +715,20 @@ else if (SuperiorSkyblockAPI.getIsland(value.asString()) != null) { } }); + // <--[mechanism] + // @object SuperiorSkyblockIslandTag + // @name recalculate_worth + // @input None + // @plugin Depenizen, SuperiorSkyblock + // @description + // Recalculates an island's net worth. + // @tags + // + // --> + tagProcessor.registerMechanism("recalculate_worth", false, (object, mechanism) -> { + object.getIsland().calcIslandWorth(null); + }); + // <--[mechanism] // @object SuperiorSkyblockIslandTag // @name settings From b70b5aada2524b3dce735e35c0ac1a3c8fb492b6 Mon Sep 17 00:00:00 2001 From: MCSamuel Date: Mon, 22 Dec 2025 18:37:51 -0800 Subject: [PATCH 25/25] slight condensation --- .../objects/superiorskyblock/SuperiorSkyblockIslandTag.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java index a3491c2eb..b6c241b6c 100644 --- a/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java +++ b/src/main/java/com/denizenscript/depenizen/bukkit/objects/superiorskyblock/SuperiorSkyblockIslandTag.java @@ -19,7 +19,6 @@ import com.denizenscript.denizencore.utilities.debugging.Debug; import com.denizenscript.denizencore.utilities.text.StringHolder; import org.bukkit.Registry; -import org.bukkit.World; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -301,8 +300,7 @@ public static void register() { ListTag values = new ListTag(); for (Map.Entry map : object.getIsland().getIslandHomes().entrySet()) { WorldPosition pos = map.getValue(); - World world = SuperiorSkyblockAPI.getProviders().getWorldsProvider().getIslandsWorld(object.getIsland(), map.getKey()); - values.addObject(new LocationTag(pos.getX(), pos.getY(), pos.getZ(), world.getName())); + values.addObject(new LocationTag(pos.getX(), pos.getY(), pos.getZ(), SuperiorSkyblockAPI.getProviders().getWorldsProvider().getIslandsWorld(object.getIsland(), map.getKey()).getName())); } return values; });