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 @Override
public void update(final Player player) { public void update(final Player player) {
final SiderbarBoardPage boardPage = this.getBoardPage(player); Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> {
if (boardPage == null) { return; } final SiderbarBoardPage boardPage = this.getBoardPage(player);
TitleUpdateEvent te = new TitleUpdateEvent(player); if (boardPage == null) { return; }
Bukkit.getPluginManager().callEvent(te); TitleUpdateEvent te = new TitleUpdateEvent(player);
String title = te.getTitle(); Bukkit.getPluginManager().callEvent(te);
if (title == null) { String title = te.getTitle();
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard()); if (title == null) {
return; player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
} return;
boardPage.setTitle(title); }
BodyUpdateEvent be = new BodyUpdateEvent(player); boardPage.setTitle(title);
Bukkit.getPluginManager().callEvent(be); BodyUpdateEvent be = new BodyUpdateEvent(player);
boardPage.setBody(be.getBody()); Bukkit.getPluginManager().callEvent(be);
player.setScoreboard(boardPage.getBoard()); boardPage.setBody(be.getBody());
player.setScoreboard(boardPage.getBoard());
});
} }
} }