Spigot/Minecraft重复任务中的水平条闪烁



我目前遇到了一个相当烦人的问题。

我用Java 1.8中的Spigot-1.8来完成这项任务。但这个确切的代码给了我两个不同的结果。

在一个版本中,Minecraft的Levelbar只是倒计时,而在另一个版本,Levelbar每次设置新的XP值时都会闪烁。

private static int buildTask;
private static int buildSeconds = 120;
public static void buildingTime() {
buildTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(Plugin.getInstance(), () -> {
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
onlinePlayer.setLevel(buildSeconds);
}
//executing other Actions with Actionbar and Broadcasting Seconds to all players
if (buildSeconds <= 0) {
//ending here
}
buildSeconds--;
}, 0, 20);
}

我正在使用此Spigot:https://getbukkit.org/get/hNiHm0tuqAg1Xg7w7zudk63uHr0xo48D

已解决。。。。让两个任务同时运行,这与冲突

最新更新