aboutsummaryrefslogtreecommitdiff
path: root/spark-forge
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2019-04-27 18:34:58 +0100
committerLuck <git@lucko.me>2019-04-27 18:34:58 +0100
commit51fa2b3e64f021c3c0535f9f931d3fae27ca7adc (patch)
tree8c17193be30335db15cbdfe7cc45fe80c4f4907d /spark-forge
parent3cf9c7e31d2244db8155082512b439885cef8c3b (diff)
downloadspark-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-forge')
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlugin.java20
1 files changed, 4 insertions, 16 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlugin.java
index 609894d..7298793 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlugin.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlugin.java
@@ -24,6 +24,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.sampler.ThreadDumper;
+import net.kyori.text.Component;
import net.kyori.text.TextComponent;
import net.kyori.text.serializer.ComponentSerializers;
import net.minecraft.command.ICommand;
@@ -70,23 +71,10 @@ public abstract class ForgeSparkPlugin implements SparkPlugin<ICommandSender>, I
return this.mod.getConfigDirectory();
}
- @SuppressWarnings("deprecation")
@Override
- public void sendMessage(ICommandSender sender, String message) {
- TextComponent component = ComponentSerializers.LEGACY.deserialize(message, '&');
- ITextComponent mcComponent = ITextComponent.Serializer.jsonToComponent(ComponentSerializers.JSON.serialize(component));
- sender.sendMessage(mcComponent);
- }
-
- @Override
- public void sendLink(ICommandSender sender, String url) {
- TextComponentString msg = new TextComponentString(url);
- Style style = msg.getStyle();
- style.setColor(TextFormatting.GRAY);
- style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
- msg.setStyle(style);
-
- sender.sendMessage(msg);
+ public void sendMessage(ICommandSender sender, Component message) {
+ ITextComponent component = ITextComponent.Serializer.jsonToComponent(ComponentSerializers.JSON.serialize(message));
+ sender.sendMessage(component);
}
@Override