From d35d8883860433b8908cccc9a5b4af6c352537e5 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 18 Jan 2025 14:17:31 -0700 Subject: [PATCH] Fix crash when instantiating playerposition --- AriasServerUtils/ASUModSystem.cs | 2 +- AriasServerUtils/PlayerData.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AriasServerUtils/ASUModSystem.cs b/AriasServerUtils/ASUModSystem.cs index 74ba68e..49dc245 100644 --- a/AriasServerUtils/ASUModSystem.cs +++ b/AriasServerUtils/ASUModSystem.cs @@ -68,7 +68,7 @@ namespace AriasServerUtils api.Event.PlayerDeath += OnPlayerDeath; api.Event.PlayerJoin += OnPlayerJoin; api.Event.PlayerDisconnect += OnPlayerDC; - api.Event.PlayerLeave += OnPlayerDC; + //api.Event.PlayerLeave += OnPlayerDC; diff --git a/AriasServerUtils/PlayerData.cs b/AriasServerUtils/PlayerData.cs index 5a04966..c31560d 100644 --- a/AriasServerUtils/PlayerData.cs +++ b/AriasServerUtils/PlayerData.cs @@ -1,15 +1,13 @@ using System; using System.Collections.Generic; -using System.Runtime.ConstrainedExecution; using Vintagestory.API.Common; using Vintagestory.API.Common.Entities; using Vintagestory.API.MathTools; -using Vintagestory.GameContent; namespace AriasServerUtils { [Serializable] - public class PlayerPosition : ICloneable + public class PlayerPosition { public int X { get; set; } = 0; public int Y { get; set; } = 0; @@ -19,7 +17,7 @@ namespace AriasServerUtils public float Yaw { get; set; } = 0.0f; public float Pitch { get; set; } = 0.0f; - public readonly PlayerPosition ZERO = new(0, 0, 0, 0, 0.0f, 0.0f); + public static readonly PlayerPosition ZERO = new(0, 0, 0, 0, 0.0f, 0.0f); public PlayerPosition() { } internal PlayerPosition(int x, int y, int z, int dim, float yaw, float pitch) @@ -62,7 +60,7 @@ namespace AriasServerUtils return pos; } - public object Clone() + public PlayerPosition Clone() { return new PlayerPosition(this.X, this.Y, this.Z, this.Dimension, this.Yaw, this.Pitch); }