aboutsummaryrefslogtreecommitdiff
path: root/spark-sponge8/src/main/java/me/lucko/spark
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-09-19 18:57:02 +0100
committerLuck <git@lucko.me>2022-09-19 20:09:01 +0100
commit7079484d428321c9b3db09394577efda4d591a4e (patch)
tree1e751e3c832d6df00c7e50357be44b85a2fd5df9 /spark-sponge8/src/main/java/me/lucko/spark
parent7ef9b6281135ce0a24f3c14c2255d9a2c2eca969 (diff)
downloadspark-7079484d428321c9b3db09394577efda4d591a4e.tar.gz
spark-7079484d428321c9b3db09394577efda4d591a4e.tar.bz2
spark-7079484d428321c9b3db09394577efda4d591a4e.zip
Provide extra metadata about sources in sampler data
Diffstat (limited to 'spark-sponge8/src/main/java/me/lucko/spark')
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8ClassSourceLookup.java2
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java17
2 files changed, 17 insertions, 2 deletions
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8ClassSourceLookup.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8ClassSourceLookup.java
index fa4ac45..7f02e75 100644
--- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8ClassSourceLookup.java
+++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8ClassSourceLookup.java
@@ -22,7 +22,7 @@ package me.lucko.spark.sponge;
import com.google.common.collect.ImmutableMap;
-import me.lucko.spark.common.util.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
import org.spongepowered.api.Game;
import org.spongepowered.plugin.PluginCandidate;
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
index 83b2ec2..b1d31e9 100644
--- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
+++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
@@ -30,8 +30,9 @@ import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
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.sampler.source.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.SourceMetadata;
import me.lucko.spark.common.tick.TickHook;
-import me.lucko.spark.common.util.ClassSourceLookup;
import net.kyori.adventure.text.Component;
@@ -52,8 +53,10 @@ import org.spongepowered.api.event.lifecycle.StartedEngineEvent;
import org.spongepowered.api.event.lifecycle.StoppingEngineEvent;
import org.spongepowered.plugin.PluginContainer;
import org.spongepowered.plugin.builtin.jvm.Plugin;
+import org.spongepowered.plugin.metadata.model.PluginContributor;
import java.nio.file.Path;
+import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
@@ -178,6 +181,18 @@ public class Sponge8SparkPlugin implements SparkPlugin {
}
@Override
+ public Collection<SourceMetadata> getKnownSources() {
+ return SourceMetadata.gather(
+ this.game.pluginManager().plugins(),
+ plugin -> plugin.metadata().id(),
+ plugin -> plugin.metadata().version().toString(),
+ plugin -> plugin.metadata().contributors().stream()
+ .map(PluginContributor::name)
+ .collect(Collectors.joining(", "))
+ );
+ }
+
+ @Override
public PlayerPingProvider createPlayerPingProvider() {
if (this.game.isServerAvailable()) {
return new Sponge8PlayerPingProvider(this.game.server());