diff --git a/AriasServerUtils/EventHandler.cs b/AriasServerUtils/EventHandler.cs index 6858333..3688eec 100644 --- a/AriasServerUtils/EventHandler.cs +++ b/AriasServerUtils/EventHandler.cs @@ -116,6 +116,7 @@ namespace AriasServerUtils internal static TextCommandResult HandleSetHome(TextCommandCallingArgs args) { + bool isOp = args.Caller.HasPrivilege(Privilege.controlserver); string homeName = "default"; if (args.ArgCount > 0) { @@ -124,11 +125,21 @@ namespace AriasServerUtils if (args.Caller.Player is IServerPlayer isp) { - + bool bypass = isOp && ServerUtilities.config.AdminsBypassMaxHomes; var data = ServerUtilities.GetPlayerData(isp); - data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName); - ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set")); + if (bypass || data.Homes.Count < ServerUtilities.config.MaxHomes || data.Homes.ContainsKey(homeName)) + { + data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName); + ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set")); + + } + else + { + ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-max")); + } + + ServerUtilities.MarkDirty(); } diff --git a/AriasServerUtils/ModConfig.cs b/AriasServerUtils/ModConfig.cs index eb5915b..d16e04e 100644 --- a/AriasServerUtils/ModConfig.cs +++ b/AriasServerUtils/ModConfig.cs @@ -12,6 +12,9 @@ namespace AriasServerUtils public class ASUModConfig { public int MaxHomes { get; set; } = 20; + public bool AdminsBypassMaxHomes { get; set; } = true; + + public PlayerPosition Spawn { get; set; } } } \ No newline at end of file diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index b356ca5..69cc404 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: 01-18-2025 @ 02:22 PM", - "version": "1.0.0-dev.7", + "description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:35 PM", + "version": "1.0.0-dev.8", "dependencies": { "game": "" }