forked from mirror/BlueMap
Make use of updated spigot api to send command-messages in a better way
This commit is contained in:
parent
498a4f3190
commit
ee3ab6ff9a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user