Skip to content

Commit

Permalink
Add validate checks and improve performance by skipping an uncessary …
Browse files Browse the repository at this point in the history
…validate check
  • Loading branch information
md5sha256 authored and WalshyDev committed Jun 24, 2023
1 parent 31693ee commit 17014a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,14 @@ public void queueDelete(Location l, boolean destroy) {

@ParametersAreNonnullByDefault
public void queueDelete(Collection<Location> locations, boolean destroy) {
Map<Location, Boolean> toDelete = new HashMap<>(locations.size());
Validate.notNull(locations, "Locations must not be null");

Map<Location, Boolean> toDelete = new HashMap<>(locations.size(), 1.0F);
for (Location location : locations) {
Validate.notNull(location, "Locations must not contain null locations");
toDelete.put(location, destroy);
}
queueDelete(toDelete);
deletionQueue.putAll(toDelete);
}

@ParametersAreNonnullByDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ public static void clearAllBlockInfoAtChunk(World world, int chunkX, int chunkZ,
return;
}
Map<Location, Boolean> toClear = new HashMap<>();
for (Location location : blockStorage.storage.keySet()) {
Map<Location, Config> storage = blockStorage.getRawStorage();
for (Location location : storage.keySet()) {
if (location.getBlockX() >> 4 == chunkX && location.getBlockZ() >> 4 == chunkZ) {
toClear.put(location, destroy);
}
Expand Down

0 comments on commit 17014a9

Please sign in to comment.