-1

So I'm trying to make a villager that would sell items to a player in a server. I was doing well until I messed up my brackets, and now I don't know what to do.

This is the command:

/summon Villager ~1 ~ ~ {Profession:2,CustomName:"Apollos",CustomNameVisible:1,Career:1,CareerLevel:42,CanPickUpLoot:0,PersistenceRequired:1,NoAI:1,Invulnerable:1,Attributes:[{Name:"generic.knockbackResistance",Base:"1f"},{Name:"generic.movementSpeed",Base:"0f"},{Name:"generic.maxHealth",Base:99999}],Offers:{Recipes:[{buy:{id:"diamond_block",Count:12},buyB:{id:"diamond",Count:5},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]},rewardExp:false},{buy:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]},maxUses:9999999999,sell:{id:"diamond_block",Count:8},rewardExp:false},{buy:{id:"nether_star",Count:4},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]},rewardExp:false},{buy:{id:"obsidian",Count:64},maxUses:9999999999,sell:{id:"nether_star",Count:1},rewardExp:false},{buy:{id:"obsidian",Count:64},buyB:{id:"obsidian",Count:64},maxUses:9999999999,sell:{id:"fire_charge",Count:1,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]},rewardExp:false},{buy:{id:"fire_charge",Count:2,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]},rewardExp:false},{buy:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]},maxUses:9999999999,sell:{id:"fire_charge",Count:2,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]},rewardExp:false}]}}

The error that I'm getting is:

Data tag parsing failed: Expected non-empty key at: ... is a currency"]},rewardExp:false},<--[HERE]]

1
  • 2
    Try a shorter command. Nobody can debug this monstrosity. Commented Jun 24, 2018 at 14:32

2 Answers 2

1

It is a similar error over and over. Missing some closing brackets with every item with the display tag. Most likely one error which was copied/pasted.

The first dragon egg:

sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}

Minus the data:

sell:{...,tag:{display:{...,Lore:[...]}

You have 3 opening curly brackets and only one closing. Every item which has a name and lore has this same mistake.

Here is the corrected command:

/summon Villager ~1 ~ ~ {Profession:2,CustomName:"Apollos",CustomNameVisible:1,Career:1,CareerLevel:42,CanPickUpLoot:0,PersistenceRequired:1,NoAI:1,Invulnerable:1,Attributes:[{Name:"generic.knockbackResistance",Base:"1f"},{Name:"generic.movementSpeed",Base:"0f"},{Name:"generic.maxHealth",Base:99999}],Offers:{Recipes:[{buy:{id:"diamond_block",Count:12},buyB:{id:"diamond",Count:5},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}}},rewardExp:false},{buy:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}}},maxUses:9999999999,sell:{id:"diamond_block",Count:8},rewardExp:false},{buy:{id:"nether_star",Count:4},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}}},rewardExp:false},{buy:{id:"obsidian",Count:64},maxUses:9999999999,sell:{id:"nether_star",Count:1},rewardExp:false},{buy:{id:"obsidian",Count:64},buyB:{id:"obsidian",Count:64},maxUses:9999999999,sell:{id:"fire_charge",Count:1,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]}}},rewardExp:false},{buy:{id:"fire_charge",Count:2,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]}}},maxUses:9999999999,sell:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}}},rewardExp:false},{buy:{id:"dragon_egg",Count:1,tag:{display:{Name:"&c&lDragon Egg",Lore:["Used in shops","It is a currency"]}}},maxUses:9999999999,sell:{id:"fire_charge",Count:2,tag:{display:{Name:"&c&lEmber",Lore:["Used in shops","It is a currency"]}}},rewardExp:false}]}}

It succeeds and produces the villager. One note though, color codes do not work on item names:
Trade


For future problems like this, I recommend putting the command into an editor with a search/find ability. This allows you to copy the portion of the text from the error and find it in the command. From there you can try to figure out what is wrong.

You can also use tools to format the command to spot any possible missing formatting within the command. One such tool is at http://jsonviewer.stack.hu/. Simply copy/paste your command into it and click format.

As an example, here is the Attributes section of your command:

Attributes: [
  {
    Name: "generic.knockbackResistance",
    Base: "1f"
  },
  {
    Name: "generic.movementSpeed",
    Base: "0f"
  },
  {
    Name: "generic.maxHealth",
    Base: 99999
  }
]

Update after comment, I played with the work around to create a path to a villager who sells the items with colored names. I was able to make it work with your command.

