Skip to content

Commit

Permalink
fixed command execution for unturned update
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkbound committed Mar 21, 2021
1 parent 058bdcd commit 4548757
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
Binary file modified BUILT_DLL/AdminWarnings.dll
Binary file not shown.
12 changes: 6 additions & 6 deletions BUILT_DLL/hashes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
------------------------------------------------------------
HASHES ARE FROM BUILDING THIS AS A DLL AND AS A RELEASE MODE
DATE BUILT: JULY/4/2020 @ 10:38PM (CST)
HASHES ARE FROM BUILDING THIS AS A DLL AND AS A RELEASE BUILD
DATE BUILT: MARCH/21/2021 @ 3:16PM (CST)
------------------------------------------------------------
MD5 - E46264997271E62FE0AB39526438DBDE
SHA-1 - 27B67D9D93C1B0C2ECBC0EB1D8DFEFED04144F04
SHA-256 - 39BF85744B1188CA16A367BB5076288F6FAB22230A5BAEEE4C54B6FA22224766
SHA-512 - D2709CD5D02C3E25616E880FE87B1CE5810839AC67B831C03A4ABFBF45CACE8036558AA3BD22A6BE4A3207EDA8FD357C1523DEB5CC9A780C8E8A0441BDA137C7
MD5 - 390C4C2323FFEA0A27DCB7DBF0F59691
SHA-1 - 8A15AF20A74DBCE86C5C8D3738C02BE78080F440
SHA-256 - FA6BE9CBE70AFEB5D5F48952A4EADECC7A8F75E5A25B1B37A9C00E4CD37539B9
SHA-512 - 61BBBFBB58701457E3CCF68B1174B51C81CF3BCDD8F796519F3047F7B3DD1DCF035C8922007E97C8820EEB82756DE32A803028F0189D268FA3A50BB1DB328853
12 changes: 8 additions & 4 deletions WarningsPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Rocket.Core.Plugins;
using Rocket.Unturned.Player;
Expand All @@ -10,12 +11,16 @@
using Steamworks;
using System.Threading;
using AdminWarnings.Helpers;
using Rocket.Unturned.Events;
using Action = System.Action;
using logger = Rocket.Core.Logging.Logger;

namespace AdminWarnings
{
public class WarningsPlugin : RocketPlugin<WarningsConfig>
{
public static MethodInfo onInputCommitted =
typeof(CommandWindow).GetMethod("onInputCommitted", BindingFlags.Instance | BindingFlags.NonPublic);
public static WarningsPlugin Instance;
public static WarningUtilities util = new WarningUtilities();

Expand Down Expand Up @@ -137,8 +142,7 @@ public bool CheckIfHasData(UnturnedPlayer P)
{
var pWarning = GetAllPlayerWarnings()
.FirstOrDefault(warning => warning.CSteamID.ToString() == P.CSteamID.ToString());
if (pWarning == null) return false;
return true;
return pWarning != null;
}

public void WarnPlayer(IRocketPlayer caller, UnturnedPlayer Player, string reason, bool reasonIncluded)
Expand All @@ -150,12 +154,12 @@ public void WarnPlayer(IRocketPlayer caller, UnturnedPlayer Player, string reaso

if (MatchesWarningPoint(pData.Warnings))
{
WarningPoint point = GetWarningPoint(pData.Warnings);
var point = GetWarningPoint(pData.Warnings);

if (!string.IsNullOrEmpty(point.ConsoleCommand))
{
var cmd = ConsoleCommandHelper.FormatConsoleCommandString(point.ConsoleCommand.ToLower(), Player);
CommandWindow.input.onInputText(cmd);
WarningsPlugin.onInputCommitted.Invoke(Dedicator.commandWindow, new object[]{cmd});
logger.Log(WarningsPlugin.Instance.Translate("console_command", cmd, Player.DisplayName,
point.WarningsToTrigger));
}
Expand Down
Binary file modified lib/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file modified lib/Assembly-CSharp.dll
Binary file not shown.
Binary file modified lib/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file modified lib/UnityEngine.dll
Binary file not shown.

0 comments on commit 4548757

Please sign in to comment.