From b84f24e4a7fb82a97ff766d848cdaf6e3155cfa3 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:58:28 -0800 Subject: [PATCH] Fix error when creating a new player --- src/main/java/emu/lunarcore/game/player/Player.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/lunarcore/game/player/Player.java b/src/main/java/emu/lunarcore/game/player/Player.java index 43bf6508e..2b812fc86 100644 --- a/src/main/java/emu/lunarcore/game/player/Player.java +++ b/src/main/java/emu/lunarcore/game/player/Player.java @@ -203,8 +203,11 @@ public void setLevel(int lvl) { this.level = newLevel; this.exp = GameData.getPlayerExpRequired(this.level); - this.sendPacket(new PacketPlayerSyncScNotify(this)); - this.save(); + + if (this.isOnline()) { + this.getSession().send(new PacketPlayerSyncScNotify(this)); + this.save(); + } } private void onLevelChange(int oldLevel, int newLevel) {