@@ -41,30 +41,30 @@ public static ParserDescriptor<CommandSourceStack, Spell> ownedSpellParser() {
4141 CommandSender sender = stack .getExecutor ();
4242
4343 Optional <Spell > parsedValue = result .parsedValue ();
44- if (parsedValue .isPresent ()) {
45- Spell spell = parsedValue . get ();
46-
47- if ( sender instanceof Player player ) {
48- Spellbook spellbook = MagicSpells . getSpellbook ( player );
49- if ( spell . isHelperSpell () && ! Perm . COMMAND_CAST_SELF_HELPER . has (player ) || ! spellbook . hasSpell ( spell ))
50- return ArgumentParseResult . failure ( new GenericCommandException ( MagicSpells . getUnknownSpellMessage ()));
51- }
52-
53- if (! spell . canCastByCommand ())
54- return ArgumentParseResult . failure ( new GenericCommandException ( "You cannot cast this spell using commands." ));
55-
56- if ( spell . isRequiringCastItemOnCommand ()) {
57- if (!( sender instanceof LivingEntity entity ))
58- return ArgumentParseResult . failure ( new GenericCommandException ( spell . getStrWrongCastItem ()));
59-
60- EntityEquipment equipment = entity . getEquipment ();
61- if ( equipment == null )
62- return ArgumentParseResult . failure ( new GenericCommandException ( spell . getStrWrongCastItem ()));
63-
64- ItemStack item = equipment . getItemInMainHand ();
65- if (! spell . isValidItemForCastCommand ( item ))
66- return ArgumentParseResult . failure ( new GenericCommandException ( spell .getStrWrongCastItem ()));
67- }
44+ if (parsedValue .isEmpty ()) return result ;
45+
46+ Spell spell = parsedValue . get ();
47+
48+ if ( sender instanceof Player player ) {
49+ Spellbook spellbook = MagicSpells . getSpellbook (player );
50+ if ( spell . isHelperSpell () && ! Perm . COMMAND_CAST_SELF_HELPER . has ( player ) || ! spellbook . hasSpell ( spell ))
51+ return ArgumentParseResult . failure ( new GenericCommandException ( MagicSpells . getUnknownSpellMessage ()));
52+ }
53+
54+ if (! spell . canCastByCommand ())
55+ return ArgumentParseResult . failure ( new GenericCommandException ( "You cannot cast this spell using commands." ));
56+
57+ if (spell . isRequiringCastItemOnCommand ()) {
58+ if (!( sender instanceof LivingEntity entity ))
59+ return ArgumentParseResult . failure ( new GenericCommandException ( spell . getStrWrongCastItem ()));
60+
61+ EntityEquipment equipment = entity . getEquipment ();
62+ if ( equipment == null )
63+ return ArgumentParseResult . failure ( new GenericCommandException ( spell . getStrWrongCastItem ()));
64+
65+ ItemStack item = equipment . getItemInMainHand ();
66+ if (! spell .isValidItemForCastCommand ( item ))
67+ return ArgumentParseResult . failure ( new GenericCommandException ( spell . getStrWrongCastItem ()));
6868 }
6969
7070 return result ;
0 commit comments