Skip to content

Commit

Permalink
List extensions, update code to upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Sep 20, 2024
1 parent fde4171 commit 3d9e0f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public String getName() {
return "Geyser";
}

@Override
public String getBrand() {
return "Geyser";
}

@Override
public String getVersion() {
ApiVersion version = geyserApi.geyserApiVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.sampler.source.ClassSourceLookup;

import me.lucko.spark.common.sampler.source.SourceMetadata;
import org.geysermc.event.subscribe.Subscribe;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.command.Command;
Expand All @@ -40,6 +41,7 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Stream;
Expand All @@ -50,8 +52,9 @@ public class GeyserSparkExtension implements SparkPlugin, Extension {
@Subscribe
public void onPreInitialize(GeyserPreInitializeEvent ignored) {
if (this.geyserApi().platformType() != PlatformType.STANDALONE) {
this.logger().severe("spark is only supported on standalone Geyser instances! If you wish to use it on other platforms please download the spark version for that platform.");
this.logger().severe("spark is only supported on Geyser-Standalone instances! If you wish to use it on other platforms, use the spark version for that platform.");
this.disable();
return;
}
this.platform = new SparkPlatform(this);
}
Expand Down Expand Up @@ -140,4 +143,15 @@ public PlayerPingProvider createPlayerPingProvider() {
public PlatformInfo getPlatformInfo() {
return new GeyserPlatformInfo(this.geyserApi());
}

@Override
public Collection<SourceMetadata> getKnownSources() {
return SourceMetadata.gather(
geyserApi().extensionManager().extensions(),
Extension::name,
extension -> extension.description().version(),
extension -> String.join(", ", extension.description().authors()),
$ -> ""
);
}
}

0 comments on commit 3d9e0f1

Please sign in to comment.