generate method

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

Implementation

@override
Widget generate(Context context) {
  if (_type == 'clear') {
    return CommandBuilder('effect clear $entity').string(
      effect?.name,
      prefix: 'minecraft:',
    );
  } else {
    return CommandBuilder('effect give $entity')
        .string(
          effect!.name,
          prefix: 'minecraft:',
        )
        .when(
          duration == null || duration!.isInfinite,
          then: 'infinite',
          otherwise: duration?.seconds.toStringAsFixed(0),
        )
        .string('$amplifier ${!showParticles!}');
  }
}