aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spark-bukkit/build.gradle6
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java3
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java29
-rw-r--r--spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/BungeeCordSparkPlugin.java3
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/platform/world/AsyncWorldInfoProvider.java9
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldInfoProvider.java37
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldStatisticsProvider.java11
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/sampler/source/SourceMetadata.java20
-rw-r--r--spark-common/src/main/proto/spark/spark.proto8
-rw-r--r--spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java2
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/FabricExtraMetadataProvider.java73
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/FabricWorldInfoProvider.java41
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java7
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java7
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java3
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java73
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeWorldInfoProvider.java41
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java7
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java7
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java3
-rw-r--r--spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeExtraMetadataProvider.java73
-rw-r--r--spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeWorldInfoProvider.java41
-rw-r--r--spark-neoforge/src/main/java/me/lucko/spark/neoforge/plugin/NeoForgeClientSparkPlugin.java7
-rw-r--r--spark-neoforge/src/main/java/me/lucko/spark/neoforge/plugin/NeoForgeServerSparkPlugin.java7
-rw-r--r--spark-neoforge/src/main/java/me/lucko/spark/neoforge/plugin/NeoForgeSparkPlugin.java3
-rw-r--r--spark-paper/src/main/java/me/lucko/spark/paper/PaperSparkPlugin.java4
-rw-r--r--spark-paper/src/main/java/me/lucko/spark/paper/PaperWorldInfoProvider.java15
-rw-r--r--spark-sponge7/src/main/java/me/lucko/spark/sponge/Sponge7WorldInfoProvider.java6
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java3
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java13
-rw-r--r--spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java3
-rw-r--r--spark-velocity4/src/main/java/me/lucko/spark/velocity/Velocity4SparkPlugin.java3
-rw-r--r--spark-waterdog/src/main/java/me/lucko/spark/waterdog/WaterdogSparkPlugin.java3
33 files changed, 290 insertions, 281 deletions
diff --git a/spark-bukkit/build.gradle b/spark-bukkit/build.gradle
index 99f3871..da46dc3 100644
--- a/spark-bukkit/build.gradle
+++ b/spark-bukkit/build.gradle
@@ -2,10 +2,14 @@ plugins {
id 'com.gradleup.shadow' version '8.3.0'
}
+java {
+ disableAutoTargetJvm()
+}
+
dependencies {
implementation project(':spark-common')
implementation 'net.kyori:adventure-platform-bukkit:4.3.3'
- compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT'
+ compileOnly 'io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT'
// placeholders
compileOnly 'me.clip:placeholderapi:2.10.3'
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
index dc87fce..afab555 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java
@@ -188,7 +188,8 @@ public class BukkitSparkPlugin extends JavaPlugin implements SparkPlugin {
Arrays.asList(getServer().getPluginManager().getPlugins()),
Plugin::getName,
plugin -> plugin.getDescription().getVersion(),
- plugin -> String.join(", ", plugin.getDescription().getAuthors())
+ plugin -> String.join(", ", plugin.getDescription().getAuthors()),
+ plugin -> plugin.getDescription().getDescription()
);
}
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
index be04640..303cc3e 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
@@ -32,12 +32,16 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
+import java.util.Locale;
import java.util.Objects;
+import java.util.stream.Collectors;
public class BukkitWorldInfoProvider implements WorldInfoProvider {
private static final boolean SUPPORTS_PAPER_COUNT_METHODS;
private static final boolean SUPPORTS_GAMERULES;
+ private static final boolean SUPPORTS_DATAPACKS;
static {
boolean supportsPaperCountMethods = false;
@@ -59,8 +63,17 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider {
// ignored
}
+ boolean supportsDataPacks = false;
+ try {
+ Server.class.getMethod("getDataPackManager");
+ supportsDataPacks = true;
+ } catch (Exception e) {
+ // ignored
+ }
+
SUPPORTS_PAPER_COUNT_METHODS = supportsPaperCountMethods;
SUPPORTS_GAMERULES = supportsGameRules;
+ SUPPORTS_DATAPACKS = supportsDataPacks;
}
private final Server server;
@@ -155,6 +168,22 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider {
return data;
}
+ @SuppressWarnings("removal")
+ @Override
+ public Collection<DataPackInfo> pollDataPacks() {
+ if (!SUPPORTS_DATAPACKS) {
+ return null;
+ }
+
+ return this.server.getDataPackManager().getDataPacks().stream()
+ .map(pack -> new DataPackInfo(
+ pack.getTitle(),
+ pack.getDescription(),
+ pack.getSource().name().toLowerCase(Locale.ROOT).replace("_", "")
+ ))
+ .collect(Collectors.toList());
+ }
+
static final class BukkitChunkInfo extends AbstractChunkInfo<EntityType> {
private final CountMap<EntityType> entityCounts;
diff --git a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/BungeeCordSparkPlugin.java b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/BungeeCordSparkPlugin.java
index 11f64db..85d72c7 100644
--- a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/BungeeCordSparkPlugin.java
+++ b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/BungeeCordSparkPlugin.java
@@ -98,7 +98,8 @@ public class BungeeCordSparkPlugin extends Plugin implements SparkPlugin {
getProxy().getPluginManager().getPlugins(),
plugin -> plugin.getDescription().getName(),
plugin -> plugin.getDescription().getVersion(),
- plugin -> plugin.getDescription().getAuthor()
+ plugin -> plugin.getDescription().getAuthor(),
+ plugin -> plugin.getDescription().getDescription()
);
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/world/AsyncWorldInfoProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/world/AsyncWorldInfoProvider.java
index 0f48b2e..707097a 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/platform/world/AsyncWorldInfoProvider.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/platform/world/AsyncWorldInfoProvider.java
@@ -23,6 +23,7 @@ package me.lucko.spark.common.platform.world;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
+import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@@ -84,6 +85,10 @@ public class AsyncWorldInfoProvider {
return async(WorldInfoProvider::pollGameRules);
}
+ public CompletableFuture<Collection<WorldInfoProvider.DataPackInfo>> pollDataPacks() {
+ return async(WorldInfoProvider::pollDataPacks);
+ }
+
public WorldInfoProvider.CountsResult getCounts() {
return get(pollCounts());
}
@@ -95,4 +100,8 @@ public class AsyncWorldInfoProvider {
public WorldInfoProvider.GameRulesResult getGameRules() {
return get(pollGameRules());
}
+
+ public Collection<WorldInfoProvider.DataPackInfo> getDataPacks() {
+ return get(pollDataPacks());
+ }
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldInfoProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldInfoProvider.java
index e360ea4..457f8c9 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldInfoProvider.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldInfoProvider.java
@@ -20,6 +20,7 @@
package me.lucko.spark.common.platform.world;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -44,6 +45,11 @@ public interface WorldInfoProvider {
public GameRulesResult pollGameRules() {
return null;
}
+
+ @Override
+ public Collection<DataPackInfo> pollDataPacks() {
+ return null;
+ }
};
/**
@@ -67,6 +73,13 @@ public interface WorldInfoProvider {
*/
GameRulesResult pollGameRules();
+ /**
+ * Polls for data packs.
+ *
+ * @return the data packs
+ */
+ Collection<DataPackInfo> pollDataPacks();
+
default boolean mustCallSync() {
return true;
}
@@ -146,4 +159,28 @@ public interface WorldInfoProvider {
}
}
+ final class DataPackInfo {
+ private final String name;
+ private final String description;
+ private final String source;
+
+ public DataPackInfo(String name, String description, String source) {
+ this.name = name;
+ this.description = description;
+ this.source = source;
+ }
+
+ public String name() {
+ return this.name;
+ }
+
+ public String description() {
+ return this.description;
+ }
+
+ public String source() {
+ return this.source;
+ }
+ }
+
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldStatisticsProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldStatisticsProvider.java
index 5d00037..58183a0 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldStatisticsProvider.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/platform/world/WorldStatisticsProvider.java
@@ -23,6 +23,7 @@ package me.lucko.spark.common.platform.world;
import me.lucko.spark.proto.SparkProtos.WorldStatistics;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -80,6 +81,16 @@ public class WorldStatisticsProvider {
));
}
+ Collection<WorldInfoProvider.DataPackInfo> dataPacks = this.provider.getDataPacks();
+ if (dataPacks != null) {
+ dataPacks.forEach(dataPack -> stats.addDataPacks(WorldStatistics.DataPack.newBuilder()
+ .setName(dataPack.name())
+ .setDescription(dataPack.description())
+ .setSource(dataPack.source())
+ .build()
+ ));
+ }
+
return stats.build();
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/source/SourceMetadata.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/source/SourceMetadata.java
index 9410b80..d023a68 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/sampler/source/SourceMetadata.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/source/SourceMetadata.java
@@ -33,15 +33,16 @@ import java.util.function.Function;
*/
public class SourceMetadata {
- public static <T> List<SourceMetadata> gather(Collection<T> sources, Function<? super T, String> nameFunction, Function<? super T, String> versionFunction, Function<? super T, String> authorFunction) {
+ public static <T> List<SourceMetadata> gather(Collection<T> sources, Function<? super T, String> name, Function<? super T, String> version, Function<? super T, String> author, Function<? super T, String> description) {
ImmutableList.Builder<SourceMetadata> builder = ImmutableList.builder();
for (T source : sources) {
- String name = nameFunction.apply(source);
- String version = versionFunction.apply(source);
- String author = authorFunction.apply(source);
-
- SourceMetadata metadata = new SourceMetadata(name, version, author);
+ SourceMetadata metadata = new SourceMetadata(
+ name.apply(source),
+ version.apply(source),
+ author.apply(source),
+ description.apply(source)
+ );
builder.add(metadata);
}
@@ -51,11 +52,13 @@ public class SourceMetadata {
private final String name;
private final String version;
private final String author;
+ private final String description;
- public SourceMetadata(String name, String version, String author) {
+ public SourceMetadata(String name, String version, String author, String description) {
this.name = name;
this.version = version;
this.author = author;
+ this.description = description;
}
public String getName() {
@@ -78,6 +81,9 @@ public class SourceMetadata {
if (this.author != null) {
builder.setAuthor(this.author);
}
+ if (this.description != null) {
+ builder.setDescription(this.description);
+ }
return builder.build();
}
diff --git a/spark-common/src/main/proto/spark/spark.proto b/spark-common/src/main/proto/spark/spark.proto
index 779b3c6..f8d7988 100644
--- a/spark-common/src/main/proto/spark/spark.proto
+++ b/spark-common/src/main/proto/spark/spark.proto
@@ -158,6 +158,7 @@ message WorldStatistics {
map<string, int32> entity_counts = 2;
repeated World worlds = 3;
repeated GameRule game_rules = 4;
+ repeated DataPack data_packs = 5;
message World {
string name = 1;
@@ -182,6 +183,12 @@ message WorldStatistics {
string default_value = 2;
map<string, string> world_values = 3;
}
+
+ message DataPack {
+ string name = 1;
+ string description = 2;
+ string source = 3;
+ }
}
message WindowStatistics {
@@ -227,6 +234,7 @@ message PluginOrModMetadata {
string name = 1;
string version = 2;
string author = 3;
+ string description = 4;
}
message HealthData {
diff --git a/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java b/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
index f1534a8..52477ce 100644
--- a/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
+++ b/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
@@ -94,7 +94,7 @@ public class NodeTest {
}
@Test
- public void testToProto() {
+ public void testExport() {
ThreadNode threadNode = new ThreadNode("Test Thread");
threadNode.log(STACK_TRACE_DESCRIBER, STACK_1, TimeUnit.SECONDS.toMicros(1), WINDOW);
threadNode.log(STACK_TRACE_DESCRIBER, STACK_1, TimeUnit.SECONDS.toMicros(1), WINDOW + 1);
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricExtraMetadataProvider.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricExtraMetadataProvider.java
deleted file mode 100644
index a6f70a6..0000000
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricExtraMetadataProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of spark.
- *
- * Copyright (c) lucko (Luck) <luck@lucko.me>
- * Copyright (c) contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package me.lucko.spark.fabric;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import me.lucko.spark.common.platform.MetadataProvider;
-import net.minecraft.resource.ResourcePackManager;
-import net.minecraft.resource.ResourcePackProfile;
-import net.minecraft.resource.ResourcePackSource;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class FabricExtraMetadataProvider implements MetadataProvider {
-
- private final ResourcePackManager resourcePackManager;
-
- public FabricExtraMetadataProvider(ResourcePackManager resourcePackManager) {
- this.resourcePackManager = resourcePackManager;
- }
-
- @Override
- public Map<String, JsonElement> get() {
- Map<String, JsonElement> metadata = new LinkedHashMap<>();
- metadata.put("datapacks", datapackMetadata());
- return metadata;
- }
-
- private JsonElement datapackMetadata() {
- JsonObject datapacks = new JsonObject();
- for (ResourcePackProfile profile : this.resourcePackManager.getEnabledProfiles()) {
- JsonObject obj = new JsonObject();
- obj.addProperty("name", profile.getDisplayName().getString());
- obj.addProperty("description", profile.getDescription().getString());
- obj.addProperty("source", resourcePackSource(profile.getSource()));
- datapacks.add(profile.getId(), obj);
- }
- return datapacks;
- }
-
- private static String resourcePackSource(ResourcePackSource source) {
- if (source == ResourcePackSource.NONE) {
- return "none";
- } else if (source == ResourcePackSource.BUILTIN) {
- return "builtin";
- } else if (source == ResourcePackSource.WORLD) {
- return "world";
- } else if (source == ResourcePackSource.SERVER) {
- return "server";
- } else {
- return "unknown";
- }
- }
-}
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricWorldInfoProvider.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricWorldInfoProvider.java
index 5486cc2..514be5b 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricWorldInfoProvider.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricWorldInfoProvider.java
@@ -34,6 +34,8 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
+import net.minecraft.resource.ResourcePackManager;
+import net.minecraft.resource.ResourcePackSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerEntityManager;
import net.minecraft.server.world.ServerWorld;
@@ -44,11 +46,40 @@ import net.minecraft.world.entity.EntityIndex;
import net.minecraft.world.entity.EntityLookup;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import java.util.stream.Collectors;
public abstract class FabricWorldInfoProvider implements WorldInfoProvider {
+ protected abstract ResourcePackManager getResourcePackManager();
+
+ @Override
+ public Collection<DataPackInfo> pollDataPacks() {
+ return getResourcePackManager().getEnabledProfiles().stream()
+ .map(pack -> new DataPackInfo(
+ pack.getId(),
+ pack.getDescription().getString(),
+ resourcePackSource(pack.getSource())
+ ))
+ .collect(Collectors.toList());
+ }
+
+ private static String resourcePackSource(ResourcePackSource source) {
+ if (source == ResourcePackSource.NONE) {
+ return "none";
+ } else if (source == ResourcePackSource.BUILTIN) {
+ return "builtin";
+ } else if (source == ResourcePackSource.WORLD) {
+ return "world";
+ } else if (source == ResourcePackSource.SERVER) {
+ return "server";
+ } else {
+ return "unknown";
+ }
+ }
+
public static final class Server extends FabricWorldInfoProvider {
private final MinecraftServer server;
@@ -118,6 +149,11 @@ public abstract class FabricWorldInfoProvider implements WorldInfoProvider {
});
return data;
}
+
+ @Override
+ protected ResourcePackManager getResourcePackManager() {
+ return this.server.getDataPackManager();
+ }
}
public static final class Client extends FabricWorldInfoProvider {
@@ -195,6 +231,11 @@ public abstract class FabricWorldInfoProvider implements WorldInfoProvider {
return data;
}
+
+ @Override
+ protected ResourcePackManager getResourcePackManager() {
+ return this.client.getResourcePackManager();
+ }
}
static final class FabricChunkInfo extends AbstractChunkInfo<EntityType<?>> {
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
index 0a17bd7..d80e026 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
@@ -27,14 +27,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
-import me.lucko.spark.common.platform.MetadataProvider;
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.platform.world.WorldInfoProvider;
import me.lucko.spark.common.sampler.ThreadDumper;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
import me.lucko.spark.fabric.FabricCommandSender;
-import me.lucko.spark.fabric.FabricExtraMetadataProvider;
import me.lucko.spark.fabric.FabricPlatformInfo;
import me.lucko.spark.fabric.FabricSparkMod;
import me.lucko.spark.fabric.FabricTickHook;
@@ -138,11 +136,6 @@ public class FabricClientSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
- public MetadataProvider createExtraMetadataProvider() {
- return new FabricExtraMetadataProvider(this.minecraft.getResourcePackManager());
- }
-
- @Override
public WorldInfoProvider createWorldInfoProvider() {
return new FabricWorldInfoProvider.Client(this.minecraft);
}
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
index bd937af..04bbdf0 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
@@ -29,7 +29,6 @@ import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import me.lucko.fabric.api.permissions.v0.Permissions;
import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
-import me.lucko.spark.common.platform.MetadataProvider;
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider;
import me.lucko.spark.common.platform.world.WorldInfoProvider;
@@ -37,7 +36,6 @@ import me.lucko.spark.common.sampler.ThreadDumper;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
import me.lucko.spark.fabric.FabricCommandSender;
-import me.lucko.spark.fabric.FabricExtraMetadataProvider;
import me.lucko.spark.fabric.FabricPlatformInfo;
import me.lucko.spark.fabric.FabricPlayerPingProvider;
import me.lucko.spark.fabric.FabricServerConfigProvider;
@@ -170,11 +168,6 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
- public MetadataProvider createExtraMetadataProvider() {
- return new FabricExtraMetadataProvider(this.server.getDataPackManager());
- }
-
- @Override
public WorldInfoProvider createWorldInfoProvider() {
return new FabricWorldInfoProvider.Server(this.server);
}
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
index 1569bf8..8f0c14d 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
@@ -120,7 +120,8 @@ public abstract class FabricSparkPlugin implements SparkPlugin {
mod -> mod.getMetadata().getVersion().getFriendlyString(),
mod -> mod.getMetadata().getAuthors().stream()
.map(Person::getName)
- .collect(Collectors.joining(", "))
+ .collect(Collectors.joining(", ")),
+ mod -> mod.getMetadata().getDescription()
);
}
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java
deleted file mode 100644
index 2fe187a..0000000
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of spark.
- *
- * Copyright (c) lucko (Luck) <luck@lucko.me>
- * Copyright (c) contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package me.lucko.spark.forge;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import me.lucko.spark.common.platform.MetadataProvider;
-import net.minecraft.server.packs.repository.Pack;
-import net.minecraft.server.packs.repository.PackRepository;
-import net.minecraft.server.packs.repository.PackSource;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class ForgeExtraMetadataProvider implements MetadataProvider {
-
- private final PackRepository resourcePackManager;
-
- public ForgeExtraMetadataProvider(PackRepository resourcePackManager) {
- this.resourcePackManager = resourcePackManager;
- }
-
- @Override
- public Map<String, JsonElement> get() {
- Map<String, JsonElement> metadata = new LinkedHashMap<>();
- metadata.put("datapacks", datapackMetadata());
- return metadata;
- }
-
- private JsonElement datapackMetadata() {
- JsonObject datapacks = new JsonObject();
- for (Pack profile : this.resourcePackManager.getSelectedPacks()) {
- JsonObject obj = new JsonObject();
- obj.addProperty("name", profile.getTitle().getString());
- obj.addProperty("description", profile.getDescription().getString());
- obj.addProperty("source", resourcePackSource(pr