Skip to content

Commit

Permalink
Use Paper's Datapack API in spark-paper (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
granny authored Sep 25, 2024
1 parent 72880dd commit dce652c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spark-paper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -107,14 +108,14 @@ public GameRulesResult pollGameRules() {
return data;
}

@SuppressWarnings("removal")
@Override
public Collection<DataPackInfo> 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());
}
Expand Down

0 comments on commit dce652c

Please sign in to comment.