Skip to content

ScoreboardAPI Main Page

Colasuonno edited this page Jan 8, 2018 · 2 revisions

Want to get information from ScoreboardAPI? Here you can find a useful list of tutorial on this plugin's API.

Redirect to useful pages

Features

  • Title (Max Lenght: 32) ✔
  • Line (Max Lenght: 32) ✔
  • Default Scoreboard ✔
  • No flicker ✔
  • Custom starting score (Default Scoreboard) ✔
  • Modify line by index (Score) ✔
  • Remove line by index (Score) ✔

PlaceHolders placeholders in beta

  • {CURRENTPLAYERS} Current online players
  • {MAXPLAYERS} Max player
  • {PLAYER} Player name
  • {PING} Player ping (Reflection)
  • Eco/Factions placeholders Soon...

Integration code

First of all you have to add this API to the dependencies of your plugin then you can init the NiceBoard.

            // init NiceBoard using ScoreboardUtil
            NiceBoard nice = ScoreboardUtil.registerScoreboard(DisplaySlot.SIDEBAR, "My Title");

            // Set score of scoreboard by index
            nice.setScore("&cTest", 1);

            // Remove score of scoreboard by index
            nice.removeScore(1);

            // Set to player the NiceBoard
            nice.addPlayer(e.getPlayer());

Updating NiceBoard

            /**
              * You have to call this method only one time
              * @param player
              */
            public void update(Player player){
                final NiceBoard niceBoard = ScoreboardUtil.registerScoreboard(DisplaySlot.SIDEBAR, Settings.TITLE);
                niceBoard.addPlayer(player);
                BukkitRunnable runnable = new BukkitRunnable() {
                    @Override
                    public void run() {
                        niceBoard.setScore("RandomNum: " + String.valueOf(new Random().nextInt(10)), 1);
                    }
                };
                runnable.runTaskTimer(ScoreboardAPI.getInstance() /** Plugin Instance **/, 0L, 20L);
            }