diff --git a/.github/en.md b/.github/en.md
index 22a77a8..ad7ab51 100644
--- a/.github/en.md
+++ b/.github/en.md
@@ -357,6 +357,18 @@ This plugin uses content from the following projects:
## 📋 Changelog
+
+v1.2.2.b4
+
+- #### General:
+ - ###### Updated the GitHub source code to implement the changes introduced in merge request (https://github.com/Juzlus/jRandomSkills/pull/32).
+
+- #### Skill improvements:
+ - ###### Ninja:
+ - ###### Removed debug chat messages that were used for testing.
+
+
+
v1.2.2.b3
diff --git a/.github/pl.md b/.github/pl.md
index d72859c..5f548ac 100644
--- a/.github/pl.md
+++ b/.github/pl.md
@@ -355,6 +355,18 @@ Plugin korzysta z zawartości następujących projektów:
## 📋 Lista Zmian
+
+v1.2.2.b4
+
+- #### General:
+ - Ogólne Uaktualizowano kod źródłowy na GitHubie, aby uwzględniał zmiany wprowadzone w merge request: https://github.com/Juzlus/jRandomSkills/pull/32.
+
+- #### Poprawki mocy:
+ - ###### Ninja:
+ - ###### Usunięto wiadomości z czatu używane do celów testowych.
+
+
+
v1.2.2.b3
diff --git a/jRandomSkills - SRC Files/jRandomSkills.csproj b/jRandomSkills - SRC Files/jRandomSkills.csproj
index ad9f274..33a5330 100644
--- a/jRandomSkills - SRC Files/jRandomSkills.csproj
+++ b/jRandomSkills - SRC Files/jRandomSkills.csproj
@@ -12,9 +12,6 @@
-
-
-
@@ -53,7 +50,7 @@
$(MSBuildProjectDirectory)\src\lang
$(MSBuildProjectDirectory)\..\jRandomSkills - Server Files\plugins\jRandomSkills\languages
- $(MSBuildProjectDirectory)\bin\Debug\net10.0
+ $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)
$(MSBuildProjectDirectory)\..\jRandomSkills - Server Files\plugins\jRandomSkills
$(MSBuildProjectDirectory)\src\gamedata
$(MSBuildProjectDirectory)\..\jRandomSkills - Server Files\gamedata
diff --git a/jRandomSkills - SRC Files/src/command/Command.cs b/jRandomSkills - SRC Files/src/command/Command.cs
index db40d62..f49cbc5 100644
--- a/jRandomSkills - SRC Files/src/command/Command.cs
+++ b/jRandomSkills - SRC Files/src/command/Command.cs
@@ -2,7 +2,6 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
-using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using src.menu;
@@ -24,7 +23,7 @@ namespace src.command
public static void Load()
{
config = Config.LoadedConfig;
- if (config == null || config == null) return;
+ if (config == null) return;
lock (setLock)
{
@@ -201,7 +200,7 @@ namespace src.command
private static void ChangeMap(CommandInfo command)
{
- string map = command.GetArg(1).ToLower();
+ string map = command.GetArg(1).ToLowerInvariant();
if (string.IsNullOrEmpty(map))
{
@@ -549,7 +548,7 @@ namespace src.command
if (langInfo.IsoCodes.Contains(newLangCode))
fileName = langInfo.FileName;
if (Localization.HasTranslation(newLangCode))
- fileName = newLangCode.ToLower();
+ fileName = newLangCode.ToLowerInvariant();
Localization.ChangePlayerLanguage(player, fileName);
}
diff --git a/jRandomSkills - SRC Files/src/jRandomSkills.cs b/jRandomSkills - SRC Files/src/jRandomSkills.cs
index 160b1c6..d90254b 100644
--- a/jRandomSkills - SRC Files/src/jRandomSkills.cs
+++ b/jRandomSkills - SRC Files/src/jRandomSkills.cs
@@ -28,7 +28,7 @@ namespace src
public override string ModuleName => "[CS2] [ jRandomSkills ]";
public override string ModuleAuthor => "D3X, Juzlus";
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
- public override string ModuleVersion => "1.2.2.b2";
+ public override string ModuleVersion => "1.2.2.b4";
public override void Load(bool hotReload)
{
@@ -78,43 +78,38 @@ namespace src
Debug.WriteToDebug($"Loaded: {skill.Skill}");
}
+ private static readonly ConcurrentDictionary<(string Skill, string Method), MethodInfo?> _skillMethodCache = new();
+
internal object? SkillAction(string skill, string methodName, object[]? param = null)
{
if (string.IsNullOrEmpty(skill))
return null;
- string className = $"src.player.skills.{skill}";
-
- Type? type = Type.GetType(className)
- ?? Assembly.GetExecutingAssembly().GetType(className)
- ?? AppDomain.CurrentDomain.GetAssemblies()
- .SelectMany(a =>
- {
- try { return a.GetTypes(); }
- catch (ReflectionTypeLoadException ex) { return ex.Types.Where(t => t!= null)!; }
- catch { return []; }
- })
- .FirstOrDefault(t => t != null && string.Equals(t.FullName, className, StringComparison.Ordinal));
-
- if (type != null && typeof(ISkill).IsAssignableFrom(type))
+ var method = _skillMethodCache.GetOrAdd((skill, methodName), key =>
{
- MethodInfo? method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public);
- return method?.Invoke(null, param);
- }
- else
- Server.PrintToConsole($"Could not find or load {className}");
+ string className = $"src.player.skills.{key.Skill}";
- return null;
- }
+ Type? type = Type.GetType(className)
+ ?? Assembly.GetExecutingAssembly().GetType(className)
+ ?? AppDomain.CurrentDomain.GetAssemblies()
+ .SelectMany(a =>
+ {
+ try { return a.GetTypes(); }
+ catch (ReflectionTypeLoadException ex) { return ex.Types.Where(t => t != null)!; }
+ catch { return []; }
+ })
+ .FirstOrDefault(t => t != null && string.Equals(t.FullName, className, StringComparison.Ordinal));
- internal void RegisterListener(Action onTick, HookMode pre)
- {
- throw new NotImplementedException();
- }
+ if (type == null || !typeof(ISkill).IsAssignableFrom(type))
+ {
+ Server.PrintToConsole($"Could not find or load {className}");
+ return null;
+ }
- internal void RegisterListener(Action