-2

I'm trying to make a "Villager Custom Shop Trade Thing-y". This Villager is going to sell a Heavy weighted pressure plate. When I have the item in my hotbar, I want the Item to disappear from my hotbar and immediately come back a Data tag.

Command Blocks:

Repeat - /scoreboard players set @a Pressure_Plate 0
Chain - /scoreboard players set @a Pressure_Plate 1 {SelectedItem:{id:"minecraft:heavy_weighted_pressure_plate"}
Chain - /execute @a[score_Pressure_Plate_min=1] ~ ~ ~ /give @p minecraft:heavy_weighted_pressure_plate 1 0 {CanPlaceOn:["minecraft:gold_block"]}

I added a scoreboard command after I put these commands on top:

/scoreboard objectives add Pressure_Plate dummy

So what I'm trying to detect the item in my hand, but I can't make it work. It says, "Unbalanced Brackets". I'm tried to fix it by I can't. Can you help me guys?

2
  • 2
    please dont add random tags to your question, only those that are relevant to it.
    – Dragonrage
    Commented Feb 25, 2017 at 6:41
  • 2
    (4 + 5 * 2. If you can find the problem here... You should be able to find it in your code. It says exactly what it has to say.
    – Karlyr
    Commented Feb 25, 2017 at 6:54

1 Answer 1

2

You had not closed the root compound for your second command. Compounds encase their data in opening and closing curly brackets, so you need to have an equal number of closing brackets as there are opening:

/scoreboard players set @a Pressure_Plate 1 {SelectedItem:{id:"minecraft:heavy_weighted_pressure_plate"}}

You can also remove the /execute portion of the third command, as all that does is cause unnecessary command processing. /give supports a selector, so use the intended selector in that command:

/give @a[score_Pressure_Plate_min=1] minecraft:heavy_weighted_pressure_plate 1 0 {CanPlaceOn:["minecraft:gold_block"]}
1
  • I was about to say that
    – ramidzkh
    Commented Feb 25, 2017 at 8:15

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