From 9488f754d41fa1fae7bba7287962954990af7b31 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sat, 15 May 2021 09:20:49 -0500 Subject: [PATCH] Fix stupid idiot things --- .../Misc/ScriptPluginConfigurationWrapper.cs | 2 +- .../SampleScriptPluginCommand.js | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Application/Misc/ScriptPluginConfigurationWrapper.cs b/Application/Misc/ScriptPluginConfigurationWrapper.cs index d18999493..11d580716 100644 --- a/Application/Misc/ScriptPluginConfigurationWrapper.cs +++ b/Application/Misc/ScriptPluginConfigurationWrapper.cs @@ -41,7 +41,7 @@ namespace IW4MAdmin.Application.Misc if (value is object[] array && array.All(item => item is double d && AsInteger(d) != null)) { - castValue = array.Select(item => (int) item).ToArray(); + castValue = array.Select(item => AsInteger((double)item)).ToArray(); } if (!_config.ContainsKey(_pluginName)) diff --git a/Plugins/ScriptPlugins/SampleScriptPluginCommand.js b/Plugins/ScriptPlugins/SampleScriptPluginCommand.js index fb4c77841..90c5903aa 100644 --- a/Plugins/ScriptPlugins/SampleScriptPluginCommand.js +++ b/Plugins/ScriptPlugins/SampleScriptPluginCommand.js @@ -60,22 +60,24 @@ let plugin = { "pong", "hello" ]; + + this.configHandler = _configHandler; - _configHandler.SetValue("SampleIntegerValue", 123); - _configHandler.SetValue("SampleStringValue", this.author); - _configHandler.SetValue("SampleFloatValue", this.version); - _configHandler.SetValue("SampleNumericalArray", intArray); - _configHandler.SetValue("SampleStringArray", stringArray); + this.configHandler.SetValue("SampleIntegerValue", 123); + this.configHandler.SetValue("SampleStringValue", this.author); + this.configHandler.SetValue("SampleFloatValue", this.version); + this.configHandler.SetValue("SampleNumericalArray", intArray); + this.configHandler.SetValue("SampleStringArray", stringArray); - this.logger.WriteDebug(_configHandler.GetValue("SampleIntegerValue")); - this.logger.WriteDebug(_configHandler.GetValue("SampleStringValue")); - this.logger.WriteDebug(_configHandler.GetValue("SampleFloatValue")); + this.logger.WriteDebug(this.configHandler.GetValue("SampleIntegerValue")); + this.logger.WriteDebug(this.configHandler.GetValue("SampleStringValue")); + this.logger.WriteDebug(this.configHandler.GetValue("SampleFloatValue")); - _configHandler.GetValue("SampleNumericalArray").forEach((element) => { + this.configHandler.GetValue("SampleNumericalArray").forEach((element) => { this.logger.WriteDebug(element); }); - _configHandler.GetValue("SampleStringArray").forEach((element) => { + this.configHandler.GetValue("SampleStringArray").forEach((element) => { this.logger.WriteDebug(element); }); },