diff --git a/build.gradle.kts b/build.gradle.kts index 8d8444c0d..8ae41674c 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.2") + implementation("com.iridium:IridiumTeams:2.4.3") // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.32") diff --git a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java index 0f6dd096e..b70f11258 100644 --- a/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java +++ b/src/main/java/com/iridium/iridiumskyblock/IridiumSkyblock.java @@ -13,6 +13,7 @@ import com.iridium.iridiumteams.IridiumTeams; import com.iridium.iridiumteams.managers.MissionManager; import com.iridium.iridiumteams.managers.ShopManager; +import com.iridium.iridiumteams.managers.SupportManager; import lombok.Getter; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; @@ -62,6 +63,7 @@ public class IridiumSkyblock extends IridiumTeams { private SchematicManager schematicManager; private ShopManager shopManager; private BiomeManager biomeManager; + private SupportManager supportManager; private Economy economy; @@ -99,6 +101,10 @@ public void onEnable() { this.missionManager = new MissionManager<>(this); this.shopManager = new ShopManager<>(this); this.biomeManager = new BiomeManager(); + this.supportManager = new SupportManager<>(this); + + supportManager.registerSupport(); + try { databaseManager.init(); } catch (SQLException exception) { diff --git a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java index 7509bd780..6512d9f33 100644 --- a/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java +++ b/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java @@ -152,6 +152,11 @@ public List getTeams() { return IridiumSkyblock.getInstance().getDatabaseManager().getIslandTableManager().getEntries(); } + @Override + public boolean isInTeam(Island island, Location location) { + return island.isInIsland(location); + } + private CompletableFuture getSchematic(Player player) { CompletableFuture schematicNameCompletableFuture = new CompletableFuture<>(); if (IridiumSkyblock.getInstance().getSchematics().schematics.entrySet().size() == 1) { @@ -473,14 +478,24 @@ public CompletableFuture recalculateTeam(Island island) { for (int y = 0; y <= maxy; y++) { if (island.isInIsland(x + (chunkSnapshot.getX() * 16), z + (chunkSnapshot.getZ() * 16))) { XMaterial material = XMaterial.matchXMaterial(chunkSnapshot.getBlockType(x, y, z)); - teamBlocks.put(material, teamBlocks.getOrDefault(material, 0) + 1); + Block block = chunk.getBlock(x, y, z); + int amount = IridiumSkyblock.getInstance().getSupportManager().getStackerSupport().stream() + .mapToInt(stackerSupport -> stackerSupport.getStackAmount(block)) + .max() + .orElse(1); + teamBlocks.put(material, teamBlocks.getOrDefault(material, 0) + amount); } } } } - getSpawners(chunk, island).join().forEach(creatureSpawner -> - teamSpawners.put(creatureSpawner.getSpawnedType(), teamSpawners.getOrDefault(creatureSpawner.getSpawnedType(), 0) + 1) - ); + getSpawners(chunk, island).join().forEach(creatureSpawner -> { + int amount = IridiumSkyblock.getInstance().getSupportManager().getSpawnerSupport().stream() + .mapToInt(stackerSupport -> stackerSupport.getStackAmount(creatureSpawner)) + .max() + .orElse(1); + + teamSpawners.put(creatureSpawner.getSpawnedType(), teamSpawners.getOrDefault(creatureSpawner.getSpawnedType(), 0) + amount); + }); } }).thenRun(() -> Bukkit.getScheduler().runTask(IridiumSkyblock.getInstance(), () -> { List blocks = IridiumSkyblock.getInstance().getDatabaseManager().getTeamBlockTableManager().getEntries(island); @@ -643,7 +658,7 @@ public void deleteTeamReward(TeamReward teamReward) { } public boolean isInSkyblockWorld(World world) { - if(world == null) return false; + 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)); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5777b667d..7ca14cebe 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -12,6 +12,7 @@ softdepend: - "EssentialsSpawn" - "RoseStacker" - "WorldEdit" + - "ObsidianStacker" loadbefore: - "Multiverse-Core" commands: