Skip to content

Commit

Permalink
Make use of updated spigot api to send command-messages in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Mar 29, 2024
1 parent 498a4f3 commit ee3ab6f
Showing 1 changed file with 2 additions and 12 deletions.
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit ee3ab6f

Please sign in to comment.