3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 01:40:06 +01:00

Use new language features

Dieser Commit ist enthalten in:
dordsor21 2021-12-29 16:12:43 +00:00
Ursprung 0d79d084a5
Commit e2a1721a5c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 28 neuen und 38 gelöschten Zeilen

Datei anzeigen

@ -66,8 +66,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public double asDouble(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsDouble();
if (tag instanceof NumericTag numTag) {
return numTag.getAsDouble();
}
return 0;
}
@ -86,20 +86,19 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public int asInt(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsInt();
if (tag instanceof NumericTag numTag) {
return numTag.getAsInt();
}
return 0;
}
public List<Tag> getList(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof net.minecraft.nbt.ListTag) {
if (tag instanceof net.minecraft.nbt.ListTag nbtList) {
ArrayList<Tag> list = new ArrayList<>();
net.minecraft.nbt.ListTag nbtList = (net.minecraft.nbt.ListTag) tag;
for (net.minecraft.nbt.Tag elem : nbtList) {
if (elem instanceof net.minecraft.nbt.CompoundTag) {
list.add(new PaperweightLazyCompoundTag((net.minecraft.nbt.CompoundTag) elem));
if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) {
list.add(new PaperweightLazyCompoundTag(compoundTag));
} else {
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
}
@ -137,8 +136,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public long asLong(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsLong();
if (tag instanceof NumericTag numTag) {
return numTag.getAsLong();
}
return 0;
}

Datei anzeigen

@ -414,15 +414,11 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
}
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
switch (env) {
case NETHER:
return LevelStem.NETHER;
case THE_END:
return LevelStem.END;
case NORMAL:
default:
return LevelStem.OVERWORLD;
}
return switch (env) {
case NETHER -> LevelStem.NETHER;
case THE_END -> LevelStem.END;
default -> LevelStem.OVERWORLD;
};
}
private BiomeSource fastOverworldBiomeSource(BiomeSource biomeSource) throws Exception {

Datei anzeigen

@ -66,8 +66,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public double asDouble(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsDouble();
if (tag instanceof NumericTag numTag) {
return numTag.getAsDouble();
}
return 0;
}
@ -86,20 +86,19 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public int asInt(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsInt();
if (tag instanceof NumericTag numTag) {
return numTag.getAsInt();
}
return 0;
}
public List<Tag> getList(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof net.minecraft.nbt.ListTag) {
if (tag instanceof net.minecraft.nbt.ListTag nbtList) {
ArrayList<Tag> list = new ArrayList<>();
net.minecraft.nbt.ListTag nbtList = (net.minecraft.nbt.ListTag) tag;
for (net.minecraft.nbt.Tag elem : nbtList) {
if (elem instanceof net.minecraft.nbt.CompoundTag) {
list.add(new PaperweightLazyCompoundTag((net.minecraft.nbt.CompoundTag) elem));
if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) {
list.add(new PaperweightLazyCompoundTag(compoundTag));
} else {
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
}
@ -138,8 +137,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
public long asLong(String key) {
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
if (tag instanceof NumericTag) {
return ((NumericTag) tag).getAsLong();
if (tag instanceof NumericTag numTag) {
return numTag.getAsLong();
}
return 0;
}

Datei anzeigen

@ -397,15 +397,11 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
}
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
switch (env) {
case NETHER:
return LevelStem.NETHER;
case THE_END:
return LevelStem.END;
case NORMAL:
default:
return LevelStem.OVERWORLD;
}
return switch (env) {
case NETHER -> LevelStem.NETHER;
case THE_END -> LevelStem.END;
default -> LevelStem.OVERWORLD;
};
}
private static class RegenNoOpWorldLoadListener implements ChunkProgressListener {