Minecraft – the problem with this command

minecraft-commandsminecraft-java-edition

So I've been trying to use this commands (on 1.8.8) that someone gave for ages! But when i try to put it in the command block it literally does nothing! Can someone tell me what is wrong? or fix the command if there's any errors?

The intended use of this commands is to detect players who tries to remove/throw iron sword (with the name Vladimir and lore Who names their sword that?!) in a specific slot and then it will quickly erase the sword then replace it.
In summary it Locks an item in a specific slot.

This is the list of commands:

/clear @a[score_hotbarlock=0,score_inGame_min=1] iron_sword 0 64 {ench:[],display:{Name:"Vladimir",Lore:["Who names their sword that?!"]}}

replaceitem entity @a[score_hotbarlock=0,score_inGame_min=1] slot.hotbar.8 iron_sword 1 0 {ench:[],display:{Name:"Vladimir",Lore:["Who names their sword that?!"]}}

/execute @e[score_inGame_min=1,score_hotbarlock=0]~ ~ ~ scoreboard players set @e[typeItem,r=2] dropitem 1 {Item:{id:"iron_sword",tag:{ench:[],display:{Name:"Vladimir",Lore:["Who names their sword that?!"]}}}}

/kill @e[score_dropitem_min=1]

Any help would be appreciated

Best Answer

First make sure that the relevant objectives are set up:

/scoreboard objectives add hotbarlock dummy
/scoreboard objectives add inGame dummy
/scoreboard objectives add dropitem dummy

And that you have the correct scores:

/scoreboard players set @p hotbarlock 0
/scoreboard players set @p inGame 1

The first two commands should be fine, but there are a few errors with the third command:

  1. You have missed a space between the first selector and ~.

  2. You have written "typeItem" rather than "type=Item".

  3. You have not given the full item ID, which is "minecraft:iron_sword".

Correct the third command to:

execute @e[score_inGame_min=1,score_hotbarlock=0] ~ ~ ~ scoreboard players set @e[type=Item,r=2] dropitem 1 {Item:{id:"minecraft:iron_sword",tag:{ench:[],display:{Name:"Vladimir",Lore:["Who names their sword that?!"]}}}}

After setting up the objectives properly, and correcting the third command, the system should work.