3030import studio .magemonkey .fabled .api .CastData ;
3131import studio .magemonkey .fabled .dynamic .DynamicSkill ;
3232
33+ import java .util .ArrayList ;
3334import java .util .List ;
3435
3536/**
3637 * Applies a flag to each target
3738 */
3839public class RememberTargetsMechanic extends MechanicComponent {
39- private static final String KEY = "key" ;
40+ private static final String KEY = "key" ;
4041 private static final String OVERWRITE = "overwrite" ;
4142
4243 @ Override
@@ -59,17 +60,17 @@ public boolean execute(LivingEntity caster, int level, List<LivingEntity> target
5960 return false ;
6061 }
6162
62- String key = settings .getString (KEY );
63- boolean overwrite = settings .getBool (OVERWRITE , true );
64- CastData castData = DynamicSkill .getCastData (caster );
65- Object rawTargets = castData .getRaw (key );
63+ String key = settings .getString (KEY );
64+ boolean overwrite = settings .getBool (OVERWRITE , true );
65+ CastData castData = DynamicSkill .getCastData (caster );
66+ Object rawTargets = castData .getRaw (key );
6667
6768 if (!overwrite && rawTargets instanceof List <?>) {
6869 @ SuppressWarnings ("unchecked" )
6970 List <LivingEntity > originalTargets = (List <LivingEntity >) rawTargets ;
7071 originalTargets .addAll (targets );
7172 } else {
72- castData .put (key , targets );
73+ castData .put (key , new ArrayList <>( targets ) );
7374 }
7475 return true ;
7576 }
0 commit comments