From c45bcac04ff607576c93096accf4b8294d78f6a7 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 20 Jul 2018 18:12:08 +1000 Subject: [PATCH] Fix player name showing in tab list, when player disconnects mid-way through loading map --- MCGalaxy/Drawing/DrawOps/AdvPyramidDrawOps.cs | 2 +- MCGalaxy/Player/PlayerActions.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MCGalaxy/Drawing/DrawOps/AdvPyramidDrawOps.cs b/MCGalaxy/Drawing/DrawOps/AdvPyramidDrawOps.cs index 66e8a322e..fdac2f3bf 100644 --- a/MCGalaxy/Drawing/DrawOps/AdvPyramidDrawOps.cs +++ b/MCGalaxy/Drawing/DrawOps/AdvPyramidDrawOps.cs @@ -76,7 +76,7 @@ namespace MCGalaxy.Drawing.Ops { { int xx = C.X - x, yy = y - Min.Y, zz = C.Z - z; int curHeight = Invert ? yy : height - yy; - if (curHeight == 0) continue; + if (curHeight == 0) continue; double curRadius = Radius * ((double)curHeight / (double)height); int absx = Math.Abs(xx), absz = Math.Abs(zz); diff --git a/MCGalaxy/Player/PlayerActions.cs b/MCGalaxy/Player/PlayerActions.cs index 6bae5e36e..cb4a694b3 100644 --- a/MCGalaxy/Player/PlayerActions.cs +++ b/MCGalaxy/Player/PlayerActions.cs @@ -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);