generate method
Implementation
@override
Widget generate(Context context) {
switch (_subcommand) {
case 'merge':
return Command('data merge ${getTarget(context)} ${_getNbt()}');
case 'get':
final cmd = ['data get', getTarget(context), path];
if (scale != null) {
cmd.add(
scale! < 0.000001 ? scale!.toStringAsFixed(10) : scale.toString(),
);
}
return Command(cmd.join(' '));
case 'remove':
return Command('data remove ${getTarget(context)} $path');
case 'modify':
return Command('data modify ${getTarget(context)} $path $modify');
case 'score':
return Command(
'execute store result ${getTarget(context)} $path $datatype $scale run scoreboard players get ${score?.entity.toString()} ${score?.score}',
);
}
throw ('Invalid subcommand!');
}