Adds a config flag for managing warps

This commit is contained in:
zontreck 2025-01-18 15:34:51 -07:00
parent e561ced568
commit e776a6bb9e
4 changed files with 42 additions and 2 deletions

View file

@ -20,6 +20,9 @@ namespace AriasServerUtils
internal static Dictionary<string, PlayerStorage> mPlayerData = new Dictionary<string, PlayerStorage>();
internal static Warps serverWarps = new Warps();
internal static string[] saveInvTypes = new string[] {
GlobalConstants.hotBarInvClassName,
GlobalConstants.backpackInvClassName,
@ -107,9 +110,16 @@ namespace AriasServerUtils
.HandleWith(Events.HandleUpdateASUBypass)
.EndSubCommand()
.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()
.BeginSubCommand("help")
.RequiresPlayer()
.RequiresPrivilege(Privilege.chat)
.HandleWith(Events.HandleASU)
.WithDescription("Lists all Aria's Server Utils commands")
@ -223,6 +233,8 @@ namespace AriasServerUtils
public void SaveGlobalConfig()
{
API.StoreModConfig<ASUModConfig>(config, GetConfigurationFile("global", ModConfigType.Global));
API.StoreModConfig<Warps>(serverWarps, GetConfigurationFile("warps", ModConfigType.Global));
}
private void OnGameReady()
@ -232,6 +244,10 @@ namespace AriasServerUtils
config = API.LoadModConfig<ASUModConfig>(GetConfigurationFile("global", ModConfigType.Global));
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)