Score.con constructor

Score.con(
  1. int number, {
  2. bool addNew = true,
  3. String type = 'dummy',
})

Do you need constant values with scores? objD got you covered with Score.con:

Score.con
int a constant number
addNew bool whether it should add objd_consts itself if it does not exist(default = true)
This will automatically create a scoreboard called objd_consts and set the value to the fake entity #[value]

Example:

Score.con(5)
⇒ scoreboard players set #5 objd_consts 5

Implementation

/// This will automatically create a scoreboard called `objd_consts` and set the value to the fake entity `#[value]`
///
/// **Example:**
/// ```dart
/// Score.con(5)
/// ⇒ scoreboard players set #5 objd_consts 5
/// ```
Score.con(
  int number, {
  bool addNew = true,
  this.type = 'dummy',
})  : score = 'objd_consts',
      entity = Entity.PlayerName(
        '#$number',
      ) {
  if (Scoreboard.prefix != null && !score.contains(Scoreboard.prefix!)) {
    score = Scoreboard.prefix! + score;
  }

  if (addNew) {
    _commands.add(
      Scoreboard(score, type: type),
    );
  }
  _commands.add(
    set(number),
  );
}