So for a KitPvP plugin I'm making, I want it so that when a player hits green wool, it gives them an item. Here is what I have so far (onInteract): PHP: elseif($block->getId() == 35){ if($block->getDamage() == 13){ if(isset($this->soup[$player->getName()])){ $player->sendMessage(TextFormat::BOLD . TextFormat::GREEN . "You got one free soup!"); $player->getInventory()->addItem(Item::get(282, 0, 1)); $level->addSound(new PopSound($player)); } else { $player->sendMessage(TextFormat::BOLD . TextFormat::GREEN . "You got one free healing potion!"); $player->getInventory()->addItem(Item::get(438, 22, 1)); $level->addSound(new PopSound($player)); } } } The problem with this however, is that there is alot of green wool on my map, and if I interact with those, it will also give me the item. That's why I want to get the position (the X, the Y, and the Z) of the block so it doesn't just go off giving players free stuff anywhere. Thanks in advance! P.S: On a completely unrelated topic, do you know that sound whenever you buy an item in Bedwars in Hypixel makes? Is that sound in Pocketmine too or no?
Use this. PHP: elseif($block->getId() == 35){ if($block->getDamage() == 13 and floor($block->getX()) == 10 and floor($block->getY()) == 20 and floor($block->getZ()) == 10){ if(isset($this->soup[$player->getName()])){ $player->sendMessage(TextFormat::BOLD . TextFormat::GREEN . "You got one free soup!"); $player->getInventory()->addItem(Item::get(282, 0, 1)); $level->addSound(new PopSound($player)); } else { $player->sendMessage(TextFormat::BOLD . TextFormat::GREEN . "You got one free healing potion!"); $player->getInventory()->addItem(Item::get(438, 22, 1)); $level->addSound(new PopSound($player)); } } }