fixed something in scoreboard

This commit is contained in:
night0721 2022-07-10 00:31:42 +01:00
parent 7a76db189b
commit 30ef01bb52
2 changed files with 4 additions and 5 deletions

View file

@ -1,10 +1,9 @@
package com.night.nullvalkyrie.RankSys; package com.night.nullvalkyrie.RankSys;
import org.bukkit.Bukkit; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
public class BelowNameManager { public class BelowNameManager {
@ -12,7 +11,7 @@ public class BelowNameManager {
Scoreboard board = player.getScoreboard(); Scoreboard board = player.getScoreboard();
Objective obj = board.registerNewObjective("HealthBar", "health"); Objective obj = board.registerNewObjective("HealthBar", "health");
obj.setDisplaySlot(DisplaySlot.BELOW_NAME); obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.setDisplayName("/ 20"); obj.setDisplayName(ChatColor.RED + "");
player.setScoreboard(board); player.setScoreboard(board);
player.setHealth(player.getHealth()); player.setHealth(player.getHealth());

View file

@ -38,11 +38,11 @@ public class RankManager {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(Bukkit.getOfflinePlayer(uuid).isOnline()) { for(Player player : Bukkit.getOnlinePlayers()) {
Player player = Bukkit.getPlayer(uuid);
main.getNameTagManager().removeTag(player); main.getNameTagManager().removeTag(player);
main.getNameTagManager().newTag(player); main.getNameTagManager().newTag(player);
} }
} }
public Rank getRank(UUID uuid) { public Rank getRank(UUID uuid) {
return Rank.valueOf(config.getString(uuid.toString())); return Rank.valueOf(config.getString(uuid.toString()));