Refactor skill lookup logic and vote system, update language files
Refactored command handling to improve player and skill lookup logic, replaced some list operations with direct queries, and updated method signatures for clarity and null safety. The vote system was reworked to support more robust vote tracking, cooldowns, and localized chat messages. Language files were updated to add new vote-related translations. Various code style and nullability improvements were made throughout the plugin.
This commit is contained in:
parent
54b265d43d
commit
e33975fe8b
117 changed files with 1532 additions and 1674 deletions
|
|
@ -6,7 +6,7 @@ namespace jRandomSkills.src.utils
|
|||
public static class Localization
|
||||
{
|
||||
private static readonly string path = Path.Combine(jRandomSkills.Instance.ModuleDirectory, "lang");
|
||||
private static readonly Dictionary<string, Dictionary<string, string>> _translations = new Dictionary<string, Dictionary<string, string>>();
|
||||
private static readonly Dictionary<string, Dictionary<string, string>> _translations = [];
|
||||
private static string langCode = "pl";
|
||||
|
||||
public static void Load()
|
||||
|
|
@ -18,7 +18,7 @@ namespace jRandomSkills.src.utils
|
|||
|
||||
private static void SetLangCode()
|
||||
{
|
||||
langCode = Config.config.Settings.LangCode;
|
||||
langCode = Config.LoadedConfig.Settings.LangCode;
|
||||
}
|
||||
|
||||
private static void LoadAllLanguages()
|
||||
|
|
@ -46,7 +46,7 @@ namespace jRandomSkills.src.utils
|
|||
public static string GetTranslation(string key, params object[] args)
|
||||
{
|
||||
if (_translations.TryGetValue(langCode, out var langDict) && langDict.TryGetValue(key, out var translation))
|
||||
if (args.Length != 0 && args[0] == "welcome")
|
||||
if (args.Length != 0 && args[0].ToString() == "welcome")
|
||||
return translation;
|
||||
else
|
||||
return string.Format(translation, args).Replace("CHATCOLORS.RED", ChatColors.Red.ToString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue