When using an option referring to a shield with a name, it doesn't recognise the shield as an item if you write "shield" and not "shields".
options:
admin_shield: shield named "&fAdmin Shield"
command /AdminShield:
trigger:
give player {@admin_shield}
use this code with skript 2.4-beta8, and in game do /adminshield, not tested on other version
I should get a shield with the name "Admin Shield" using "shield" or "shields"
No error in the console
This has nothing to do with options, it has to do with item types with data.
ex:
give player diamond sword named "bob" will not work
give player a diamond sword named "bob" will work
You need to add a before the item
But then why does it works with "shields" and not "shield" ?
That's grammar... look at the 2 following sentences:
Bob gave an apple to Steve
Bob gave apples to Steve
If there is no error it should definitely work (also the code is correct). I think Shane states that there is a bug with shield but a shield works (weird)
Hmm... What I was able to find is:
command /test:
trigger:
give player shield
Works
command /test:
trigger:
give player shield named "test"
Doesn't Work
Both parse successfully, but the one with the named "test" doesn't
Wealthyturtle I know that's grammar but both should work the same according to the alias files
In second case, item is from expression. Aliases are not expressions; that could explain the difference.
Okay... after much MUCH testing I figured out what the issue is.
When the named expression is initializing, its thinking that shield is the player's shield.
I ran two tests, one with shield and one with a shield, outcome: (I just added some debug code into the plugin to test the initialization)
[00:21:16 INFO]: This is initializing - name: "shield test" exp: the tool of event-living entity
[00:21:16 INFO]: This is initializing - name: "a shield test" exp: shield
as you can see shield returns the expression the tool of event-living entity
and a shield returns the expression shield
so when you do something like give player shield named "TEST", Skript is thinking you are saying give player shield of player named "TEST"
If I put a diamond sword in my offhand slot and run give player shield of player named "TEST" it gives me a diamond sword named "TEST"
hence why a shield works perfectly.
I'm not entirely sure how to fix this, or if this is even fixable, technically this isn't a bug as this could be considered "expected behaviour"
Aliases could take priority over expressions if the expression directly matches an alias?
shield -> alias, because shield exists as one
player's shield -> expression, because there is no player's shield alias
Most helpful comment
Okay... after much MUCH testing I figured out what the issue is.
When the named expression is initializing, its thinking that
shieldis the player's shield.I ran two tests, one with
shieldand one witha shield, outcome: (I just added some debug code into the plugin to test the initialization)as you can see
shieldreturns the expressionthe tool of event-living entityand
a shieldreturns the expressionshieldso when you do something like
give player shield named "TEST", Skript is thinking you are sayinggive player shield of player named "TEST"If I put a diamond sword in my offhand slot and run
give player shield of player named "TEST"it gives me a diamond sword named "TEST"hence why
a shieldworks perfectly.I'm not entirely sure how to fix this, or if this is even fixable, technically this isn't a bug as this could be considered "expected behaviour"