aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/src
diff options
context:
space:
mode:
Diffstat (limited to 'spark-fabric/src')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/FabricClassSourceLookup.java2
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java19
2 files changed, 19 insertions, 2 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricClassSourceLookup.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricClassSourceLookup.java
index 9ffac18..51834fc 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricClassSourceLookup.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricClassSourceLookup.java
@@ -22,8 +22,8 @@ package me.lucko.spark.fabric;
import com.google.common.collect.ImmutableMap;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
import me.lucko.spark.common.util.ClassFinder;
-import me.lucko.spark.common.util.ClassSourceLookup;
import me.lucko.spark.fabric.smap.MixinUtils;
import me.lucko.spark.fabric.smap.SourceMap;
import me.lucko.spark.fabric.smap.SourceMapProvider;
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 3126f28..9a03b4e 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
@@ -34,11 +34,14 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.command.sender.CommandSender;
-import me.lucko.spark.common.util.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.SourceMetadata;
import me.lucko.spark.common.util.SparkThreadFactory;
import me.lucko.spark.fabric.FabricClassSourceLookup;
import me.lucko.spark.fabric.FabricSparkMod;
+import net.fabricmc.loader.api.FabricLoader;
+import net.fabricmc.loader.api.metadata.Person;
import net.minecraft.server.command.CommandOutput;
import org.apache.logging.log4j.LogManager;
@@ -46,10 +49,12 @@ import org.apache.logging.log4j.Logger;
import java.nio.file.Path;
import java.util.Arrays;
+import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.logging.Level;
+import java.util.stream.Collectors;
public abstract class FabricSparkPlugin implements SparkPlugin {
@@ -110,6 +115,18 @@ public abstract class FabricSparkPlugin implements SparkPlugin {
return new FabricClassSourceLookup();
}
+ @Override
+ public Collection<SourceMetadata> getKnownSources() {
+ return SourceMetadata.gather(
+ FabricLoader.getInstance().getAllMods(),
+ mod -> mod.getMetadata().getId(),
+ mod -> mod.getMetadata().getVersion().getFriendlyString(),
+ mod -> mod.getMetadata().getAuthors().stream()
+ .map(Person::getName)
+ .collect(Collectors.joining(", "))
+ );
+ }
+
protected CompletableFuture<Suggestions> generateSuggestions(CommandSender sender, String[] args, SuggestionsBuilder builder) {
SuggestionsBuilder suggestions;