Fix issue with time when a player reconnects without a world

This commit is contained in:
KingRainbow44 2023-06-01 14:18:34 -04:00
parent 3c0e834348
commit fd40575cb4
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -345,8 +345,9 @@ public class Player implements PlayerHook, FieldFetch {
this.playerGameTime = gameTime;
// If the player is the host of the world, update the game time as well.
if (this.getWorld().getHost() == this) {
this.getWorld().changeTime(gameTime);
var world = this.getWorld();
if (world != null && world.getHost() == this) {
world.changeTime(gameTime);
}
// Trigger the script event for game time update.