Alright, so I'm trying to set up a command to give me a sword with 7 attack damage and an attack speed of 100 so that it has no recharge. The command I'm entering goes as follows:

/give @p diamond_sword 1 0 {display:{Name:"Sword",Lore:["Smexy"]},AttributeModifiers:[{AttributeName:"generic.attackSpeed",Name:"generic.attackSpeed",Amount:100,Operation:1,UUIDMost:307,UUIDLeast:307,Slot:0b},{ench:[{id:16,lvl:10}]}}

And everytime I do the command it comes up with this:

Data tag parsing failed: Expected ']' but got '<EOF>' at: ...:307,Slot:0b},{ench:[{id:16,lvl:10}<--[HERE]

I have no idea what to do and help would be greatly appreciated.

  • Did you copy that command from somewhere? Try typing it manually, it seems like you have an invisible character in there. – Fabian Röling Oct 22 '17 at 1:45
  • I would also recommend using mcstacker.net for this in the future. Makes everything a whole lot easier. – getfugu Oct 22 '17 at 19:34

Lets simplify your command by removing all lot of data.

/give @p diamond_sword 1 0 {display:{...},AttributeModifiers:[{...},{ench:[{...}]}}

AttributeModifiers has no ] before the enchantment section. The enchantment section is contained in curly brackets and should not be. This would give us:

/give @p diamond_sword 1 0 {display:{...},AttributeModifiers:[{...}],ench:[{...}]}

The last thing, Slot:0b does not work with attribute modifiers to my knowledge. If you are wanting it to be in the main hand, the proper slot name is "mainhand"

Which would give us a final command of:

/give @p diamond_sword 1 0 {display:{Name:"Sword",Lore:["Smexy"]},AttributeModifiers:[{AttributeName:"generic.attackSpeed",Name:"generic.attackSpeed",Amount:100,Operation:1,UUIDMost:307,UUIDLeast:307,Slot:"mainhand"}],ench:[{id:16,lvl:10}]}

Which gives us this guy:

| improve this answer | |

Minecraft commands expect every certain symbols to be paired with each other. In particular, every [ or { should be matched with a ] or }, respectively. These symbols work similarly to parenthesis in Mathematics, they indicate that their contents should be considered as a single item. So the error message Expected ']' but got '<EOF>' means that your command had a [ symbol, but Minecraft couldn't find a ] to go with it.

In your particular case, Minecraft couldn't find a ] to go with the [ found right after AttributeModifiers:. So you should add a ] after all the attributes; specifically, between the last two } characters. This results in the following command, which executes successfully:

/give @p diamond_sword 1 0 {display:{Name:"Sword",Lore:["Smexy"]},AttributeModifiers:[{AttributeName:"generic.attackSpeed",Name:"generic.attackSpeed",Amount:100,Operation:1,UUIDMost:307,UUIDLeast:307,Slot:0b},{ench:[{id:16,lvl:10}]}]}

| improve this answer | |
  • This didn't work. It got rid of the error message but it didn't give the sword any level of sharpness – KrazyKirbyVI Oct 22 '17 at 3:47
  • The enchantment tag doesn't belong inside the attribute modifiers. It has to be only inside the outer most curly brackets. – D-Inventor Oct 22 '17 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.