1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-11-22 01:49:05 +00:00

fix: 异步事件未转移到异步线程

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-08-17 15:27:08 +08:00
parent 840c42d39c
commit a6585f11db

View File

@ -29,19 +29,21 @@ public class SidebarBoard extends Board {
@Override
public void update(final Player player) {
final SiderbarBoardPage boardPage = this.getBoardPage(player);
if (boardPage == null) { return; }
TitleUpdateEvent te = new TitleUpdateEvent(player);
Bukkit.getPluginManager().callEvent(te);
String title = te.getTitle();
if (title == null) {
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
return;
}
boardPage.setTitle(title);
BodyUpdateEvent be = new BodyUpdateEvent(player);
Bukkit.getPluginManager().callEvent(be);
boardPage.setBody(be.getBody());
player.setScoreboard(boardPage.getBoard());
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> {
final SiderbarBoardPage boardPage = this.getBoardPage(player);
if (boardPage == null) { return; }
TitleUpdateEvent te = new TitleUpdateEvent(player);
Bukkit.getPluginManager().callEvent(te);
String title = te.getTitle();
if (title == null) {
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
return;
}
boardPage.setTitle(title);
BodyUpdateEvent be = new BodyUpdateEvent(player);
Bukkit.getPluginManager().callEvent(be);
boardPage.setBody(be.getBody());
player.setScoreboard(boardPage.getBoard());
});
}
}