diff --git a/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java b/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java index 8f8e21d..161b1ca 100644 --- a/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java @@ -21,13 +21,13 @@ public class UserDataManager { Bson updated = new Document("Bank", coins + coinsBefore); Bson update = new Document("$set", updated); DatabaseManager.getUsersDB().updateOne(document, update); - ScoreboardListener.sideBarManager.addBank(uuid); + ScoreboardListener.sideBarManager.addBank(uuid, coins); } else { Document doc = new Document(); doc.put("UUID", uuid); doc.put("Bank", coins); DatabaseManager.getUsersDB().insertOne(doc); - ScoreboardListener.sideBarManager.addBank(uuid); + ScoreboardListener.sideBarManager.addBank(uuid, coins); } diff --git a/src/main/java/me/night/nullvalkyrie/ui/BelowNameManager.java b/src/main/java/me/night/nullvalkyrie/ui/BelowNameManager.java index 444199c..8154b04 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/BelowNameManager.java +++ b/src/main/java/me/night/nullvalkyrie/ui/BelowNameManager.java @@ -10,9 +10,9 @@ import org.bukkit.scoreboard.Scoreboard; public class BelowNameManager { public void setBelowName(Player player) { Scoreboard board = player.getScoreboard(); - Objective obj = board.registerNewObjective("HealthBar", Criteria.HEALTH, ChatColor.RED + "❤"); + Objective obj = board.registerNewObjective("HealthBar", Criteria.DUMMY, ChatColor.RED.toString()); obj.setDisplaySlot(DisplaySlot.BELOW_NAME); + obj.setDisplayName(ChatColor.RED.toString() + player.getHealth() + "❤"); player.setScoreboard(board); - player.setHealth(player.getHealth()); } } diff --git a/src/main/java/me/night/nullvalkyrie/ui/SideBarManager.java b/src/main/java/me/night/nullvalkyrie/ui/SideBarManager.java index 71487c1..2321fd3 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/SideBarManager.java +++ b/src/main/java/me/night/nullvalkyrie/ui/SideBarManager.java @@ -95,9 +95,8 @@ public class SideBarManager { }, 0, 10); } - public void addBank(String uuid) { + public void addBank(String uuid, Integer amount) { UUID uid = UUID.fromString(uuid); - Bukkit.getPlayer(uid).getScoreboard().getTeam("Bank").setSuffix(ChatColor.YELLOW.toString() + UserDataManager.getUser(uuid).get("Bank")); - + Bukkit.getPlayer(uid).getScoreboard().getTeam("Bank").setSuffix(ChatColor.YELLOW.toString() + UserDataManager.getUser(uuid).get("Bank") + ChatColor.WHITE + "+(" + amount + ")"); } }