The way this works is a bit complicated. This command gives the nearest player a command sign. Place the sign and click it. The sign runs a setblock command which sets a command block in it's position with a command. That command is your command only with colored names. It uses the JSON color codes in the click event of the command sign.

Here is the command:

/give @p sign 1 0 {BlockEntityTag:{Text2:"{\"text\":\"Click\",\"color\":\"blue\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/setblock ~ ~ ~ command_block 2 replace {Command:\\\"/summon Villager ~1 ~ ~ {Profession:2,CustomName:\\\\\\\"Apollos\\\\\\\",CustomNameVisible:1,Career:1,CareerLevel:42,CanPickUpLoot:0,PersistenceRequired:1,NoAI:1,Invulnerable:1,Attributes:[{Name:\\\\\\\"generic.knockbackResistance\\\\\\\",Base:\\\\\\\"1f\\\\\\\"},{Name:\\\\\\\"generic.movementSpeed\\\\\\\",Base:\\\\\\\"0f\\\\\\\"},{Name:\\\\\\\"generic.maxHealth\\\\\\\",Base:99999}],Offers:{Recipes:[{buy:{id:\\\\\\\"diamond_block\\\\\\\",Count:12},buyB:{id:\\\\\\\"diamond\\\\\\\",Count:5},maxUses:9999999999,sell:{id:\\\\\\\"dragon_egg\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lDragon Egg\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},rewardExp:false},{buy:{id:\\\\\\\"dragon_egg\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lDragon Egg\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},maxUses:9999999999,sell:{id:\\\\\\\"diamond_block\\\\\\\",Count:8},rewardExp:false},{buy:{id:\\\\\\\"nether_star\\\\\\\",Count:4},maxUses:9999999999,sell:{id:\\\\\\\"dragon_egg\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lDragon Egg\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},rewardExp:false},{buy:{id:\\\\\\\"obsidian\\\\\\\",Count:64},maxUses:9999999999,sell:{id:\\\\\\\"nether_star\\\\\\\",Count:1},rewardExp:false},{buy:{id:\\\\\\\"obsidian\\\\\\\",Count:64},buyB:{id:\\\\\\\"obsidian\\\\\\\",Count:64},maxUses:9999999999,sell:{id:\\\\\\\"fire_charge\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lEmber\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},rewardExp:false},{buy:{id:\\\\\\\"fire_charge\\\\\\\",Count:2,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lEmber\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},maxUses:9999999999,sell:{id:\\\\\\\"dragon_egg\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lDragon Egg\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},rewardExp:false},{buy:{id:\\\\\\\"dragon_egg\\\\\\\",Count:1,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lDragon Egg\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},maxUses:9999999999,sell:{id:\\\\\\\"fire_charge\\\\\\\",Count:2,tag:{display:{Name:\\\\\\\"\\u00A7c\\u00A7lEmber\\\\\\\",Lore:[\\\\\\\"Used in shops\\\\\\\",\\\\\\\"It is a currency\\\\\\\"]}}},rewardExp:false}]}}\\\"}\"}}"}}

It looks a little weird but it does work. All of the escape slashes are required.

An image of the color name: Colored Name

However, I do not recommend using colored names with your currency items as this will require all future commands that use these items to have the same level of complication.

3
  • Thank you for correcting the command, this probably took you a while, and I'm really sorry for that. EDIT: also what do I do in order to give the item a colored name? Or can you not do that in command blocks?
    – Zizo Tron
    Commented Jun 25, 2018 at 19:13
  • No problem, it didn't take very long. Notepad++ makes it very easy to determine if it's a bracket problem. As for the names, colored names via commands is difficult to do anymore. The only current way that I am aware of is to use a command sign which sets a command block with a command in it which contains the colored name. It is a work around which is quite complicated. I have made it work with give commands so I know it actually works but to do it with your command would be quite challenging.
    – IronAnvil
    Commented Jun 26, 2018 at 2:20
  • I thought it would be a good challenge so I tried to make it work anyway. I got it to work with your command so I edited the answer to include the work around command. I did include that I don't recommend using colored names on your currency item as it will require complicated work arounds for any systems that you build using this item.
    – IronAnvil
    Commented Jun 26, 2018 at 2:51
-1

Honestly, manually debugging that is impossible but... Head on over to https://mcstacker.net/ and click on /summon and all of your command needs will be fulfilled.

1
  • Yea i will use that site from now on. I just tried it and its pretty useful.
    – Zizo Tron
    Commented Jun 25, 2018 at 19:18

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