From 9046b22493baf166b5abe612de170288b3e17f26 Mon Sep 17 00:00:00 2001 From: Jonathan Boisclair Date: Tue, 20 Feb 2024 15:42:56 -0500 Subject: [PATCH 1/8] gradle publishToMavenLocal support (#807) * Update build.gradle.kts * Update build.gradle.kts --------- Co-authored-by: Peaches_MLG --- build.gradle.kts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 44236d55f..a51f562ee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -88,6 +88,9 @@ tasks { // Maven publishing publishing { publications.create("maven") { - from(components["java"]) + setGroupId("com.iridium") + setArtifactId("IridiumSkyblock") + setVersion(version) + artifact(tasks["shadowJar"]) } } From 4b1664744bc2f2f101251380a6360d0bb868e3de Mon Sep 17 00:00:00 2001 From: Jonathan Boisclair Date: Thu, 22 Feb 2024 14:35:04 -0500 Subject: [PATCH 2/8] Fix Api bug and add standard getOwner/getMembers (#811) * Fix Api bug and add standard getOwner/getMembers * Add required changes * Update Island.java Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> * Update IridiumSkyblockAPI.java Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> * Update IridiumSkyblockAPI.java Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> --------- Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com> --- .../iridiumskyblock/api/IridiumSkyblockAPI.java | 11 +++++------ .../iridium/iridiumskyblock/database/Island.java | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/api/IridiumSkyblockAPI.java b/src/main/java/com/iridium/iridiumskyblock/api/IridiumSkyblockAPI.java index e0035bb54..0b146866b 100644 --- a/src/main/java/com/iridium/iridiumskyblock/api/IridiumSkyblockAPI.java +++ b/src/main/java/com/iridium/iridiumskyblock/api/IridiumSkyblockAPI.java @@ -24,13 +24,9 @@ */ public class IridiumSkyblockAPI { - private static final IridiumSkyblockAPI instance; + private static IridiumSkyblockAPI instance; private final IridiumSkyblock iridiumSkyblock; - static { - instance = new IridiumSkyblockAPI(IridiumSkyblock.getInstance()); - } - /** * Constructor for api initialization. * @@ -47,7 +43,10 @@ private IridiumSkyblockAPI(@NotNull IridiumSkyblock iridiumSkyblock) { * @return the instance of this api * @since 3.0.0 */ - public static @NotNull IridiumSkyblockAPI getInstance() { + public static @Nullable IridiumSkyblockAPI getInstance() { + if(instance == null && IridiumSkyblock.getInstance() != null) { + instance = new IridiumSkyblockAPI(IridiumSkyblock.getInstance()); + } return instance; } diff --git a/src/main/java/com/iridium/iridiumskyblock/database/Island.java b/src/main/java/com/iridium/iridiumskyblock/database/Island.java index 0ea60025e..a41330930 100644 --- a/src/main/java/com/iridium/iridiumskyblock/database/Island.java +++ b/src/main/java/com/iridium/iridiumskyblock/database/Island.java @@ -15,6 +15,8 @@ import org.jetbrains.annotations.NotNull; import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; @NoArgsConstructor @Getter @@ -132,11 +134,19 @@ public void setColor(Color color) { @Override public @NotNull String getName() { if (super.getName() != null) return super.getName(); - String ownerName = IridiumSkyblock.getInstance().getTeamManager().getTeamMembers(this).stream() - .filter(user -> user.getUserRank() == Rank.OWNER.getId()) - .findFirst() + String ownerName = getOwner() .map(User::getName) .orElse("N/A"); return IridiumSkyblock.getInstance().getConfiguration().defaultIslandName.replace("%owner%", ownerName); } + + public List getMembers() { + return IridiumSkyblock.getInstance().getTeamManager().getTeamMembers(this); + } + + public Optional getOwner() { + return getMembers().stream() + .filter(user -> user.getUserRank() == Rank.OWNER.getId()) + .findFirst(); + } } From 50c4b002e66059ad3930f3d446d43eaf771062df Mon Sep 17 00:00:00 2001 From: Peaches_MLG Date: Fri, 23 Feb 2024 19:41:22 +0000 Subject: [PATCH 3/8] Fixed issues with Disabling Island Settings --- build.gradle.kts | 2 +- .../iridium/iridiumskyblock/managers/IslandManager.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 44236d55f..3c1f44588 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { implementation("org.jetbrains:annotations:24.1.0") implementation("com.j256.ormlite:ormlite-core:6.1") implementation("com.j256.ormlite:ormlite-jdbc:6.1") - implementation("com.iridium:IridiumTeams:2.3.7") + implementation("com.iridium:IridiumTeams:2.3.8") // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.30") diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 4d2a6d366..13103620a 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -431,9 +431,12 @@ public synchronized TeamBlock getTeamBlock(Island island, XMaterial xMaterial) { } @Override - public synchronized TeamSetting getTeamSetting(Island island, String settingKey) { + public synchronized @Nullable TeamSetting getTeamSetting(Island island, String settingKey) { Setting settingConfig = IridiumSkyblock.getInstance().getSettingsList().get(settingKey); - String defaultValue = settingConfig == null ? "" : settingConfig.getDefaultValue(); + if(settingConfig == null){ + return null; + } + String defaultValue = settingConfig.getDefaultValue(); Optional teamSetting = IridiumSkyblock.getInstance().getDatabaseManager().getTeamSettingsTableManager().getEntry(new TeamSetting(island, settingKey, defaultValue)); if (teamSetting.isPresent()) { return teamSetting.get(); From 58c4e20851897e8e9dbe5a3a1bf12b863ee97284 Mon Sep 17 00:00:00 2001 From: Peaches_MLG Date: Fri, 23 Feb 2024 20:15:22 +0000 Subject: [PATCH 4/8] Optimised isInSkyblockWorld method --- .../managers/IslandManager.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 13103620a..bb53aaeb7 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -88,7 +88,7 @@ public void setIslandBiome(@NotNull Island island, @NotNull XBiome biome) { World.Environment dimension = biome.getEnvironment(); World world = getWorld(dimension); - if(world == null) return; + if (world == null) return; getIslandChunks(island).thenAccept(chunks -> { Location pos1 = island.getPosition1(world); @@ -174,8 +174,8 @@ public CompletableFuture createTeam(@NotNull Player owner, String name) User user = IridiumSkyblock.getInstance().getUserManager().getUser(owner); Schematics.SchematicConfig schematicConfig = IridiumSkyblock.getInstance().getSchematics().schematics.get(schematic); - if(schematicConfig.regenCost.money != 0 || !schematicConfig.regenCost.bankItems.isEmpty()) { - if(!IridiumSkyblock.getInstance().getSchematicManager().buy(owner, schematicConfig)) { + if (schematicConfig.regenCost.money != 0 || !schematicConfig.regenCost.bankItems.isEmpty()) { + if (!IridiumSkyblock.getInstance().getSchematicManager().buy(owner, schematicConfig)) { return null; } } @@ -433,7 +433,7 @@ public synchronized TeamBlock getTeamBlock(Island island, XMaterial xMaterial) { @Override public synchronized @Nullable TeamSetting getTeamSetting(Island island, String settingKey) { Setting settingConfig = IridiumSkyblock.getInstance().getSettingsList().get(settingKey); - if(settingConfig == null){ + if (settingConfig == null) { return null; } String defaultValue = settingConfig.getDefaultValue(); @@ -623,21 +623,27 @@ public void deleteTeamReward(TeamReward teamReward) { } public @Nullable World getWorld(World.Environment environment) { + String worldName = getWorldName(environment); + if (worldName == null) return null; + return Bukkit.getWorld(worldName); + } + + public @Nullable String getWorldName(World.Environment environment) { if (!IridiumSkyblock.getInstance().getConfiguration().enabledWorlds.getOrDefault(environment, true)) return null; switch (environment) { case NORMAL: - return Bukkit.getWorld(IridiumSkyblock.getInstance().getConfiguration().worldName); + return IridiumSkyblock.getInstance().getConfiguration().worldName; case NETHER: - return Bukkit.getWorld(IridiumSkyblock.getInstance().getConfiguration().worldName + "_nether"); + return IridiumSkyblock.getInstance().getConfiguration().worldName + "_nether"; case THE_END: - return Bukkit.getWorld(IridiumSkyblock.getInstance().getConfiguration().worldName + "_the_end"); + return IridiumSkyblock.getInstance().getConfiguration().worldName + "_the_end"; } return null; } public boolean isInSkyblockWorld(World world) { - return Objects.equals(world, getWorld(World.Environment.NORMAL)) || Objects.equals(world, getWorld(World.Environment.NETHER)) || Objects.equals(world, getWorld(World.Environment.THE_END)); + return world.getName().equals(getWorldName(World.Environment.NORMAL)) || world.getName().equals(getWorldName(World.Environment.NETHER)) || world.getName().equals(getWorldName(World.Environment.THE_END)); } public void sendIslandBorder(Player player) { From a212c630bbcbc79d920f4da0837b4b9afb7eb946 Mon Sep 17 00:00:00 2001 From: Peaches_MLG Date: Fri, 23 Feb 2024 20:19:45 +0000 Subject: [PATCH 5/8] Optimised isInSkyblockWorld method --- .../java/com/iridium/iridiumskyblock/managers/IslandManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index bb53aaeb7..7509bd780 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -643,6 +643,7 @@ public void deleteTeamReward(TeamReward teamReward) { } public boolean isInSkyblockWorld(World world) { + if(world == null) return false; return world.getName().equals(getWorldName(World.Environment.NORMAL)) || world.getName().equals(getWorldName(World.Environment.NETHER)) || world.getName().equals(getWorldName(World.Environment.THE_END)); } From 75618ddd0ae49cbdd3c4e5e126684e1135bdf125 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:30:09 +0000 Subject: [PATCH 6/8] Bump com.iridium:IridiumTeams from 2.3.8 to 2.3.9 (#813) Bumps com.iridium:IridiumTeams from 2.3.8 to 2.3.9. --- updated-dependencies: - dependency-name: com.iridium:IridiumTeams dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index af4644439..b49bdb320 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { implementation("org.jetbrains:annotations:24.1.0") implementation("com.j256.ormlite:ormlite-core:6.1") implementation("com.j256.ormlite:ormlite-jdbc:6.1") - implementation("com.iridium:IridiumTeams:2.3.8") + implementation("com.iridium:IridiumTeams:2.3.9") // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.30") From f16ca4c2b341e6192d4d85729bcbd0255cbfc357 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 04:29:16 +0000 Subject: [PATCH 7/8] Bump com.iridium:IridiumTeams from 2.3.9 to 2.4.0 (#814) Bumps com.iridium:IridiumTeams from 2.3.9 to 2.4.0. --- updated-dependencies: - dependency-name: com.iridium:IridiumTeams dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index b49bdb320..ce91c029e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { implementation("org.jetbrains:annotations:24.1.0") implementation("com.j256.ormlite:ormlite-core:6.1") implementation("com.j256.ormlite:ormlite-jdbc:6.1") - implementation("com.iridium:IridiumTeams:2.3.9") + implementation("com.iridium:IridiumTeams:2.4.0") // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.30") From 898bc8a97e6bedefa270be67959ea614697b9aa8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 04:42:14 +0000 Subject: [PATCH 8/8] Bump com.iridium:IridiumTeams from 2.4.0 to 2.4.1 (#820) Bumps com.iridium:IridiumTeams from 2.4.0 to 2.4.1. --- updated-dependencies: - dependency-name: com.iridium:IridiumTeams dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index ce91c029e..26e6bb158 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { implementation("org.jetbrains:annotations:24.1.0") implementation("com.j256.ormlite:ormlite-core:6.1") implementation("com.j256.ormlite:ormlite-jdbc:6.1") - implementation("com.iridium:IridiumTeams:2.4.0") + implementation("com.iridium:IridiumTeams:2.4.1") // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.30")