File tree Expand file tree Collapse file tree
core/src/main/java/com/nisovin/magicspells/castmodifiers/conditions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import org .bukkit .entity .LivingEntity ;
66import com .nisovin .magicspells .util .Util ;
77
8- import net .kyori .adventure .text .Component ;
9-
108import com .nisovin .magicspells .castmodifiers .Condition ;
119
1210public class DisplayNameCondition extends Condition {
1311
14- private Component displayName ;
12+ private String displayName ;
1513
1614 @ Override
1715 public boolean initialize (String var ) {
1816 if (var == null || var .isEmpty ()) return false ;
19- displayName = Util .getMiniMessage (var );
17+ displayName = Util .getStringFromComponent ( Util . getMiniMessage (var ) );
2018 return true ;
2119 }
2220
@@ -28,7 +26,7 @@ public boolean check(LivingEntity livingEntity) {
2826 @ Override
2927 public boolean check (LivingEntity livingEntity , LivingEntity target ) {
3028 if (!(target instanceof Player player )) return false ;
31- return player .displayName ().equals (displayName );
29+ return Util . getStringFromComponent ( player .displayName () ).equals (displayName );
3230 }
3331
3432 @ Override
Original file line number Diff line number Diff line change 22
33import org .bukkit .Location ;
44import org .bukkit .entity .LivingEntity ;
5- import com .nisovin .magicspells .util .Util ;
6-
7- import net .kyori .adventure .text .Component ;
85
6+ import com .nisovin .magicspells .util .Util ;
97import com .nisovin .magicspells .castmodifiers .Condition ;
108
119public class NameCondition extends Condition {
1210
13- private Component name ;
11+ private String name ;
1412
1513 @ Override
1614 public boolean initialize (String var ) {
1715 if (var == null || var .isEmpty ()) return false ;
18- name = Util .getMiniMessage (var );
16+ name = Util .getPlainString ( Util . getMiniMessage (var ) );
1917 return true ;
2018 }
2119
@@ -26,7 +24,7 @@ public boolean check(LivingEntity livingEntity) {
2624
2725 @ Override
2826 public boolean check (LivingEntity livingEntity , LivingEntity target ) {
29- return target .name ().equals (name );
27+ return Util . getPlainString ( target .name () ).equals (name );
3028 }
3129
3230 @ Override
You can’t perform that action at this time.
0 commit comments