Hello , I am creating a minecraft server and programming the plugins for it . Yesterday, I came up with the doubt of how to add a suffix to the player in TabList and your name in your head !, I hope you help me with this ...
Since you know java then your should know how to follow this Guide http://bukkit.org/threads/tutorial-scoreboards-teams-with-the-bukkit-api.139655/ And use java docs, we try not to spoon feed code here so please first try your best on your own then if your still having problems we can probably help more
Then you should understand it from the http://bukkit.org/threads/tutorial-scoreboards-teams-with-the-bukkit-api.139655/ tutorial and from the javadoc: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/scoreboard/package-frame.html
I haven't tested it, but theoretically this code should work: ScoreboardManager board; public void onEnable(){ board= Bukkit.getScoreboardManager().getMainScoreboard(); Bukkit.getPluginManager().registerEvents(this,this); } @EventHandler public void onPlayerJoin(PlayerJoinEvent e){ setPlayerPrefixSuffix(e.getPlayer(),"prefix","suffix") } @EventHandler public void onPlayerLeave(PlayerQuitEvent e){ board.getTeam(e.getPlayer().getName()).unregister(); } public void setPlayerPrefixSuffix(Player plr,String prefix,String suffix){ Team t=board.registerNewTeam(plr.getName()); t.setPrefix(prefix); t.setSuffix(suffix); t.addPlayer(plr); }
public void setPlayerPrefixSuffix(Player plr,String prefix,String suffix){ Team t=board.registerNewTeam(plr.getName()); t.setPrefix(prefix); t.setSuffix(suffix); t.addPlayer(plr); //This is missing: (You have to add the player to the board oc.) plr.setScoreboard(board); }
Please, help this kid. If you want to code. Please learn it and don't ask for some code when it doesn't work. Try doing it by yourself or just simple, quit coding.