generated from AriasCreations/vsmodtemplate
Adds check for max homes and a flag indicating if admins can bypass max homes
This commit is contained in:
parent
93a9a5e8bc
commit
a27b9847d0
3 changed files with 19 additions and 5 deletions
|
@ -116,6 +116,7 @@ namespace AriasServerUtils
|
||||||
|
|
||||||
internal static TextCommandResult HandleSetHome(TextCommandCallingArgs args)
|
internal static TextCommandResult HandleSetHome(TextCommandCallingArgs args)
|
||||||
{
|
{
|
||||||
|
bool isOp = args.Caller.HasPrivilege(Privilege.controlserver);
|
||||||
string homeName = "default";
|
string homeName = "default";
|
||||||
if (args.ArgCount > 0)
|
if (args.ArgCount > 0)
|
||||||
{
|
{
|
||||||
|
@ -124,11 +125,21 @@ namespace AriasServerUtils
|
||||||
|
|
||||||
if (args.Caller.Player is IServerPlayer isp)
|
if (args.Caller.Player is IServerPlayer isp)
|
||||||
{
|
{
|
||||||
|
bool bypass = isOp && ServerUtilities.config.AdminsBypassMaxHomes;
|
||||||
var data = ServerUtilities.GetPlayerData(isp);
|
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();
|
ServerUtilities.MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ namespace AriasServerUtils
|
||||||
public class ASUModConfig
|
public class ASUModConfig
|
||||||
{
|
{
|
||||||
public int MaxHomes { get; set; } = 20;
|
public int MaxHomes { get; set; } = 20;
|
||||||
|
public bool AdminsBypassMaxHomes { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
public PlayerPosition Spawn { get; set; }
|
public PlayerPosition Spawn { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,8 +3,8 @@
|
||||||
"modid": "ariasserverutils",
|
"modid": "ariasserverutils",
|
||||||
"name": "Aria's Server Utilities",
|
"name": "Aria's Server Utilities",
|
||||||
"authors": ["zontreck"],
|
"authors": ["zontreck"],
|
||||||
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:22 PM",
|
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:35 PM",
|
||||||
"version": "1.0.0-dev.7",
|
"version": "1.0.0-dev.8",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue