Skip to content

Getting Started

Jordan Osterberg edited this page Jul 4, 2021 · 2 revisions

Getting Started with JScoreboards

JScoreboards is a wrapper around Spigot's Scoreboard API, purpose built for the features that matter most to users (teams and displaying formatted text, as opposed to the traditional Minecraft Scoreboard uses).

To get started, you'll need to integrate JScoreboards into your project using Maven or Gradle.

See the README to get Maven repository information to add it into your project.

Your First Scoreboard

There are 2 types of scoreboards- Global, and Per Player. You have 2 options for each of these types: functional or method based:

JGlobalScoreboard, JPerPlayerScoreboard, JGlobalMethodBasedScoreboard, JPerPlayerMethodBasedScoreboard.

The main difference is the way the scoreboard content is updated. Here's the difference between the two options:

Supplier Based

JGlobalScoreboard scoreboard = new JGlobalScoreboard(
  () -> "Title", // The title supplier
  () -> { // The lines supplier
    return Arrays.asList(
      "Line one!",
      "Line two!"
    );
  }
);

Method Based

JGlobalMethodBasedScoreboard scoreboard = new JGlobalMethodBasedScoreboard();
scoreboard.setTitle("Title");
scoreboard.setLines(
  "Line one!",
  "Line two!"
);

It's up to you to decide which option you'd like to use- under the hood, the method based scoreboards are subclasses of their functional counterpart, and merely setup their own suppliers/functions for them.

Clone this wiki locally