Hello, I am trying to mess around with the scoreboard feature. I cannot figure out why my scoreboard wont display.
Sponge Build:2.1 Snapshot
Plugin Source:
@Subscribe
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getUser();
player.sendMessage(Texts.of("This server is running GymScoreBoard v1.0"));
Scoreboard scoreboard = game.getRegistry().createScoreboardBuilder().build();
Objective obj = game.getRegistry().createObjectiveBuilder().name("test").criterion(Criteria.DUMMY).displayName(Texts.of("Test")).build();
obj.getScore(Texts.of("Test")).setScore(0);
obj.getScore(Texts.of("Test2")).setScore(1);
scoreboard.addObjective(obj);
scoreboard.addObjective(obj, DisplaySlots.SIDEBAR);
event.getSource().setScoreboard(scoreboard);
}
Probably not implemented yet
Scoreboards are fairly well implemented. I’ve seen several examples of people using them. However I do not know why the provided code isn’t working…
Not sure if this helps. But this is the scoreboard code from my plugin (scoreboards work)
Scoreboard board = GAME.getRegistry().createScoreboardBuilder().build();
Objective sideObjective = GAME.getRegistry().createObjectiveBuilder().displayName(Texts.builder("")).build()).name("MainSideBoard").criterion(Criteria.DUMMY).build();
sideObjective.getScore(Texts.builder("Money").build()).setScore(player.getMoney());
sideObjective.getScore(Texts.builder("Ping").build()).setScore(((Player)player.getUser()).getConnection().getPing());
board.addObjective(sideObjective);
board.addObjective(sideObjective, DisplaySlots.SIDEBAR);
Scoreboards are implemented. Are you using the latest development build?