Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Stacker Support #840

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,6 +63,7 @@ public class IridiumSkyblock extends IridiumTeams<Island, User> {
private SchematicManager schematicManager;
private ShopManager<Island, User> shopManager;
private BiomeManager biomeManager;
private SupportManager<Island, User> supportManager;

private Economy economy;

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public List<Island> getTeams() {
return IridiumSkyblock.getInstance().getDatabaseManager().getIslandTableManager().getEntries();
}

@Override
public boolean isInTeam(Island island, Location location) {
return island.isInIsland(location);
}

private CompletableFuture<String> getSchematic(Player player) {
CompletableFuture<String> schematicNameCompletableFuture = new CompletableFuture<>();
if (IridiumSkyblock.getInstance().getSchematics().schematics.entrySet().size() == 1) {
Expand Down Expand Up @@ -473,14 +478,24 @@ public CompletableFuture<Void> 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);
Comment on lines +481 to +486
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to think about this since we are doing this in an async thread

}
}
}
}
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<TeamBlock> blocks = IridiumSkyblock.getInstance().getDatabaseManager().getTeamBlockTableManager().getEntries(island);
Expand Down Expand Up @@ -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));
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ softdepend:
- "EssentialsSpawn"
- "RoseStacker"
- "WorldEdit"
- "ObsidianStacker"
loadbefore:
- "Multiverse-Core"
commands:
Expand Down
Loading