SteamWar/BauSystem2.0
Archiviert
12
0

Optimize FlagStorage

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-07-05 10:40:21 +02:00
Ursprung f0565bb7b9
Commit 998d43d6e3

Datei anzeigen

@ -54,10 +54,18 @@ public class FlagStorage {
public static YAPIONObject toYAPION(FlagStorage flagStorage) { public static YAPIONObject toYAPION(FlagStorage flagStorage) {
YAPIONObject yapionObject = new YAPIONObject(); YAPIONObject yapionObject = new YAPIONObject();
for (final Flag flag : Flag.getFlags()) { for (final Flag flag : Flag.getFlags()) {
yapionObject.add(flag.name(), flagStorage.get(flag).getValue().name()); if (flag.getDefaultValue() == flagStorage.flags.getOrDefault(flag, flag.getDefaultValue())) {
yapionObject.remove(flag.name());
} else {
yapionObject.add(flag.name(), flagStorage.get(flag).getValue().name());
}
} }
for (Tag tag : flagStorage.tagSet) { for (Tag tag : Tag.values()) {
yapionObject.add(tag.name(), ""); if (flagStorage.tagSet.contains(tag)) {
yapionObject.add(tag.name(), "");
} else {
yapionObject.remove(tag.name());
}
} }
return yapionObject; return yapionObject;
} }