From 51fa2b3e64f021c3c0535f9f931d3fae27ca7adc Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 27 Apr 2019 18:34:58 +0100 Subject: Use text components instead of legacy formatting codes throughout the project --- .../java/me/lucko/spark/sponge/SparkSpongePlugin.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'spark-sponge/src/main/java/me/lucko/spark') diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java index 159cbc7..c0727ac 100644 --- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java +++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java @@ -25,6 +25,8 @@ import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.sampler.TickCounter; +import net.kyori.text.Component; +import net.kyori.text.adapter.spongeapi.TextAdapter; import org.spongepowered.api.Game; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; @@ -115,21 +117,8 @@ public class SparkSpongePlugin implements SparkPlugin { } @Override - public void sendMessage(CommandSource sender, String message) { - sender.sendMessage(TextSerializers.FORMATTING_CODE.deserialize(message)); - } - - @Override - public void sendLink(CommandSource sender, String url) { - try { - Text msg = Text.builder(url) - .color(TextColors.GRAY) - .onClick(TextActions.openUrl(new URL(url))) - .build(); - sender.sendMessage(msg); - } catch (MalformedURLException e) { - e.printStackTrace(); - } + public void sendMessage(CommandSource sender, Component message) { + TextAdapter.sendComponent(sender, message); } @Override -- cgit