Score.fromSelected constructor
same as Score() but with a predefined entity(Entity.Selected(),)
Score.fromSelected('objective').set(3)
⇒ scoreboard players set @s objective 3
Implementation
Score.fromSelected(
this.score, {
bool addNew = true,
this.type = 'dummy',
}) : entity = Entity.Self() {
if (addNew) {
_commands.add(
Scoreboard(score, type: type),
);
}
if (Scoreboard.prefix != null && !score.contains(Scoreboard.prefix!)) {
score = Scoreboard.prefix! + score;
}
}