public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem system) { this.PluginBase = reference; this.FileSystem = system; if (system.IsDefault()) { system.Save(CourtConfig.GetDefault()); this.Configuration = CourtConfig.GetDefault(); } else { this.Configuration = system.ReadConfig <CourtConfig>(); } this.HighCourt = new JusticeSystem(Path.Combine(system.Store, "bans"), Configuration.ReportsPerBan, reference.Logger, reference.ChatInterface, reference.UnsafeDirectReference); this.HighCourt.OnPlayerBanned += PlayerBanned; PluginBase.ApiServer.RegisterCommand(DashboardUnBanAddress, " <IP address> => this is the equivalent of deleting a ban file and reloading the bans. The said player will be unbanned from the server, if he is banned."); PluginBase.ApiServer.RegisterCommand(DashboardBanIpAddress, " <ip address> => will permanently ban the IP address. The players must be connected."); PluginBase.ApiServer.RegisterCommand(DashboardBanIpAddressBlind, " <ip address> => just like the above, but the player does not need to be connected. Warning: he will not be kicked if he is connected to a game. Use the above command if that is your intention."); PluginBase.ApiServer.RegisterCommand(DashboardReloadBans, "=> this will reload the bans from the disk. This can be useful if you need to remove a ban, and don't want to restart the server. To do that, just delete the ban from the disk and execute this command."); PluginBase.ApiServer.RegisterCommand(DashboardBansMessage, "=> will list the current permanent bans."); if (Configuration.EnablePlayerReports) { PluginBase.EventListener.RegisterCommand(PlayerReportCommand); } reference.OnDashboardCommandReceived += DashboardCommandReceived; reference.ChatInterface.OnCommandInvoked += PlayerCommandReceived; reference.EventListener.OnPlayerSpawnedFirst += (evt) => { HighCourt.HandleSpawn(evt); }; }
public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem system) { this.Interface = reference; this.FileSystem = system; var mainThread = new Thread(Main); mainThread.Start(); }
public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem system) { this.PluginBase = reference; this.FileSys = system; this.HistoryFilePath = Path.Combine(system.Store, "history.json"); if (!File.Exists(HistoryFilePath)) { File.Create(HistoryFilePath).Close(); } Main(); }
public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem pfs) { SkinDir = Path.Combine(pfs.Store, Constants.SkinPath); SkinList = new Dictionary <string, Skin>(); if (!Directory.Exists(SkinDir)) { Directory.CreateDirectory(SkinDir); } this.PluginBase = reference; if (pfs.IsDefault()) { //the first time the plugin is run. We will create a config. var config = new FashionConfig() { AllowPreSetSkins = true, AllowRandomSkins = true, AllowInGame = false }; pfs.Save(config); this.Config = config; } else { //the plugin has been run before, we can load the config. this.Config = pfs.ReadConfig <FashionConfig>(); if (!Config.AllowPreSetSkins && !Config.AllowRandomSkins) { reference.Logger.LogError("Fashion : Critical error - invalid config. Reverting back to the default config."); Config = new FashionConfig() { AllowPreSetSkins = true, AllowRandomSkins = true, AllowInGame = false }; pfs.Save(Config); } } this.SkinProvider = new ItemConverter(); string skins = " "; if (Config.AllowPreSetSkins) { foreach (var preSetSkin in Skin.FromDir(SkinDir)) { SkinList.Add(preSetSkin.Name, preSetSkin); skins += "'" + preSetSkin.Name + "', "; } if (SkinList.Count > 0) { skins = skins.Remove(skins.Length - 3, 2); } reference.Logger.LogInformation($"Fashion: loaded {SkinList.Count} skins."); } Help += "Usage: \n"; if (Config.AllowRandomSkins) { Help += "/fashion new => gets a random style."; } if (Config.AllowPreSetSkins) { Help += $"\n/fashion {skins} => sets the pre-defined style."; } RegisterCommands(); }
public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem system) { this.PluginBase = reference; this.FileSys = system; Main(); }
public void Load(QuiteExtendableDirectInterface reference, PluginFileSystem pfs) { this.PluginBase = reference; MyFunction(); }