public CmdAlias(CmdAliasPlugin pluginInstance) { this.parent = pluginInstance; TShockAPI.Commands.ChatCommands.Add(new TShockAPI.Command("aliascmd", ChatCommand_GeneralCommand, "aliascmd") { AllowServer = true }); Configuration = Configuration.LoadConfigurationFromFile("tshock" + System.IO.Path.DirectorySeparatorChar + "SEconomy" + System.IO.Path.DirectorySeparatorChar + "AliasCmd.config.json"); ParseCommands(); AliasExecuted += CmdAliasPlugin_AliasExecuted; }
public static Configuration NewSampleConfiguration() { Configuration newConfig = new Configuration(); newConfig.CommandAliases.Add(AliasCommand.Create("testparms", "", "0c", "", 0, "/bc Input param 1 2 3: $1 $2 $3", "/bc Input param 1-3: $1-3", "/bc Input param 2 to end of line: $2-")); newConfig.CommandAliases.Add(AliasCommand.Create("testrandom", "", "0c", "", 0, "/bc Random Number: $random(1,100)")); newConfig.CommandAliases.Add(AliasCommand.Create("impersonate", "", "0c", "", 0, "$runas($1,/me can fit $random(1,100) cocks in their mouth at once.)")); return newConfig; }
/// <summary> /// Asynchronously reparses the AliasCmd configuration file after the specified period. /// </summary> protected async Task ReloadConfigAfterDelayAsync(int DelaySeconds) { await Task.Delay(DelaySeconds * 1000); TShock.Log.ConsoleInfo("AliasCmd: reloading config."); try { Configuration reloadedConfig = Configuration.LoadConfigurationFromFile("tshock" + System.IO.Path.DirectorySeparatorChar + "SEconomy" + System.IO.Path.DirectorySeparatorChar + "AliasCmd.config.json"); Configuration = reloadedConfig; ParseCommands(); } catch (Exception ex) { TShock.Log.ConsoleError("aliascmd: Your new config could not be loaded, fix any problems and save the file. Your old configuration is in effect until this is fixed. \r\n\r\n" + ex.ToString()); throw; } TShock.Log.ConsoleInfo("AliasCmd: config reload done."); }