Fix player name showing in tab list, when player disconnects mid-way through loading map

This commit is contained in:
UnknownShadow200 2018-07-20 18:12:08 +10:00
parent 16a0a65947
commit c45bcac04f
2 changed files with 4 additions and 1 deletions

View File

@ -110,11 +110,14 @@ namespace MCGalaxy {
Position pos = level.SpawnPos;
Orientation rot = p.Rot;
byte yaw = level.rotx, pitch = level.roty;
// in case player disconnected mid-way through loading map
if (p.disconnected) return;
OnPlayerSpawningEvent.Call(p, ref pos, ref yaw, ref pitch, false);
rot.RotY = yaw; rot.HeadX = pitch;
p.Pos = pos;
p.SetYawPitch(yaw, pitch);
if (p.disconnected) return;
Entities.SpawnEntities(p, pos, rot);
OnJoinedLevelEvent.Call(p, prevLevel, level, ref announce);