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-bukkit/src/main/java/me | |
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-bukkit/src/main/java/me')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java index c713a2c..15c725d 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java @@ -26,6 +26,9 @@ import me.lucko.spark.common.command.CommandResponseHandler; import me.lucko.spark.common.monitor.tick.TpsCalculator; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.sampler.TickCounter; +import net.kyori.text.Component; +import net.kyori.text.TextComponent; +import net.kyori.text.adapter.bukkit.TextAdapter; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -55,8 +58,8 @@ public class SparkBukkitPlugin extends JavaPlugin implements SparkPlugin<Command CommandResponseHandler<CommandSender> resp = new CommandResponseHandler<>(this.platform, sender); TpsCalculator tpsCalculator = this.platform.getTpsCalculator(); - resp.replyPrefixed("TPS from last 5s, 10s, 1m, 5m, 15m:"); - resp.replyPrefixed(" " + tpsCalculator.toFormattedString()); + resp.replyPrefixed(TextComponent.of("TPS from last 5s, 10s, 1m, 5m, 15m:")); + resp.replyPrefixed(TextComponent.builder(" ").append(tpsCalculator.toFormattedComponent()).build()); return true; }, "tps"); } @@ -110,13 +113,8 @@ public class SparkBukkitPlugin extends JavaPlugin implements SparkPlugin<Command } @Override - public void sendMessage(CommandSender sender, String message) { - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message)); - } - - @Override - public void sendLink(CommandSender sender, String url) { - sendMessage(sender, "&7" + url); + public void sendMessage(CommandSender sender, Component message) { + TextAdapter.sendComponent(sender, message); } @Override |