generate method

  1. @override
Widget generate(
  1. Context context
)
override

Implementation

@override
Widget generate(Context context) {
  if (context.version < 18) {
    assert(
      name.length <= 16,
      'A scoreboard can not be longer than 16 characters',
    );
  }

  switch (subcommand) {
    case 'add':
      return Extend(
        context.loadFile ?? 'load',
        child: Command('scoreboard objectives add $name $type'),
        first: true,
      );
    case 'addHere':
      return Command('scoreboard objectives add $name $type');
    case 'remove':
      return Command('scoreboard objectives remove $name');
    case 'modify':
      return Command(
        'scoreboard objectives modify $name rendertype ${useHearts! ? 'hearts' : 'integer'}',
      );
    case 'setdisplay':
      return Command('scoreboard objectives setdisplay $type $name');
  }
  return Comment.Null();
}