Hi, as part of my plugin, I am having 3 things on my scoreboard. Which are: Kills Deaths Killstreak I was thinking of having different Listeners for each of these. However, is there any method of calling the scoreboard from each of these. Or another method, not sure if it would work. In each of the event handlers, create the scoreboard with another objective, or would this replace the old scoreboard? Sorry at this isn't explained very well, if you would like some more explanation , please ask.
Okay, so I want a scoreboard, that has multiple objectives on it (Kills, deaths, killsteak) Would would I go about doing this basically?
@Phishy Create a scoreboard for each player set the displayslot, the displayname, and register a new objectif. Then objectives.getscore("kill").setscore(int playerkill) objectives.getscore("death").setscore(int playerdeath)
Here is how to create a scoreboard: It wont display yet. Code: public static void onSetScoreboardIngame(Player p){ Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard(); Objective ob = board.registerNewObjective("ingame", "dummy"); ob.setDisplaySlot(DisplaySlot.SIDEBAR); ob.setDisplayName("TITLE HERE"); int killdisplay = "" + kills; int deathdisplay = "" + deaths; int killstreakdisplay = "" + killstreak; Score kills = ob.getScore(Bukkit.getOfflinePlayer("Deaths:" + "" + killdisplay); kills.setScore(3); Score deaths = ob.getScore(Bukkit.getOfflinePlayer("Kills:" + "" + deathdisplay); deaths.setScore(2); Score killstreak = ob.getScore(Bukkit.getOfflinePlayer("Killstreak:" + "" + killstreakdisplay); killstreak.setScore(1); p.setScoreboard(board); } And here is how to update it Code: public static void onUpdateScoreboardIngame(Player p){ Scoreboard board = p.getScoreboard(); Objective ob = board.getObjective(DisplaySlot.SIDEBAR); ob.setDisplayName("TITLE HERE"); int killdisplay = "" + kills; int deathdisplay = "" + deaths; int killstreakdisplay = "" + killstreak; ob.getScore(Bukkit.getOfflinePlayer("Deaths:" + "" + killdisplay).setScore(3); ob.getScore(Bukkit.getOfflinePlayer("Kills:" + "" + deathdisplay).setScore(); ob.getScore(Bukkit.getOfflinePlayer("Killstreak:" + "" + killstreakdisplay).setScore(1); p.setScoreboard(board); } And to first give it you just use this code: Code: (class).onSetScoreboardIngame(player); And in order to update it: Code: (class).onUpdateScoreboardIngame(player); I hope this was helpfull. If you have any problems, please tell me.