SteamWar/BauSystem2.0
Archiviert
12
0

Update Greater and Less
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-02-02 11:45:33 +01:00
Ursprung d2bbcc2d98
Commit 0162ed7d92
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -44,16 +44,16 @@ public class Greater implements SpecialCommand {
Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]); Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]); Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
if (!(v1 instanceof Value.LongValue)) { if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer()); BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
return true; return true;
} }
if (!(v2 instanceof Value.LongValue)) { if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer()); BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
return true; return true;
} }
Value result; Value result;
if (v1.asLong() > v2.asLong()) { if (v1.asDouble() > v2.asDouble()) {
result = new Value.BooleanValue(true); result = new Value.BooleanValue(true);
} else { } else {
result = new Value.BooleanValue(false); result = new Value.BooleanValue(false);

Datei anzeigen

@ -44,16 +44,16 @@ public class Less implements SpecialCommand {
Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]); Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]); Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
if (!(v1 instanceof Value.LongValue)) { if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer()); BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
return true; return true;
} }
if (!(v2 instanceof Value.LongValue)) { if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer()); BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
return true; return true;
} }
Value result; Value result;
if (v1.asLong() < v2.asLong()) { if (v1.asDouble() < v2.asDouble()) {
result = new Value.BooleanValue(true); result = new Value.BooleanValue(true);
} else { } else {
result = new Value.BooleanValue(false); result = new Value.BooleanValue(false);