diff options
author | Luck <git@lucko.me> | 2019-04-27 18:34:58 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2019-04-27 18:34:58 +0100 |
commit | 51fa2b3e64f021c3c0535f9f931d3fae27ca7adc (patch) | |
tree | 8c17193be30335db15cbdfe7cc45fe80c4f4907d /spark-bungeecord | |
parent | 3cf9c7e31d2244db8155082512b439885cef8c3b (diff) | |
download | spark-51fa2b3e64f021c3c0535f9f931d3fae27ca7adc.tar.gz spark-51fa2b3e64f021c3c0535f9f931d3fae27ca7adc.tar.bz2 spark-51fa2b3e64f021c3c0535f9f931d3fae27ca7adc.zip |
Use text components instead of legacy formatting codes throughout the project
Diffstat (limited to 'spark-bungeecord')
-rw-r--r-- | spark-bungeecord/build.gradle | 1 | ||||
-rw-r--r-- | spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java | 15 |
2 files changed, 5 insertions, 11 deletions
diff --git a/spark-bungeecord/build.gradle b/spark-bungeecord/build.gradle index f94e651..55dcb4e 100644 --- a/spark-bungeecord/build.gradle +++ b/spark-bungeecord/build.gradle @@ -1,5 +1,6 @@ dependencies { compile project(':spark-common') + compile 'net.kyori:text-adapter-bungeecord:1.0.3' compileOnly 'net.md-5:bungeecord-api:1.12-SNAPSHOT' } diff --git a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java index 0bc118a..ba2ee99 100644 --- a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java +++ b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java @@ -24,9 +24,10 @@ 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.bungeecord.TextAdapter; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.plugin.Command; import net.md_5.bungee.api.plugin.Plugin; @@ -76,16 +77,8 @@ public class SparkBungeeCordPlugin extends Plugin implements SparkPlugin<Command } @Override - public void sendMessage(CommandSender sender, String message) { - sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', message))); - } - - @Override - public void sendLink(CommandSender sender, String url) { - TextComponent component = new TextComponent(url); - component.setColor(ChatColor.GRAY); - component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url)); - sender.sendMessage(component); + public void sendMessage(CommandSender sender, Component message) { + TextAdapter.sendComponent(sender, message); } @Override |