diff options
Diffstat (limited to 'spark-sponge')
3 files changed, 8 insertions, 19 deletions
diff --git a/spark-sponge/build.gradle b/spark-sponge/build.gradle index 1a40cd9..3d827b7 100644 --- a/spark-sponge/build.gradle +++ b/spark-sponge/build.gradle @@ -4,10 +4,6 @@ plugins { dependencies { compile project(':spark-common') - compile('net.kyori:adventure-platform-spongeapi:4.0.0-SNAPSHOT') { - exclude(module: 'adventure-api') - exclude(module: 'adventure-text-serializer-gson') - } compileOnly 'org.spongepowered:spongeapi:7.3.0' annotationProcessor 'org.spongepowered:spongeapi:7.3.0' } diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java index f4636b7..b2c4b8c 100644 --- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java +++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java @@ -22,21 +22,18 @@ package me.lucko.spark.sponge; import me.lucko.spark.common.command.sender.AbstractCommandSender; -import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.platform.spongeapi.SpongeAudiences; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.text.serializer.TextSerializers; import java.util.UUID; public class SpongeCommandSender extends AbstractCommandSender<CommandSource> { - private final Audience audience; - - public SpongeCommandSender(CommandSource source, SpongeAudiences audienceFactory) { + public SpongeCommandSender(CommandSource source) { super(source); - this.audience = audienceFactory.receiver(source); } @Override @@ -54,7 +51,7 @@ public class SpongeCommandSender extends AbstractCommandSender<CommandSource> { @Override public void sendMessage(Component message) { - this.audience.sendMessage(message); + super.delegate.sendMessage(TextSerializers.JSON.deserialize(GsonComponentSerializer.gson().serialize(message))); } @Override diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java index bfd0c3f..5d11c03 100644 --- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java +++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java @@ -29,8 +29,6 @@ import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.tick.TickHook; -import net.kyori.adventure.platform.spongeapi.SpongeAudiences; - import org.spongepowered.api.Game; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; @@ -73,7 +71,6 @@ public class SpongeSparkPlugin implements SparkPlugin { private final Path configDirectory; private final SpongeExecutorService asyncExecutor; - private SpongeAudiences audienceFactory; private SparkPlatform platform; private final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread(); @@ -87,7 +84,6 @@ public class SpongeSparkPlugin implements SparkPlugin { @Listener public void onEnable(GameStartedServerEvent event) { - this.audienceFactory = SpongeAudiences.create(this.pluginContainer, this.game); this.platform = new SparkPlatform(this); this.platform.enable(); this.game.getCommandManager().register(this, new SparkCommand(this), "spark"); @@ -118,7 +114,7 @@ public class SpongeSparkPlugin implements SparkPlugin { return Stream.concat( this.game.getServer().getOnlinePlayers().stream(), Stream.of(this.game.getServer().getConsole()) - ).map(source -> new SpongeCommandSender(source, this.audienceFactory)); + ).map(SpongeCommandSender::new); } @Override @@ -156,18 +152,18 @@ public class SpongeSparkPlugin implements SparkPlugin { @Override public CommandResult process(CommandSource source, String arguments) { this.plugin.threadDumper.ensureSetup(); - this.plugin.platform.executeCommand(new SpongeCommandSender(source, this.plugin.audienceFactory), arguments.split(" ")); + this.plugin.platform.executeCommand(new SpongeCommandSender(source), arguments.split(" ")); return CommandResult.empty(); } @Override public List<String> getSuggestions(CommandSource source, String arguments, @Nullable Location<World> targetPosition) { - return this.plugin.platform.tabCompleteCommand(new SpongeCommandSender(source, this.plugin.audienceFactory), arguments.split(" ")); + return this.plugin.platform.tabCompleteCommand(new SpongeCommandSender(source), arguments.split(" ")); } @Override public boolean testPermission(CommandSource source) { - return this.plugin.platform.hasPermissionForAnyCommand(new SpongeCommandSender(source, this.plugin.audienceFactory)); + return this.plugin.platform.hasPermissionForAnyCommand(new SpongeCommandSender(source)); } @Override |