Minestom wiki
Search…
Player capabilities
Minestom features a number of interaction methods for players. Many of them are described below, however this list is not exhaustive.
It is worth reviewing the Adventure API before this, because these systems depend heavily on Component.

Sidebars (Scoreboards)

Sidebars can be used to display up to 16 lines on a scoreboard for the player. They are created given a title as follows:
1
Sidebar#<init>(Component /* title */)
Copied!
Sidebar titles do not support JSON chat components, however the provided component will be serialized using Adventure's legacy serializer.
Once created, a scoreboard can be added and removed from players as follows:
1
Sidebar#addViewer(Player);
2
Sidebar#removeViewer(Player);
Copied!
Lines on a sidebar are made up of ScoreboardLines. They render on the scoreboard in order of their line number (score), where the vertically highest line represents the highest line number (score). If two lines have the same line number (score), they will be sorted alphabetically.
ScoreboardLines can be created using their constructor:
1
Sidebar.ScoreboardLine#<init>(String /* unique id*/, Component /* content */, int /* line */);
2
3
// For example
4
Sidebar.ScoreboardLine line = new Sidebar.ScoreboardLine(
5
"some_line_0",
6
Component.text("Hello, Sidebar!", NamedTextColor.RED),
7
0
8
);
Copied!
Once created, scoreboard lines may be added to Sidebars as follows:
1
Sidebar#createLine(Sidebar.ScoreboardLine);
Copied!
Lines are indexed by their unique id, and can be modified with it:
1
Sidebar#getLine(String /* unique id */);
2
Sidebar#updateLineContent(String /* unique id */, Component /* new content */);
3
Sidebar#updateLineScore(String /* unique id */, Int /* new score */);
Copied!

Notifications

Notifications are a system to send advancement completion toasts to a player as a form of communication.
They are a wrapper around Advancement, so you do not need to create any advancements to use them, just a Notification. See the Advancements page for more information on advancements.
1
Notification#<init>(Component /* title */, FrameType, ItemStack /* icon */);
2
3
// For example
4
Notification notification = new Notification(
5
Component.text("Hello, Notifications!", NamedTextColor.GREEN),
6
FrameType.GOAL,
7
ItemStack.of(Material.GOLD_INGOT)
8
);
Copied!
To send the notification, use one of the static methods on NotificationCenter:
1
NotificationCenter.send(Notification, Player);
2
NotificationCenter.send(Notification, Collection<Player>);
Copied!
The example renders as the following:
Last modified 29d ago