diff options
15 files changed, 295 insertions, 104 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java index d095bed..5db1b38 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java @@ -28,10 +28,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializer; -import me.lucko.spark.common.platform.serverconfig.AbstractServerConfigProvider; import me.lucko.spark.common.platform.serverconfig.ConfigParser; import me.lucko.spark.common.platform.serverconfig.ExcludedConfigFilter; import me.lucko.spark.common.platform.serverconfig.PropertiesConfigParser; +import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider; import org.bukkit.Bukkit; import org.bukkit.World; @@ -51,7 +51,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -public class BukkitServerConfigProvider extends AbstractServerConfigProvider { +public class BukkitServerConfigProvider extends ServerConfigProvider { /** A map of provided files and their type */ private static final Map<String, ConfigParser> FILES; diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java index e2a2dbd..b7aef2a 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlugin.java @@ -23,6 +23,7 @@ package me.lucko.spark.common; import me.lucko.spark.api.Spark; import me.lucko.spark.common.command.sender.CommandSender; 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; @@ -161,7 +162,16 @@ public interface SparkPlugin { * @return the server config provider function */ default ServerConfigProvider createServerConfigProvider() { - return ServerConfigProvider.NO_OP; + return null; + } + + /** + * Creates a metadata provider for the platform. + * + * @return the platform extra metadata provider + */ + default MetadataProvider createExtraMetadataProvider() { + return null; } /** diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/MetadataProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/MetadataProvider.java new file mode 100644 index 0000000..39022b4 --- /dev/null +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/MetadataProvider.java @@ -0,0 +1,47 @@ +/* + * 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.common.platform; + +import com.google.gson.JsonElement; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Function to export dynamic metadata to be displayed within the spark viewer. + */ +@FunctionalInterface +public interface MetadataProvider { + + /** + * Produces a map of the metadata. + * + * @return the metadata + */ + Map<String, JsonElement> get(); + + default Map<String, String> export() { + Map<String, String> map = new LinkedHashMap<>(); + get().forEach((key, value) -> map.put(key, value.toString())); + return map; + } + +} diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java deleted file mode 100644 index 559ae95..0000000 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.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.common.platform.serverconfig; - -import com.google.common.collect.ImmutableMap; -import com.google.gson.JsonElement; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Abstract implementation of {@link ServerConfigProvider}. - * - * <p>This implementation is able to delete hidden paths from - * the configurations before they are sent to the viewer.</p> - */ -public abstract class AbstractServerConfigProvider implements ServerConfigProvider { - private final Map<String, ConfigParser> files; - private final ExcludedConfigFilter hiddenPathFilters; - - protected AbstractServerConfigProvider(Map<String, ConfigParser> files, Collection<String> hiddenPaths) { - this.files = files; - this.hiddenPathFilters = new ExcludedConfigFilter(hiddenPaths); - } - - @Override - public final Map<String, JsonElement> loadServerConfigurations() { - ImmutableMap.Builder<String, JsonElement> builder = ImmutableMap.builder(); - - this.files.forEach((path, parser) -> { - try { - JsonElement json = parser.load(path, this.hiddenPathFilters); - if (json == null) { - return; - } - builder.put(path, json); - } catch (Exception e) { - e.printStackTrace(); - } - }); - - return builder.build(); - } - - protected static List<String> getSystemPropertyList(String property) { - String value = System.getProperty(property); - return value == null - ? Collections.emptyList() - : Arrays.asList(value.split(",")); - } - -} diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/ServerConfigProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/ServerConfigProvider.java index c66305f..485f215 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/ServerConfigProvider.java +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/ServerConfigProvider.java @@ -20,37 +20,57 @@ package me.lucko.spark.common.platform.serverconfig; +import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; +import me.lucko.spark.common.platform.MetadataProvider; + +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; -import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; /** - * Function to export server configuration files for access within the spark viewer. + * Abstract implementation of {@link MetadataProvider} which + * provides server configuration data. + * + * <p>This implementation is able to delete hidden paths from + * the configurations before they are sent to the viewer.</p> */ -@FunctionalInterface -public interface ServerConfigProvider { - - /** - * Loads a map of the server configuration files. - * - * <p>The key is the name of the file and the value is a - * {@link JsonElement} of the contents.</p> - * - * @return the exported server configurations - */ - Map<String, JsonElement> loadServerConfigurations(); - - default Map<String, String> exportServerConfigurations() { - Map<String, String> map = new LinkedHashMap<>(); - loadServerConfigurations().forEach((key, value) -> map.put(key, value.toString())); - return map; +public abstract class ServerConfigProvider implements MetadataProvider { + private final Map<String, ConfigParser> files; + private final ExcludedConfigFilter hiddenPathFilters; + + protected ServerConfigProvider(Map<String, ConfigParser> files, Collection<String> hiddenPaths) { + this.files = files; + this.hiddenPathFilters = new ExcludedConfigFilter(hiddenPaths); + } + + @Override + public final Map<String, JsonElement> get() { + ImmutableMap.Builder<String, JsonElement> builder = ImmutableMap.builder(); + + this.files.forEach((path, parser) -> { + try { + JsonElement json = parser.load(path, this.hiddenPathFilters); + if (json == null) { + return; + } + builder.put(path, json); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + return builder.build(); } - /** - * A no-op implementation - */ - ServerConfigProvider NO_OP = Collections::emptyMap; + protected static List<String> getSystemPropertyList(String property) { + String value = System.getProperty(property); + return value == null + ? Collections.emptyList() + : Arrays.asList(value.split(",")); + } } diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/AbstractSampler.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/AbstractSampler.java index 7b57504..e20a2a8 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/AbstractSampler.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/AbstractSampler.java @@ -23,6 +23,7 @@ package me.lucko.spark.common.sampler; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.command.sender.CommandSender; import me.lucko.spark.common.monitor.memory.GarbageCollectorStatistics; +import me.lucko.spark.common.platform.MetadataProvider; import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider; import me.lucko.spark.common.sampler.aggregator.DataAggregator; import me.lucko.spark.common.sampler.node.MergeMode; @@ -148,7 +149,14 @@ public abstract class AbstractSampler implements Sampler { try { ServerConfigProvider serverConfigProvider = platform.getPlugin().createServerConfigProvider(); - metadata.putAllServerConfigurations(serverConfigProvider.exportServerConfigurations()); + metadata.putAllServerConfigurations(serverConfigProvider.export()); + } catch (Exception e) { + e.printStackTrace(); + } + + try { + MetadataProvider extraMetadataProvider = platform.getPlugin().createExtraMetadataProvider(); + metadata.putAllExtraPlatformMetadata(extraMetadataProvider.export()); } catch (Exception e) { e.printStackTrace(); } diff --git a/spark-common/src/main/proto/spark/spark_sampler.proto b/spark-common/src/main/proto/spark/spark_sampler.proto index e4c2481..3f30fb2 100644 --- a/spark-common/src/main/proto/spark/spark_sampler.proto +++ b/spark-common/src/main/proto/spark/spark_sampler.proto @@ -29,6 +29,7 @@ message SamplerMetadata { int64 end_time = 11; int32 number_of_ticks = 12; map<string, SourceMetadata> sources = 13; + map<string, string> extra_platform_metadata = 14; message ThreadDumper { Type type = 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 new file mode 100644 index 0000000..9eb2694 --- /dev/null +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricExtraMetadataProvider.java @@ -0,0 +1,75 @@ +/* + * 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.getName(), obj); + } + return datapacks; + } + + private static String resourcePackSource(ResourcePackSource source) { + if (source == ResourcePackSource.PACK_SOURCE_NONE) { + return "none"; + } else if (source == ResourcePackSource.PACK_SOURCE_BUILTIN) { + return "builtin"; + } else if (source == ResourcePackSource.PACK_SOURCE_WORLD) { + return "world"; + } else if (source == ResourcePackSource.PACK_SOURCE_SERVER) { + return "server"; + } else { + return "unknown"; + } + } +} diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricServerConfigProvider.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricServerConfigProvider.java index 18079d3..325a324 100644 --- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricServerConfigProvider.java +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricServerConfigProvider.java @@ -23,14 +23,14 @@ package me.lucko.spark.fabric; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import me.lucko.spark.common.platform.serverconfig.AbstractServerConfigProvider; import me.lucko.spark.common.platform.serverconfig.ConfigParser; import me.lucko.spark.common.platform.serverconfig.PropertiesConfigParser; +import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider; import java.util.Collection; import java.util.Map; -public class FabricServerConfigProvider extends AbstractServerConfigProvider { +public class FabricServerConfigProvider extends ServerConfigProvider { /** A map of provided files and their type */ private static final Map<String, ConfigParser> FILES; 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 0ef6620..faf4eef 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 @@ -28,12 +28,14 @@ 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,6 +140,11 @@ 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 f840f5e..c528e5b 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 @@ -30,6 +30,7 @@ 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,6 +38,7 @@ 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; @@ -163,6 +165,11 @@ 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-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java new file mode 100644 index 0000000..cac2771 --- /dev/null +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeExtraMetadataProvider.java @@ -0,0 +1,75 @@ +/* + * 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(profile.getPackSource())); + datapacks.add(profile.getId(), obj); + } + return datapacks; + } + + private static String resourcePackSource(PackSource source) { + if (source == PackSource.DEFAULT) { + return "none"; + } else if (source == PackSource.BUILT_IN) { + return "builtin"; + } else if (source == PackSource.WORLD) { + return "world"; + } else if (source == PackSource.SERVER) { + return "server"; + } else { + return "unknown"; + } + } +} diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerConfigProvider.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerConfigProvider.java index baa1358..6feba52 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerConfigProvider.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerConfigProvider.java @@ -23,14 +23,14 @@ package me.lucko.spark.forge; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import me.lucko.spark.common.platform.serverconfig.AbstractServerConfigProvider; import me.lucko.spark.common.platform.serverconfig.ConfigParser; import me.lucko.spark.common.platform.serverconfig.PropertiesConfigParser; +import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider; import java.util.Collection; import java.util.Map; -public class ForgeServerConfigProvider extends AbstractServerConfigProvider { +public class ForgeServerConfigProvider extends ServerConfigProvider { /** A map of provided files and their type */ private static final Map<String, ConfigParser> FILES; diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java index a4c6bd1..a8c7c92 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java @@ -27,12 +27,14 @@ 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.forge.ForgeCommandSender; +import me.lucko.spark.forge.ForgeExtraMetadataProvider; import me.lucko.spark.forge.ForgePlatformInfo; import me.lucko.spark.forge.ForgeSparkMod; import me.lucko.spark.forge.ForgeTickHook; @@ -137,6 +139,11 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Command< } @Override + public MetadataProvider createExtraMetadataProvider() { + return new ForgeExtraMetadataProvider(this.minecraft.getResourcePackRepository()); + } + + @Override public PlatformInfo getPlatformInfo() { return new ForgePlatformInfo(PlatformInfo.Type.CLIENT); } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java index 1aeb2b1..56d30b7 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java @@ -30,6 +30,7 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; 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,6 +38,7 @@ 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.forge.ForgeCommandSender; +import me.lucko.spark.forge.ForgeExtraMetadataProvider; import me.lucko.spark.forge.ForgePlatformInfo; import me.lucko.spark.forge.ForgePlayerPingProvider; import me.lucko.spark.forge.ForgeServerConfigProvider; @@ -220,6 +222,11 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command< } @Override + public MetadataProvider createExtraMetadataProvider() { + return new ForgeExtraMetadataProvider(this.server.getPackRepository()); + } + + @Override public WorldInfoProvider createWorldInfoProvider() { return new ForgeWorldInfoProvider.Server(this.server); } |