Hi, I made a crate key plugin that works when a player taps with an egg on a chest. Now I ran into the problem that players can't open other chests. Is there any solution for this?
You could add a config where you save the xyz for that specific chest, and when you run your code you check, if the player taps the chest with an egg and cancel the opening action, else you dont cancel it.
PHP: public function onTouch(PlayerInteractEvent $event) { $block = $event->getBlock(); if($block->getId() == $chestid && $player->getInventory()->getItemInHand()->getId() == $eggid) { /* $coordX = Chest X coordinate you saved $coordY = Chest Y coordinate you saved $coordZ = Chest Y coordinate you saved */ if($block->getX() == $coordX && $block->getY() == $coordY && $block->getZ() == $coordZ) { $event->setCancelled(true); // Your crate code } else { // Do something if it is not a crate } }