From 85cf3329b83b74bbc6610ebd2704d4c26a34bedd Mon Sep 17 00:00:00 2001 From: Terminator_97 <50580453+francesco132@users.noreply.github.com> Date: Fri, 3 Apr 2020 00:22:37 +0200 Subject: [PATCH] 1.2.4 --- SCPUtils/Commands.cs | 12 +----------- SCPUtils/Plugin.cs | 35 +++++------------------------------ 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/SCPUtils/Commands.cs b/SCPUtils/Commands.cs index 82ec12b..35b2064 100644 --- a/SCPUtils/Commands.cs +++ b/SCPUtils/Commands.cs @@ -8,17 +8,6 @@ namespace SCPUtils { public class Commands { - private readonly Functions functionsInstance; - private readonly Utils pluginInstance; - string playerListString; - - - - public Commands(Functions functionsInstance, Utils pluginInstance) - { - this.functionsInstance = functionsInstance; - this.pluginInstance = pluginInstance; - } public void OnRaCommand(ref RACommandEvent ev) @@ -93,6 +82,7 @@ public void OnRaCommand(ref RACommandEvent ev) if (commandSender.CheckPermission("scputils.playerlist")) { + var playerListString = ""; foreach (var databasePlayer in Database.LiteDatabase.GetCollection().FindAll()) { playerListString += $"\n[{databasePlayer.Name} ({databasePlayer.Id}@{databasePlayer.Authentication})]\n\n Total SCP Suicides/Quits: [ {databasePlayer.ScpSuicideCount} ]\n Total SCP Suicides/Quits Kicks: [ {databasePlayer.TotalScpSuicideKicks} ]\n Total SCP Suicides/Quits Bans: [ {databasePlayer.TotalScpSuicideBans} ]\n Total Games played as SCP: [ {databasePlayer.TotalScpGamesPlayed} ]\n Total Suicides/Quits Percentage: [ {Math.Round(databasePlayer.SuicidePercentage, 2)}% ]\n"; diff --git a/SCPUtils/Plugin.cs b/SCPUtils/Plugin.cs index 46d872a..4b7d9d6 100644 --- a/SCPUtils/Plugin.cs +++ b/SCPUtils/Plugin.cs @@ -10,10 +10,8 @@ namespace SCPUtils { public static class Database - { - //LiteDB + { public static string databaseName = "SCPUtils"; - public static LiteDatabase LiteDatabase { get; private set; } public static string DatabaseDirectory => Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "EXILED"), databaseName); public static string DatabaseFullPath => Path.Combine(DatabaseDirectory, $"{databaseName}.db"); @@ -76,15 +74,12 @@ public static void AddPlayer(ReferenceHub player) } - public class Utils : EXILED.Plugin - { - - //Generic + public class Utils : Plugin + { public static bool IsStarted { get; set; } - public static string pluginVersion = "1.2.3"; + public static string pluginVersion = "1.2.4"; public override string getName { get; } = "SCPUtils"; - public EventHandlers EventHandlers { get; private set; } public Commands Commands { get; private set; } public Functions Functions { get; private set; } @@ -92,7 +87,6 @@ public class Utils : EXILED.Plugin internal ExiledVersion ExiledVersion { get; private set; } = new ExiledVersion() { Major = 1, Minor = 9, Patch = 10 }; - //Configs public bool enableSCPSuicideAutoWarn; public bool enableRoundRestartCheck; @@ -119,14 +113,9 @@ public class Utils : EXILED.Plugin public float autoBanThreshold; public float autoKickThreshold; - - - - - public override void OnEnable() { - Commands = new Commands(Functions, this); + Commands = new Commands(); Functions = new Functions(this, Commands); EventHandlers = new EventHandlers(Functions, this); LoadEvents(); @@ -137,8 +126,6 @@ public override void OnEnable() Log.Info($"{getName} {pluginVersion} Loaded!"); } - - public override void OnDisable() { Events.RoundStartEvent -= EventHandlers.OnRoundStart; @@ -156,16 +143,10 @@ public override void OnDisable() Functions = null; } - - public override void OnReload() { - } - - - public void LoadEvents() { Events.RoundStartEvent += EventHandlers.OnRoundStart; @@ -177,7 +158,6 @@ public void LoadEvents() Events.Scp079TriggerTeslaEvent += EventHandlers.On079Tesla; Events.PlayerLeaveEvent += EventHandlers.OnPlayerLeave; Events.PlayerSpawnEvent += EventHandlers.OnPlayerSpawn; - } public void LoadCommands() @@ -211,12 +191,9 @@ internal void LoadConfig() SCP079TeslaEventWait = Config.GetInt("scputils_scp_079_tesla_event_wait", 2); autoBanThreshold = Config.GetFloat("scputils_auto_ban_threshold", 30.5f); autoKickThreshold = Config.GetFloat("scputils_auto_kick_threshold", 15.5f); - ConfigValidator(); } - - public void ConfigValidator() { if (scpSuicideTollerance < 0) Log.Warn("Invalid config scputils_scp_suicide_tollerance!"); @@ -224,8 +201,6 @@ public void ConfigValidator() if (autoRestartTime < 0) Log.Warn("Invalid config scputils_auto_restart_time!"); if (SCP079TeslaEventWait < 0) Log.Warn("Invalid config scputils_scp_079_tesla_event_wait!"); if (Version.Parse($"{EventPlugin.Version.Major}.{EventPlugin.Version.Minor}.{EventPlugin.Version.Patch}") < Version.Parse($"{ExiledVersion.Major}.{ExiledVersion.Minor}.{ExiledVersion.Patch}")) Log.Warn($"You are running the plugin in an outdated EXILED version, you may try to use the plugin but it's advisable to update your EXILED version (Required version: {ExiledVersion.Major}.{ExiledVersion.Minor}.{ExiledVersion.Patch}), plugin developer won't offer support for incompatible EXILED versions!"); - } - } } \ No newline at end of file