Skip to content

Commit cc88dd0

Browse files
Fixed String problems with Optional
1 parent 3413ac4 commit cc88dd0

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/main/java/anticope/rejects/settings/StringMapSetting.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ protected NbtCompound save(NbtCompound tag) {
7373
protected Map<String, String> load(NbtCompound tag) {
7474
get().clear();
7575

76-
Optional<NbtCompound> valueTag = tag.getCompound("map");
77-
for (String key : valueTag.get().getKeys()) {
78-
get().put(key, String.valueOf(valueTag.get().getString(key)));
76+
NbtCompound valueTag = tag.getCompoundOrEmpty("map");
77+
for (String key : valueTag.getKeys()) {
78+
get().put(key, String.valueOf(valueTag.getString(key)));
7979
}
8080

8181
return get();

src/main/java/anticope/rejects/utils/seeds/Seed.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import net.minecraft.text.*;
99
import net.minecraft.util.Formatting;
1010

11-
import java.util.Optional;
12-
1311
public class Seed {
1412
public final Long seed;
1513
public final MCVersion version;
@@ -28,10 +26,10 @@ public NbtCompound toTag() {
2826
return tag;
2927
}
3028

31-
public static Seed fromTag(Optional<NbtCompound> tag) {
29+
public static Seed fromTag(NbtCompound tag) {
3230
return new Seed(
33-
tag.get().getLong("seed", 1),
34-
MCVersion.fromString(String.valueOf(tag.get().getString("version")))
31+
tag.getLong("seed", 1),
32+
MCVersion.fromString(String.valueOf(tag.getString("version")))
3533
);
3634
}
3735

src/main/java/anticope/rejects/utils/seeds/Seeds.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public NbtCompound toTag() {
8383
@Override
8484
public Seeds fromTag(NbtCompound tag) {
8585
tag.getKeys().forEach(key -> {
86-
seeds.put(key, Seed.fromTag(tag.getCompound(key)));
86+
seeds.put(key, Seed.fromTag(tag.getCompoundOrEmpty(key)));
8787
});
8888
return this;
8989
}

0 commit comments

Comments
 (0)