Skip to content

Commit

Permalink
Fixes reporting of success.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jan 17, 2021
1 parent 5c58328 commit 07763ca
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Island;
Expand Down Expand Up @@ -170,9 +169,7 @@ public CompletableFuture<GhResult> tryToMakeGreenhouse(Location location, BiomeR
}
// Check if the greenhouse meets the requested recipe
if (greenhouseRecipe != null) {
checkRecipe(finder, greenhouseRecipe, resultSet).thenAccept(rs -> {
r.complete(rs);
});
checkRecipe(finder, greenhouseRecipe, resultSet).thenAccept(r::complete);
return;
}
// Try ordered recipes
Expand Down Expand Up @@ -208,9 +205,9 @@ private void findRecipe(CompletableFuture<Set<GreenhouseResult>> r, List<BiomeRe
list.remove(0);
br.checkRecipe(finder.getGh()).thenAccept(results -> {
if (results.isEmpty()) {
findRecipe(r, list, finder);
r.complete(Collections.singleton(GreenhouseResult.SUCCESS));
} else {
r.complete(results);
findRecipe(r, list, finder);
}
});
}
Expand All @@ -232,6 +229,7 @@ CompletableFuture<GhResult> checkRecipe(GreenhouseFinder finder, BiomeRecipe gre
resultSet.add(map.addGreenhouse(finder.getGh()));
activateGreenhouse(finder.getGh());
handler.saveObjectAsync(finder.getGh());
rs.addAll(resultSet);
}
GhResult recipe = new GhResult().setFinder(finder).setResults(rs);
r.complete(recipe);
Expand Down

0 comments on commit 07763ca

Please sign in to comment.