From dce652c46894631e3936c383c2efe21c51de6476 Mon Sep 17 00:00:00 2001 From: granny Date: Wed, 25 Sep 2024 01:12:45 -0700 Subject: [PATCH] Use Paper's Datapack API in spark-paper (#459) --- spark-paper/build.gradle | 2 +- .../me/lucko/spark/paper/PaperWorldInfoProvider.java | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spark-paper/build.gradle b/spark-paper/build.gradle index 4ca3dd62..dde868cb 100644 --- a/spark-paper/build.gradle +++ b/spark-paper/build.gradle @@ -15,7 +15,7 @@ tasks.jar { dependencies { implementation project(':spark-common') - compileOnly 'io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT' + compileOnly 'io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT' } repositories { diff --git a/spark-paper/src/main/java/me/lucko/spark/paper/PaperWorldInfoProvider.java b/spark-paper/src/main/java/me/lucko/spark/paper/PaperWorldInfoProvider.java index 1729a95f..4670be10 100644 --- a/spark-paper/src/main/java/me/lucko/spark/paper/PaperWorldInfoProvider.java +++ b/spark-paper/src/main/java/me/lucko/spark/paper/PaperWorldInfoProvider.java @@ -23,6 +23,7 @@ import me.lucko.spark.common.platform.world.AbstractChunkInfo; import me.lucko.spark.common.platform.world.CountMap; import me.lucko.spark.common.platform.world.WorldInfoProvider; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.bukkit.Chunk; import org.bukkit.GameRule; import org.bukkit.Server; @@ -107,14 +108,14 @@ public GameRulesResult pollGameRules() { return data; } - @SuppressWarnings("removal") @Override public Collection pollDataPacks() { - return this.server.getDataPackManager().getDataPacks().stream() + this.server.getDatapackManager().refreshPacks(); + return this.server.getDatapackManager().getPacks().stream() .map(pack -> new DataPackInfo( - pack.getTitle(), - pack.getDescription(), - pack.getSource().name().toLowerCase(Locale.ROOT).replace("_", "") + PlainTextComponentSerializer.plainText().serialize(pack.getTitle()), + PlainTextComponentSerializer.plainText().serialize(pack.getDescription()), + pack.getSource().toString().toLowerCase(Locale.ROOT).replace("_", "") )) .collect(Collectors.toList()); }