diff options
author | Luck <git@lucko.me> | 2022-09-19 18:57:02 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-09-19 20:09:01 +0100 |
commit | 7079484d428321c9b3db09394577efda4d591a4e (patch) | |
tree | 1e751e3c832d6df00c7e50357be44b85a2fd5df9 /spark-bukkit/src/main | |
parent | 7ef9b6281135ce0a24f3c14c2255d9a2c2eca969 (diff) | |
download | spark-7079484d428321c9b3db09394577efda4d591a4e.tar.gz spark-7079484d428321c9b3db09394577efda4d591a4e.tar.bz2 spark-7079484d428321c9b3db09394577efda4d591a4e.zip |
Provide extra metadata about sources in sampler data
Diffstat (limited to 'spark-bukkit/src/main')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitClassSourceLookup.java | 2 | ||||
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitSparkPlugin.java | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitClassSourceLookup.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitClassSourceLookup.java index 6d8afda..f9c0c0b 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitClassSourceLookup.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitClassSourceLookup.java @@ -20,7 +20,7 @@ package me.lucko.spark.bukkit; -import me.lucko.spark.common.util.ClassSourceLookup; +import me.lucko.spark.common.sampler.source.ClassSourceLookup; import org.bukkit.plugin.java.JavaPlugin; 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 5737d3d..87490ea 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 @@ -30,9 +30,10 @@ import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider; 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.tick.TickReporter; -import me.lucko.spark.common.util.ClassSourceLookup; import net.kyori.adventure.platform.bukkit.BukkitAudiences; @@ -40,10 +41,13 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; import java.nio.file.Path; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.logging.Level; import java.util.stream.Stream; @@ -181,6 +185,16 @@ public class BukkitSparkPlugin extends JavaPlugin implements SparkPlugin { } @Override + public Collection<SourceMetadata> getKnownSources() { + return SourceMetadata.gather( + Arrays.asList(getServer().getPluginManager().getPlugins()), + Plugin::getName, + plugin -> plugin.getDescription().getVersion(), + plugin -> String.join(", ", plugin.getDescription().getAuthors()) + ); + } + + @Override public PlayerPingProvider createPlayerPingProvider() { if (BukkitPlayerPingProvider.isSupported()) { return new BukkitPlayerPingProvider(getServer()); |