mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Made the /execif return boolean as expression evaluation result
This commit is contained in:
parent
77da611411
commit
a0f0c634ff
1 changed files with 4 additions and 4 deletions
|
|
@ -39,14 +39,13 @@ namespace MinecraftClient.Commands
|
|||
foreach (KeyValuePair<string, object> entry in Settings.GetVariables())
|
||||
interpreter.SetVariable(entry.Key, entry.Value);
|
||||
|
||||
Lambda parsedExpression = interpreter.Parse(expressionText);
|
||||
var result = parsedExpression.Invoke();
|
||||
var result = interpreter.Eval<bool>(expressionText);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
bool shouldExec = false;
|
||||
bool shouldExec = result;
|
||||
|
||||
if (result is bool)
|
||||
/*if (result is bool)
|
||||
shouldExec = (bool)result;
|
||||
else if (result is string)
|
||||
shouldExec = !string.IsNullOrEmpty((string)result) && ((string)result).Trim().Contains("true", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
@ -62,6 +61,7 @@ namespace MinecraftClient.Commands
|
|||
shouldExec = (Int32)result > 0;
|
||||
else if (result is Int64)
|
||||
shouldExec = (Int64)result > 0;
|
||||
*/
|
||||
|
||||
handler.Log.Debug("[Execif] Result Type: " + result.GetType().Name);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue