Skip to content

Commit

Permalink
Fix NPE when shard collection received before any player joins
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Jan 3, 2025
1 parent 15a6d81 commit a6108df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ authors=Falkreon, acikek
contributors=Trudle, Tomate0613, afamiliarquiet, FoundationGames, TheEpicBlock, hama
license=MIT
# Mod Version
baseVersion=1.8.2-rc.6
baseVersion=1.8.2-rc.7
# Branch Metadata
branch=1.21
tagBranch=1.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public static boolean triggerShardCollection(ServerPlayerEntity player, Identifi

// This overload is about a player in another server, i.e. from peer channel
public static boolean triggerShardCollection(UUID uuid, Identifier shardId) {
calculateShardProgress(); // It's possible for this to be called before any player joins
ShardCollection collection = getServerCollection(uuid);
if (collection.add(shardId)) {
serverGlobalCollection.update(shardId, 1, serverCollections.size());
Expand Down Expand Up @@ -165,6 +166,7 @@ public static boolean triggerShardUncollection(ServerPlayerEntity player, Identi

// This overload is about a player in another server, i.e. from peer channel
public static boolean triggerShardUncollection(UUID uuid, Identifier shardId) {
calculateShardProgress(); // It's possible for this to be called before any player joins
ShardCollection collection = getServerCollection(uuid);
if (collection.remove(shardId)) {
serverGlobalCollection.update(shardId, -1, serverCollections.size());
Expand Down

0 comments on commit a6108df

Please sign in to comment.