Fix variable resolution order
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-12-23 22:52:11 +01:00
Ursprung 397de5e08a
Commit 1058a49f1f

Datei anzeigen

@ -5,8 +5,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.session.SessionKey;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.script.expression.Expression;
import de.steamwar.bausystem.features.script.expression.UnknownOperatorException;
@ -251,24 +249,24 @@ public final class ScriptExecutor {
return Value.parse(variable);
}
if (Constants.isConstant(variable)) {
return Constants.getConstant(variable, player);
if (localVariables.hasValue(variable)) {
return localVariables.getValue(variable);
}
if (globalVariables.hasValue(variable)) {
return globalVariables.getValue(variable);
}
return localVariables.getValue(variable);
return Constants.getConstant(variable, player);
}
public Value getValueOrNull(String variable) {
if (Constants.isConstant(variable)) {
return Constants.getConstant(variable, player);
if (localVariables.hasValue(variable)) {
return localVariables.getValue(variable);
}
if (globalVariables.hasValue(variable)) {
return globalVariables.getValue(variable);
}
if (localVariables.hasValue(variable)) {
return localVariables.getValue(variable);
if (Constants.isConstant(variable)) {
return Constants.getConstant(variable, player);
}
return null;
}
@ -285,14 +283,14 @@ public final class ScriptExecutor {
}
public String getValue(String variable) {
if (Constants.isConstant(variable)) {
return Constants.getConstant(variable, player).asString();
if (localVariables.hasValue(variable)) {
return localVariables.getValue(variable).asString();
}
if (globalVariables.hasValue(variable)) {
return globalVariables.getValue(variable).asString();
}
if (localVariables.hasValue(variable)) {
return localVariables.getValue(variable).asString();
if (Constants.isConstant(variable)) {
return Constants.getConstant(variable, player).asString();
}
return "";
}