aboutsummaryrefslogtreecommitdiff
path: root/spark-minestom
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-minestom
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-minestom')
-rw-r--r--spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomClassSourceLookup.java2
-rw-r--r--spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomSparkPlugin.java14
2 files changed, 14 insertions, 2 deletions
diff --git a/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomClassSourceLookup.java b/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomClassSourceLookup.java
index 252060e..ca44eea 100644
--- a/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomClassSourceLookup.java
+++ b/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomClassSourceLookup.java
@@ -20,7 +20,7 @@
package me.lucko.spark.minestom;
-import me.lucko.spark.common.util.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
import net.minestom.server.MinecraftServer;
import net.minestom.server.extensions.Extension;
diff --git a/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomSparkPlugin.java b/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomSparkPlugin.java
index 2b43cae..9014476 100644
--- a/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomSparkPlugin.java
+++ b/spark-minestom/src/main/java/me/lucko/spark/minestom/MinestomSparkPlugin.java
@@ -24,9 +24,10 @@ import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
import me.lucko.spark.common.platform.PlatformInfo;
+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.tick.TickReporter;
-import me.lucko.spark.common.util.ClassSourceLookup;
import net.minestom.server.MinecraftServer;
import net.minestom.server.command.CommandSender;
@@ -45,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
import java.nio.file.Path;
import java.util.Arrays;
+import java.util.Collection;
import java.util.logging.Level;
import java.util.stream.Stream;
@@ -118,6 +120,16 @@ public class MinestomSparkPlugin extends Extension implements SparkPlugin {
}
@Override
+ public Collection<SourceMetadata> getKnownSources() {
+ return SourceMetadata.gather(
+ MinecraftServer.getExtensionManager().getExtensions(),
+ extension -> extension.getOrigin().getName(),
+ extension -> extension.getOrigin().getVersion(),
+ extension -> String.join(", ", extension.getOrigin().getAuthors())
+ );
+ }
+
+ @Override
public PlayerPingProvider createPlayerPingProvider() {
return new MinestomPlayerPingProvider();
}