1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-12-24 06:58:51 +00:00

feat: 兼容1.9+异步操作错误

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-09-09 00:38:16 +08:00
parent 113701c5bf
commit deed3dd4be

View File

@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.bukkit.compatible.C;
/**
@ -149,7 +150,16 @@ public class Tellraw {
*/
public void send(final CommandSender sender) {
if (sender instanceof Player) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + toJsonString());
if (!Bukkit.isPrimaryThread()) {
Bukkit.getScheduler().runTask(P.instance, new Runnable() {
@Override
public void run() {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + toJsonString());
}
});
} else {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + sender.getName() + " " + toJsonString());
}
} else {
sender.sendMessage(toOldMessageFormat());
}