From 07df6dbf79fc90023a22533d50becc21efaae6c7 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 27 Jan 2019 18:54:18 -0600 Subject: [PATCH] Update version number and small plugin fix --- Application/Application.csproj | 6 +++--- Application/IW4MServer.cs | 6 +++--- SharedLibraryCore/ScriptPlugin.cs | 25 ++++++++++++++++--------- SharedLibraryCore/Server.cs | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Application/Application.csproj b/Application/Application.csproj index 14970321c..8e70437cd 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -6,7 +6,7 @@ 2.1.5 false RaidMax.IW4MAdmin.Application - 2.2.3.3 + 2.2.4.0 RaidMax Forever None IW4MAdmin @@ -31,8 +31,8 @@ true true - 2.2.3.3 - 2.2.3.3 + 2.2.4.0 + 2.2.4.0 diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index 205b96bea..87f43a72a 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -865,7 +865,7 @@ namespace IW4MAdmin #if !DEBUG else { - string formattedKick = String.Format(RconParser.GetCommandPrefixes().Kick, Target.ClientNumber, $"{loc["SERVER_KICK_TEXT"]} - ^5{Reason}^7"); + string formattedKick = String.Format(RconParser.Configuration.CommandPrefixes.Kick, Target.ClientNumber, $"{loc["SERVER_KICK_TEXT"]} - ^5{Reason}^7"); await Target.CurrentServer.ExecuteCommandAsync(formattedKick); } #endif @@ -904,7 +904,7 @@ namespace IW4MAdmin #if !DEBUG else { - string formattedKick = String.Format(RconParser.GetCommandPrefixes().Kick, Target.ClientNumber, $"^7{loc["SERVER_TB_TEXT"]}- ^5{Reason}"); + string formattedKick = String.Format(RconParser.Configuration.CommandPrefixes.Kick, Target.ClientNumber, $"^7{loc["SERVER_TB_TEXT"]}- ^5{Reason}"); await Target.CurrentServer.ExecuteCommandAsync(formattedKick); } #else @@ -949,7 +949,7 @@ namespace IW4MAdmin targetClient.Level = EFClient.Permission.Banned; #if !DEBUG - string formattedString = String.Format(RconParser.GetCommandPrefixes().Kick, targetClient.ClientNumber, $"{loc["SERVER_BAN_TEXT"]} - ^5{reason} ^7({loc["SERVER_BAN_APPEAL"]} {Website})^7"); + string formattedString = String.Format(RconParser.Configuration.CommandPrefixes.Kick, targetClient.ClientNumber, $"{loc["SERVER_BAN_TEXT"]} - ^5{reason} ^7({loc["SERVER_BAN_APPEAL"]} {Website})^7"); await targetClient.CurrentServer.ExecuteCommandAsync(formattedString); #else await targetClient.CurrentServer.OnClientDisconnected(targetClient); diff --git a/SharedLibraryCore/ScriptPlugin.cs b/SharedLibraryCore/ScriptPlugin.cs index 0ca8764aa..ed5bf3a1b 100644 --- a/SharedLibraryCore/ScriptPlugin.cs +++ b/SharedLibraryCore/ScriptPlugin.cs @@ -1,7 +1,6 @@ using SharedLibraryCore.Database.Models; using SharedLibraryCore.Interfaces; using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; @@ -85,15 +84,20 @@ namespace SharedLibraryCore this.Version = (float)pluginObject.version; - if (pluginObject.isParser) + try { - await OnLoadAsync(mgr); - IEventParser eventParser = (IEventParser)ScriptEngine.GetValue("eventParser").ToObject(); - IRConParser rconParser = (IRConParser)ScriptEngine.GetValue("rconParser").ToObject(); - Manager.AdditionalEventParsers.Add(eventParser); - Manager.AdditionalRConParsers.Add(rconParser); + if (pluginObject.isParser) + { + await OnLoadAsync(mgr); + IEventParser eventParser = (IEventParser)ScriptEngine.GetValue("eventParser").ToObject(); + IRConParser rconParser = (IRConParser)ScriptEngine.GetValue("rconParser").ToObject(); + Manager.AdditionalEventParsers.Add(eventParser); + Manager.AdditionalRConParsers.Add(rconParser); + } } - + catch { } + + if (!firstRun) { await OnLoadAsync(mgr); @@ -123,6 +127,9 @@ namespace SharedLibraryCore return Task.FromResult(ScriptEngine.Execute("plugin.onTickAsync(_server)").GetCompletionValue()); } - public Task OnUnloadAsync() => Task.FromResult(ScriptEngine.Execute("plugin.onUnloadAsync()").GetCompletionValue()); + public Task OnUnloadAsync() + { + return Task.FromResult(ScriptEngine.Execute("plugin.onUnloadAsync()").GetCompletionValue()); + } } } diff --git a/SharedLibraryCore/Server.cs b/SharedLibraryCore/Server.cs index ac2a7dc17..5f4a9c8c0 100644 --- a/SharedLibraryCore/Server.cs +++ b/SharedLibraryCore/Server.cs @@ -146,7 +146,7 @@ namespace SharedLibraryCore protected async Task Tell(String Message, EFClient Target) { #if !DEBUG - string formattedMessage = String.Format(RconParser.GetCommandPrefixes().Tell, Target.ClientNumber, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{Message}"); + string formattedMessage = String.Format(RconParser.Configuration.CommandPrefixes.Tell, Target.ClientNumber, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{Message}"); if (Target.ClientNumber > -1 && Message.Length > 0 && Target.Level != EFClient.Permission.Console) await this.ExecuteCommandAsync(formattedMessage); #else