SteamWar/BauSystem2.0
Archiviert
12
0

Implement writeBack to JsonObject in FlagStorage

Dieser Commit ist enthalten in:
yoyosource 2021-04-18 01:04:14 +02:00
Ursprung ffd0bd7515
Commit 0040f2c40d

Datei anzeigen

@ -38,7 +38,11 @@ public class FlagStorage {
}
public boolean set(final Flag flagType, final Flag.Value<?> value) {
return flags.put(flagType, value) != value;
if (flags.put(flagType, value) != value) {
writeChangedKey(flagType, value);
return true;
}
return false;
}
@SuppressWarnings("unchecked")
@ -52,4 +56,8 @@ public class FlagStorage {
flags.put(flag, flagValue == null ? flag.getDefaultValue() : flag.getFlagValueOf(flagValue.getAsString().toUpperCase()));
}
}
private void writeChangedKey(Flag flag, Flag.Value<?> value) {
jsonObject.add(flag.name().toLowerCase(), new JsonPrimitive(value.getValue().getName()));
}
}