Skip to content

Commit

Permalink
Merge pull request #340 from BentoBoxWorld/develop
Browse files Browse the repository at this point in the history
Release 2.17.1
  • Loading branch information
tastybento authored Jan 20, 2025
2 parents cefb70a + c1dc824 commit 7a8df69
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.17.0</build.version>
<build.version>2.17.1</build.version>
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/world/bentobox/level/PlaceholderManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ String getRankName(World world, int rank, boolean weighted) {
}
@Nullable
UUID owner = addon.getManager().getTopTen(world, Level.TEN).keySet().stream().skip(rank - 1L).limit(1L)
.findFirst().flatMap(addon.getIslands()::getIslandById).map(Island::getOwner).orElse(null);
.findFirst().flatMap(addon.getIslands()::getIslandById).filter(island -> island.getOwner() != null) // Filter out null owners
.map(Island::getOwner).orElse(null);

return addon.getPlayers().getName(owner);
}
Expand All @@ -135,10 +136,12 @@ String getRankIslandName(World world, int rank, boolean weighted) {
rank = Math.max(1, Math.min(rank, Level.TEN));
if (weighted) {
return addon.getManager().getWeightedTopTen(world, Level.TEN).keySet().stream().skip(rank - 1L).limit(1L)
.findFirst().map(Island::getName).orElse("");
.findFirst().filter(island -> island.getName() != null) // Filter out null names
.map(Island::getName).orElse("");
}
return addon.getManager().getTopTen(world, Level.TEN).keySet().stream().skip(rank - 1L).limit(1L).findFirst()
.flatMap(addon.getIslands()::getIslandById).map(Island::getName).orElse("");
.flatMap(addon.getIslands()::getIslandById).filter(island -> island.getName() != null) // Filter out null names
.map(Island::getName).orElse("");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ private void loadChunks(CompletableFuture<List<Chunk>> r2, World world, Queue<Pa
return;
}
Pair<Integer, Integer> p = pairList.poll();
Util.getChunkAtAsync(world, p.x, p.z, world.getEnvironment().equals(Environment.NETHER)).thenAccept(chunk -> {
// We need to generate now all the time because some game modes are not voids
Util.getChunkAtAsync(world, p.x, p.z, true).thenAccept(chunk -> {
if (chunk != null) {
chunkList.add(chunk);
roseStackerCheck(chunk);
Expand Down Expand Up @@ -613,6 +614,7 @@ public void scanIsland(Pipeliner pipeliner) {
} else {
// Done
pipeliner.getInProcessQueue().remove(this);
BentoBox.getInstance().log("Completed Level scan.");
// Chunk finished
// This was the last chunk. Handle stacked blocks, then chests and exit
handleStackedBlocks().thenCompose(v -> handleChests()).thenRun(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ public Pipeliner(Level addon) {
if (!inProcessQueue.isEmpty() || toProcessQueue.isEmpty()) return;
for (int j = 0; j < addon.getSettings().getConcurrentIslandCalcs() && !toProcessQueue.isEmpty(); j++) {
IslandLevelCalculator iD = toProcessQueue.poll();
// Ignore deleted or unonwed islands
// Ignore deleted or unowned islands
if (!iD.getIsland().isDeleted() && !iD.getIsland().isUnowned()) {
inProcessQueue.put(iD, System.currentTimeMillis());
BentoBox.getInstance().log("Starting to scan island level at " + iD.getIsland().getCenter());
// Start the scanning of a island with the first chunk
scanIsland(iD);
}
Expand Down Expand Up @@ -95,6 +96,7 @@ public CompletableFuture<Results> addIsland(Island island) {
.map(IslandLevelCalculator::getIsland).anyMatch(island::equals)) {
return CompletableFuture.completedFuture(new Results(Result.IN_PROGRESS));
}
BentoBox.getInstance().log("Added island to Level queue: " + island.getCenter());
return addToQueue(island, false);
}

Expand All @@ -104,6 +106,7 @@ public CompletableFuture<Results> addIsland(Island island) {
* @return CompletableFuture of the results
*/
public CompletableFuture<Results> zeroIsland(Island island) {
BentoBox.getInstance().log("Zeroing island level for island at " + island.getCenter());
return addToQueue(island, true);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/blockconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ blocks:
BARREL: 2
BARRIER: 0
BASALT: 1
BEACON: 300
BEDROCK: 0
BEETROOTS: 1
BELL: 100
Expand Down

0 comments on commit 7a8df69

Please sign in to comment.