health bar kinda bugged now and money sidebar better
This commit is contained in:
parent
d4d4ef75e0
commit
f8d85374c9
3 changed files with 6 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 + ")");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue