更改了获取逻辑

This commit is contained in:
Kyoukawa Meishin 2025-10-19 21:38:08 +08:00
parent a29f0473af
commit f2f047ab90

View File

@ -65,9 +65,8 @@ public class StatusFoundation extends JavaPlugin {
objective.getScore(ChatColor.AQUA + "当前在线人数").setScore(7);
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(6);
objective.getScore(" ").setScore(5);
getTime(player);
objective.getScore(ChatColor.AQUA + "在线时长").setScore(4);
objective.getScore(ChatColor.GREEN + " " + getTimeString()).setScore(3);
objective.getScore(ChatColor.GREEN + " " + "获取中").setScore(3);
objective.getScore("").setScore(2);
objective.getScore(ChatColor.GRAY + "mymc.life").setScore(1);
@ -87,8 +86,7 @@ public class StatusFoundation extends JavaPlugin {
}
objective.getScore(ChatColor.RED + " " + econ.getBalance(player) ).setScore(9);
objective.getScore(ChatColor.GREEN + " " + Bukkit.getOnlinePlayers().size()).setScore(6);
getTime(player);
objective.getScore(ChatColor.GREEN + " " + getTimeString()).setScore(3);
objective.getScore(ChatColor.GREEN + " " + getTime(player)).setScore(3);
}
}.runTaskTimer(this, 0L, 100L);
}
@ -97,8 +95,9 @@ public class StatusFoundation extends JavaPlugin {
this.totalTime = time / 1000;
}
public void getTime(Player player) {
public String getTime(Player player) {
api.getPlayerOnlineTime(player, this::setTime);
return getTimeString();
}
public String getTimeString() {