From ac8ac62d27cc3723be9d8d4108928645c1d1c7e4 Mon Sep 17 00:00:00 2001 From: zontreck Date: Thu, 5 Jun 2025 12:41:22 -0700 Subject: [PATCH] Fix serialization of home mount flag Part of #6 --- AriasServerUtils/EventHandler.cs | 15 ++++----------- AriasServerUtils/Globals.cs | 9 ++++++++- AriasServerUtils/PlayerData.cs | 3 ++- AriasServerUtils/modinfo.json | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/AriasServerUtils/EventHandler.cs b/AriasServerUtils/EventHandler.cs index 6b19245..667c1f1 100644 --- a/AriasServerUtils/EventHandler.cs +++ b/AriasServerUtils/EventHandler.cs @@ -202,10 +202,11 @@ namespace AriasServerUtils if (args.Caller.Player is IServerPlayer isp) { - - if (args.Command.FullName == "sethomemount") + bool withMount = false; + if (args.Command.Name == "sethomemount") { // Check for the gears and pay here, or show error. + withMount = true; } bool bypass = isOp && ServerUtilities.config.AdminsBypassMaxHomes; @@ -213,16 +214,8 @@ namespace AriasServerUtils if (bypass || data.Homes.Count < ServerUtilities.config.MaxHomes || data.Homes.ContainsKey(homeName)) { - data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName); + data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName, withMount: withMount); ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set")); - - - - if (args.Command.FullName == "sethomemount") - { - // Enable mount in the home - data.Homes[homeName].CanHaveMount = true; - } } else { diff --git a/AriasServerUtils/Globals.cs b/AriasServerUtils/Globals.cs index 7a9ead4..0040c91 100644 --- a/AriasServerUtils/Globals.cs +++ b/AriasServerUtils/Globals.cs @@ -96,12 +96,13 @@ namespace AriasServerUtils public bool CanHaveMount = false; - public static Warp Create(IServerPlayer player) + public static Warp Create(IServerPlayer player, bool withMount = false) { Warp warp = new Warp(); warp.Location = PlayerPosition.from(player.Entity); warp.CreatedBy = player.PlayerName; warp.CreatedAt = DateTime.Now; + warp.CanHaveMount = withMount; return warp; } @@ -113,6 +114,12 @@ namespace AriasServerUtils public Dictionary warps = new Dictionary(); } + [Serializable] + public class Costs + { + + } + public class BackCaches { diff --git a/AriasServerUtils/PlayerData.cs b/AriasServerUtils/PlayerData.cs index efb9db3..6be84eb 100644 --- a/AriasServerUtils/PlayerData.cs +++ b/AriasServerUtils/PlayerData.cs @@ -97,10 +97,11 @@ namespace AriasServerUtils public PlayerPosition Location { get; set; } public bool CanHaveMount = false; - public static Home MakeHome(Entity player, string homeName) + public static Home MakeHome(Entity player, string homeName, bool withMount = false) { Home home = new Home(); home.Location = PlayerPosition.from(player); + home.CanHaveMount = withMount; return home; diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index 506a13a..5a7b9ec 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 06-05-2025 @ 11:56 AM MST", - "version": "1.1.0-dev.1", + "description": "A collection of server utilities\n\nBuild Date: 06-05-2025 @ 12:38 PM MST", + "version": "1.1.0-dev.2", "dependencies": { "game": "" }