How do I prevent other players from taking items out of a dropper? (1.18.2)



  • I'm currently making a trading system on my Minecraft server. You drop an item that spawns a dropper with a small UI. There are 2 empty slots where both players will put a custom player head from their inventory. These heads are the collectibles on my server. But my problem is that I can't prevent players from just taking the heads and leaving. I tried to give the heads inside of the dropper a custom nbt but I don't know how to do that. I also can't just clear the heads from the inventory because a player can have more than one head. I don't want to use data packs or plugins for this but I'm out of ideas...



  • /data merge block [pos] {Lock:"[password]"}
    
    • [pos] means the position of the dropper (you need to place it down first)

    • [password] means the password to unlock it (if you want it permanently locked just spam a bunch of random chars)

    To change the password, do the same command but with a different Lock key value.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2