mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 02:26:00 +01:00
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