generated from AriasCreations/vsmodtemplate
Adds a config flag for managing warps
This commit is contained in:
parent
e561ced568
commit
e776a6bb9e
4 changed files with 42 additions and 2 deletions
|
@ -20,6 +20,9 @@ namespace AriasServerUtils
|
||||||
|
|
||||||
internal static Dictionary<string, PlayerStorage> mPlayerData = new Dictionary<string, PlayerStorage>();
|
internal static Dictionary<string, PlayerStorage> mPlayerData = new Dictionary<string, PlayerStorage>();
|
||||||
|
|
||||||
|
internal static Warps serverWarps = new Warps();
|
||||||
|
|
||||||
|
|
||||||
internal static string[] saveInvTypes = new string[] {
|
internal static string[] saveInvTypes = new string[] {
|
||||||
GlobalConstants.hotBarInvClassName,
|
GlobalConstants.hotBarInvClassName,
|
||||||
GlobalConstants.backpackInvClassName,
|
GlobalConstants.backpackInvClassName,
|
||||||
|
@ -107,9 +110,16 @@ namespace AriasServerUtils
|
||||||
.HandleWith(Events.HandleUpdateASUBypass)
|
.HandleWith(Events.HandleUpdateASUBypass)
|
||||||
.EndSubCommand()
|
.EndSubCommand()
|
||||||
.WithDescription("Updates the ASU mod configuration")
|
.WithDescription("Updates the ASU mod configuration")
|
||||||
|
.BeginSubCommand("onlyAdminManageWarps")
|
||||||
|
.RequiresPrivilege(Privilege.controlserver)
|
||||||
|
.WithArgs(
|
||||||
|
parsers.Bool("manageWarps")
|
||||||
|
)
|
||||||
|
.WithDescription("DANGER: This updates the flag allowing anybody to create warps, even non-admins. It is recommended to leave this alone. The default is true/on/yes")
|
||||||
|
.HandleWith(Events.HandleUpdateASUMgrWarps)
|
||||||
|
.EndSubCommand()
|
||||||
.EndSubCommand()
|
.EndSubCommand()
|
||||||
.BeginSubCommand("help")
|
.BeginSubCommand("help")
|
||||||
.RequiresPlayer()
|
|
||||||
.RequiresPrivilege(Privilege.chat)
|
.RequiresPrivilege(Privilege.chat)
|
||||||
.HandleWith(Events.HandleASU)
|
.HandleWith(Events.HandleASU)
|
||||||
.WithDescription("Lists all Aria's Server Utils commands")
|
.WithDescription("Lists all Aria's Server Utils commands")
|
||||||
|
@ -223,6 +233,8 @@ namespace AriasServerUtils
|
||||||
public void SaveGlobalConfig()
|
public void SaveGlobalConfig()
|
||||||
{
|
{
|
||||||
API.StoreModConfig<ASUModConfig>(config, GetConfigurationFile("global", ModConfigType.Global));
|
API.StoreModConfig<ASUModConfig>(config, GetConfigurationFile("global", ModConfigType.Global));
|
||||||
|
|
||||||
|
API.StoreModConfig<Warps>(serverWarps, GetConfigurationFile("warps", ModConfigType.Global));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGameReady()
|
private void OnGameReady()
|
||||||
|
@ -232,6 +244,10 @@ namespace AriasServerUtils
|
||||||
|
|
||||||
config = API.LoadModConfig<ASUModConfig>(GetConfigurationFile("global", ModConfigType.Global));
|
config = API.LoadModConfig<ASUModConfig>(GetConfigurationFile("global", ModConfigType.Global));
|
||||||
if (config == null) config = new ASUModConfig();
|
if (config == null) config = new ASUModConfig();
|
||||||
|
|
||||||
|
// -> Step 2. Load Mod Warps <-
|
||||||
|
serverWarps = API.LoadModConfig<Warps>(GetConfigurationFile("warps", ModConfigType.Global));
|
||||||
|
if (serverWarps == null) serverWarps = new Warps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetConfigurationFile(string sName, ModConfigType type)
|
public string GetConfigurationFile(string sName, ModConfigType type)
|
||||||
|
|
|
@ -211,5 +211,15 @@ namespace AriasServerUtils
|
||||||
|
|
||||||
return TextCommandResult.Success();
|
return TextCommandResult.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static TextCommandResult HandleUpdateASUMgrWarps(TextCommandCallingArgs args)
|
||||||
|
{
|
||||||
|
if (args[0] is bool mgr)
|
||||||
|
ServerUtilities.config.onlyAdminsCreateWarps = mgr;
|
||||||
|
else ServerUtilities.config.onlyAdminsCreateWarps = true;
|
||||||
|
ServerUtilities.MarkDirty();
|
||||||
|
|
||||||
|
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace AriasServerUtils
|
namespace AriasServerUtils
|
||||||
{
|
{
|
||||||
|
@ -13,8 +14,21 @@ namespace AriasServerUtils
|
||||||
{
|
{
|
||||||
public int MaxHomes { get; set; } = 20;
|
public int MaxHomes { get; set; } = 20;
|
||||||
public bool AdminsBypassMaxHomes { get; set; } = true;
|
public bool AdminsBypassMaxHomes { get; set; } = true;
|
||||||
|
public bool onlyAdminsCreateWarps { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
public PlayerPosition Spawn { get; set; }
|
public PlayerPosition Spawn { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Warp
|
||||||
|
{
|
||||||
|
public PlayerPosition Location;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Warps
|
||||||
|
{
|
||||||
|
public Dictionary<string, Warp> warps = new Dictionary<string, Warp>();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
"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 @ 03:18 PM",
|
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 03:18 PM",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1-dev.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue