From ee3ab6ff9a1ad7e7875c0cef4643d1e2bcff69af Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Fri, 29 Mar 2024 13:39:12 +0100 Subject: [PATCH] Make use of updated spigot api to send command-messages in a better way --- .../bluemap/bukkit/BukkitCommandSource.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitCommandSource.java b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitCommandSource.java index 8559035f..8ba70ece 100644 --- a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitCommandSource.java +++ b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitCommandSource.java @@ -30,12 +30,12 @@ import de.bluecolored.bluemap.common.serverinterface.CommandSource; import de.bluecolored.bluemap.common.serverinterface.ServerWorld; import de.bluecolored.bluemap.core.world.World; +import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.BlockCommandSender; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; import java.util.Optional; @@ -51,17 +51,7 @@ public BukkitCommandSource(Plugin plugin, CommandSender delegate) { @Override public void sendMessage(Text text) { - Bukkit.getScheduler().runTask(BukkitPlugin.getInstance(), () -> { - if (delegate instanceof Player) { - Player player = (Player) delegate; - - //kinda hacky but works - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "minecraft:tellraw " + player.getName() + " " + text.toJSONString()); - return; - } - - delegate.sendMessage(text.toPlainString()); - }); + delegate.spigot().sendMessage(ComponentSerializer.parse(text.toJSONString())); } @Override