Fix error when no player in server

This commit is contained in:
mlus 2025-06-06 13:09:32 +08:00
parent 0562b01138
commit 79e0e2cbe4
2 changed files with 4 additions and 2 deletions

View File

@ -34,7 +34,7 @@ mod_name=PlayerSync
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPL-3.0 license
# The mod version. See https://semver.org/
mod_version=2.1.2
mod_version=2.1.3
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -33,7 +33,9 @@ public class ChatSyncClient {
while ((serverMessage = in.readLine()) != null) {
PlayerSync.LOGGER.info("Received message from chat server: " + serverMessage);
Component textComponents = Component.nullToEmpty(serverMessage);
playerList.broadcastSystemMessage(textComponents,false);
if(playerList!=null){
playerList.broadcastSystemMessage(textComponents,false);
}
}
} catch (IOException e) {
e.printStackTrace();