1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,6 @@ import net.minecraft.util.InclusiveRange;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.FeatureFlag;
|
||||
import org.bukkit.NamespacedKey;
|
||||
// import org.bukkit.craftbukkit.CraftFeatureFlag; // Paper - replace feature flag API
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.packs.DataPack;
|
||||
@@ -23,8 +22,8 @@ public class CraftDataPack implements DataPack {
|
||||
|
||||
public CraftDataPack(Pack handler) {
|
||||
this.handle = handler;
|
||||
try (PackResources iresourcepack = this.handle.resources.openPrimary(this.handle.location())) {
|
||||
this.resourcePackInfo = iresourcepack.getMetadataSection(PackMetadataSection.TYPE);
|
||||
try (PackResources packResources = this.handle.resources.openPrimary(this.handle.location())) {
|
||||
this.resourcePackInfo = packResources.getMetadataSection(PackMetadataSection.TYPE);
|
||||
} catch (IOException e) { // This is already called in NMS then if in NMS not happen is secure this not throw here
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -55,12 +54,12 @@ public class CraftDataPack implements DataPack {
|
||||
|
||||
@Override
|
||||
public int getMinSupportedPackFormat() {
|
||||
return this.resourcePackInfo.supportedFormats().orElse(new InclusiveRange<>(this.getPackFormat())).minInclusive();
|
||||
return this.resourcePackInfo.supportedFormats().map(InclusiveRange::minInclusive).orElse(this.getPackFormat());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSupportedPackFormat() {
|
||||
return this.resourcePackInfo.supportedFormats().orElse(new InclusiveRange<>(this.getPackFormat())).maxInclusive();
|
||||
return this.resourcePackInfo.supportedFormats().map(InclusiveRange::maxInclusive).orElse(this.getPackFormat());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +97,7 @@ public class CraftDataPack implements DataPack {
|
||||
|
||||
@Override
|
||||
public Set<FeatureFlag> getRequestedFeatures() {
|
||||
return io.papermc.paper.world.flag.PaperFeatureFlagProviderImpl.fromNms(this.getHandle().getRequestedFeatures()); // Paper - replace feature flag API
|
||||
return io.papermc.paper.world.flag.PaperFeatureFlagProviderImpl.fromNms(this.getHandle().getRequestedFeatures());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user