Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
terminator-97 committed Apr 2, 2020
1 parent 4f7c292 commit 37e8b21
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Database will get created inside Exiled/SCPUtils folder.<br /><br />
| scputils_auto_restart_time | int | 15 | After how many seconds round should be restarted if there is only 1 player? |
| scputils_autowarn_message_duration | int | 30 | Autowarn message duration |
| scputils_auto_ban_duration | int | 15 | Autoban duration in minutes |
| scputils_auto_ban_tollerance | int | 3 | Tollerance, if the player has commited less suicides than tollerance he won't get kicked or banned even if the percentage is outside of threshold |
| scputils_auto_ban_tollerance | int | 5 | Tollerance, if the player has commited less suicides than tollerance he won't get kicked or banned even if the percentage is outside of threshold |
| scputils_scp_079_tesla_event_wait | int | 2 | If 079 trigger tesla for how many seconds player shouldn't get warned for suicide? |
| scputils_auto_ban_threshold | float | 30.5f | Percentage of suicides to trigger a ban (Suicides / Games played as SCP) * 100 |
| scputils_auto_kick_threshold | float | 15.5f | Percentage of suicides to trigger a kick (Suicides / Games played as SCP) * 100 |
Expand Down
30 changes: 24 additions & 6 deletions SCPUtils/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ public void OnRaCommand(ref RACommandEvent ev)
{

string[] args = ev.Command.Split(' ');
var commandSender = EXILED.Extensions.Player.GetPlayer(ev.Sender.Nickname);
if (commandSender == null)
{
ev.Sender.RAMessage("An error has occured while executing the command!", false);
return;
}


switch (args[0].ToLower())
{
Expand All @@ -48,6 +43,14 @@ public void OnRaCommand(ref RACommandEvent ev)
case "scputils_player_info":
{
ev.Allow = false;

var commandSender = EXILED.Extensions.Player.GetPlayer(ev.Sender.Nickname);
if (commandSender == null)
{
ev.Sender.RAMessage("An error has occured while executing the command!", false);
break;
}

if (args.Length < 2)
{
ev.Sender.RAMessage("Usage: scputils_player_info <player name/id>", false);
Expand Down Expand Up @@ -80,6 +83,13 @@ public void OnRaCommand(ref RACommandEvent ev)
{
ev.Allow = false;

var commandSender = EXILED.Extensions.Player.GetPlayer(ev.Sender.Nickname);
if (commandSender == null)
{
ev.Sender.RAMessage("An error has occured while executing the command!", false);
return;
}

if (commandSender.CheckPermission("scputils.playerlist"))
{

Expand All @@ -98,6 +108,14 @@ public void OnRaCommand(ref RACommandEvent ev)
case "scputils_player_reset":
{
ev.Allow = false;

var commandSender = EXILED.Extensions.Player.GetPlayer(ev.Sender.Nickname);
if (commandSender == null)
{
ev.Sender.RAMessage("An error has occured while executing the command!", false);
return;
}

if (args.Length < 2)
{
ev.Sender.RAMessage("Usage: scputils_player_reset <player name/id>", false);
Expand Down
9 changes: 6 additions & 3 deletions SCPUtils/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class Utils : EXILED.Plugin

//Generic
public static bool IsStarted { get; set; }
public static string Version = "1.2.2";
public static string pluginVersion = "1.2.3";
public override string getName { get; } = "SCPUtils";


Expand All @@ -90,6 +90,7 @@ public class Utils : EXILED.Plugin
public Functions Functions { get; private set; }
public Player Player { get; private set; }

internal ExiledVersion ExiledVersion { get; private set; } = new ExiledVersion() { Major = 1, Minor = 9, Patch = 11 };


//Configs
Expand Down Expand Up @@ -133,7 +134,7 @@ public override void OnEnable()
LoadCommands();
Database.CreateDatabase();
Database.OpenDatabase();
Log.Info($"{getName} {Version} Loaded!");
Log.Info($"{getName} {pluginVersion} Loaded!");
}


Expand Down Expand Up @@ -206,7 +207,7 @@ internal void LoadConfig()
autoRestartTime = Config.GetUInt("scputils_auto_restart_time", 15);
autoWarnMessageDuration = Config.GetUInt("scputils_autowarn_message_duration", 30);
autoBanDuration = Config.GetInt("scputils_auto_ban_duration", 15);
scpSuicideTollerance = Config.GetInt("scputils_auto_ban_tollerance", 3);
scpSuicideTollerance = Config.GetInt("scputils_auto_ban_tollerance", 5);
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);
Expand All @@ -222,6 +223,8 @@ public void ConfigValidator()
if (autoKickThreshold >= autoBanThreshold) Log.Warn("Invalid config scputils_auto_kick_threshold OR scputils_auto_ban_threshold!");
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!");

}

}
Expand Down

0 comments on commit 37e8b21

Please sign in to comment.