mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Refactoring Settings.cs
This commit is contained in:
parent
f16b1c118b
commit
16c1d1fd77
59 changed files with 3425 additions and 2180 deletions
|
|
@ -138,7 +138,7 @@ namespace MinecraftClient.Commands
|
|||
|
||||
|
||||
// \ud83d\udd33: 🔳, \ud83d\udfe8: 🟨, \ud83d\udfe9: 🟩, \u25A1: □, \u25A3: ▣, \u25A0: ■
|
||||
string[] chunkStatusStr = Settings.EnableEmoji ?
|
||||
string[] chunkStatusStr = Settings.Config.Main.Advanced.EnableEmoji ?
|
||||
new string[] { "\ud83d\udd33", "\ud83d\udfe8", "\ud83d\udfe9" } : new string[] { "\u25A1", "\u25A3", "\u25A0" };
|
||||
|
||||
// Output
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ namespace MinecraftClient.Commands
|
|||
string[] args = GetArgs(command);
|
||||
if (args.Length > 1)
|
||||
{
|
||||
if (!Settings.SetAccount(args[1]))
|
||||
if (!Settings.Config.Main.Advanced.SetAccount(args[1]))
|
||||
{
|
||||
return Translations.Get("cmd.connect.unknown", args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.SetServerIP(args[0]))
|
||||
if (Settings.Config.Main.SetServerIP(new Settings.MainConfigHealper.MainConfig.ServerInfoConfig(args[0]), true))
|
||||
{
|
||||
Program.Restart();
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -11,11 +11,10 @@ namespace MinecraftClient.Commands
|
|||
public override string Run(McClient handler, string command, Dictionary<string, object>? localVars)
|
||||
{
|
||||
if (HasArg(command))
|
||||
{
|
||||
Settings.DebugMessages = (GetArg(command).ToLower() == "on");
|
||||
}
|
||||
else Settings.DebugMessages = !Settings.DebugMessages;
|
||||
return Translations.Get(Settings.DebugMessages ? "cmd.debug.state_on" : "cmd.debug.state_off");
|
||||
Settings.Config.Logging.DebugMessages = (GetArg(command).ToLower() == "on");
|
||||
else
|
||||
Settings.Config.Logging.DebugMessages = !Settings.Config.Logging.DebugMessages;
|
||||
return Translations.Get(Settings.Config.Logging.DebugMessages ? "cmd.debug.state_on" : "cmd.debug.state_off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace MinecraftClient.Commands
|
|||
var interpreter = new Interpreter();
|
||||
interpreter.SetVariable("MCC", handler);
|
||||
|
||||
foreach (KeyValuePair<string, object> entry in Settings.GetVariables())
|
||||
foreach (KeyValuePair<string, object> entry in Settings.Config.AppVar.GetVariables())
|
||||
interpreter.SetVariable(entry.Key, entry.Value);
|
||||
|
||||
var result = interpreter.Eval<bool>(expressionText);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ namespace MinecraftClient.Commands
|
|||
response.AppendLine(String.Format(" #{0} - {1}§8", inventoryId, inventory.Title));
|
||||
|
||||
string? asciiArt = inventory.Type.GetAsciiArt();
|
||||
if (asciiArt != null && Settings.DisplayInventoryLayout)
|
||||
if (asciiArt != null && Settings.Config.Main.Advanced.ShowInventoryLayout)
|
||||
response.AppendLine(asciiArt);
|
||||
|
||||
int selectedHotbar = handler.GetCurrentSlot() + 1;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ namespace MinecraftClient.Commands
|
|||
else if (args[0] == "gravity")
|
||||
{
|
||||
if (args.Count >= 2)
|
||||
Settings.GravityEnabled = (args[1] == "on");
|
||||
if (Settings.GravityEnabled)
|
||||
Settings.InternalConfig.GravityEnabled = (args[1] == "on");
|
||||
if (Settings.InternalConfig.GravityEnabled)
|
||||
return Translations.Get("cmd.move.gravity.enabled");
|
||||
else return Translations.Get("cmd.move.gravity.disabled");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
|||
string[] args = GetArgs(command);
|
||||
if (args.Length > 0)
|
||||
{
|
||||
if (!Settings.SetAccount(args[0]))
|
||||
if (!Settings.Config.Main.Advanced.SetAccount(args[0]))
|
||||
{
|
||||
return Translations.Get("cmd.connect.unknown", args[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ namespace MinecraftClient.Commands
|
|||
string[] temp = GetArg(command).Split('=');
|
||||
if (temp.Length > 1)
|
||||
{
|
||||
if (Settings.SetVar(temp[0], GetArg(command).Substring(temp[0].Length + 1)))
|
||||
{
|
||||
if (Settings.Config.AppVar.SetVar(temp[0], GetArg(command).Substring(temp[0].Length + 1)))
|
||||
return ""; //Success
|
||||
}
|
||||
else return Translations.Get("cmd.set.format");
|
||||
else
|
||||
return Translations.Get("cmd.set.format");
|
||||
}
|
||||
else return GetCmdDescTranslated();
|
||||
else
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
else return GetCmdDescTranslated();
|
||||
else
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ namespace MinecraftClient.Commands
|
|||
(num2, num1) = (num1, num2);
|
||||
|
||||
// create a variable or set it to num1 <= varlue < num2
|
||||
if (Settings.SetVar(args[0], rand.Next(num1, num2)))
|
||||
if (Settings.Config.AppVar.SetVar(args[0], rand.Next(num1, num2)))
|
||||
{
|
||||
return string.Format("Set %{0}% to {1}.", args[0], Settings.GetVar(args[0])); //Success
|
||||
return string.Format("Set %{0}% to {1}.", args[0], Settings.Config.AppVar.GetVar(args[0])); //Success
|
||||
}
|
||||
else return Translations.Get("cmd.setrndnum.format");
|
||||
}
|
||||
|
|
@ -55,9 +55,9 @@ namespace MinecraftClient.Commands
|
|||
List<string> values = ParseCommandLine(argString);
|
||||
|
||||
// create a variable or set it to one of the values
|
||||
if (values.Count > 0 && Settings.SetVar(args[0], values[rand.Next(0, values.Count)]))
|
||||
if (values.Count > 0 && Settings.Config.AppVar.SetVar(args[0], values[rand.Next(0, values.Count)]))
|
||||
{
|
||||
return string.Format("Set %{0}% to {1}.", args[0], Settings.GetVar(args[0])); //Success
|
||||
return string.Format("Set %{0}% to {1}.", args[0], Settings.Config.AppVar.GetVar(args[0])); //Success
|
||||
}
|
||||
else return Translations.Get("cmd.setrndstr.format");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue