I am currently trying to make an updating scoreboard that tracks a players HP and current kills but I am not having much luck. I have tried many different things and been stuck for well over 2 hours now. The problem lies when trying to get the players HP and kills. The error below is that of the kills issue, but another issue is the HP returning null hence the Unhandled Exception. Here is there error:
Here is the code: Line 144 - 162 of Main.java
@SuppressWarnings("deprecation")
public void run(String arena){
for(String key : Handler.playerMap.keySet()){
if (Handler.playerMap.get(key).contains(arena)){
Player pt = Bukkit.getPlayer(key);
String p = pt.getDisplayName();
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("test", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName(ChatColor.AQUA + "Wave: " );
Score score = objective.getScore(ChatColor.GREEN + "" + pt.getHealth() + ChatColor.WHITE + p + ChatColor.AQUA);
int kills = PlayerHandler.kills.get(p);
score.setScore(kills);
int pcheck = 0;
Can anybody tell me what the problem is? Thank you in advance for any comments.