Skip to content

Commit

Permalink
Update IslandManager.java
Browse files Browse the repository at this point in the history
fixed it cause the last one was bad (i forgor completableFuture spot)
  • Loading branch information
sh0inx committed Oct 6, 2023
1 parent 7091944 commit 071b10e
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,24 @@ public List<Island> getTeams() {
@Override
public CompletableFuture<Island> createTeam(@NotNull Player owner, String name) {
CompletableFuture<String> schematicNameCompletableFuture = new CompletableFuture<>();
String schematic = null;

if(IridiumSkyblock.getInstance().getSchematics().schematics.entrySet().size() > 1) {
owner.openInventory(new CreateGUI(owner.getOpenInventory().getTopInventory(), schematicNameCompletableFuture).getInventory());
schematic = schematicNameCompletableFuture.join();
} else {
for (Map.Entry<String, Schematics.SchematicConfig> entry : IridiumSkyblock.getInstance().getSchematics().schematics.entrySet()) {
schematic = (entry.getKey());
}
}

String finalSchematic = schematic;
return CompletableFuture.supplyAsync(() -> {

String schematic = null;

if(IridiumSkyblock.getInstance().getSchematics().schematics.entrySet().size() == 1) {
for (Map.Entry<String, Schematics.SchematicConfig> entry : IridiumSkyblock.getInstance().getSchematics().schematics.entrySet()) {
schematic = (entry.getKey());
}
} else {
schematic = schematicNameCompletableFuture.join();
}

String finalSchematic = schematic;
if (finalSchematic == null) return null;

User user = IridiumSkyblock.getInstance().getUserManager().getUser(owner);
Expand Down

0 comments on commit 071b10e

Please sign in to comment.