this just shows how the forums doesn't help at all *sigh* time to go to twitter. Thx for nothing anyways.
And this: Just shows how little you tried before expecting us to print you out some code like a machine.
I think a IDE could be useful for you, The BlockPlaceEvent is called when a player places a block. PHP: public function onPlace(BlockPlaceEvent $event) { // save BlockPlaceEvent under $event // With $event you can do several things, eg: getting the player and sends him a message each time he places a block $event->getPlayer()->sendMessage("You placed a block"); }
Here you are PHP: public function onBlockPlace(BlockPlaceEvent $event){ $player = $event->getPlayer(); $inv = $player->getInventory(); $itemid = 1; // Itemid what should be cancelled to place if ($inv->getItemInHand()->getId() == $itemid) { // Happens if the Player places a block with the id in $itemid $event->setCancelled(); // Cancel BlockPlaceEvent $player->sendMessage("You cant place this Block"); }}
srry i hav not codded in a week but setCancled() means that the block is automatically removed removed if not can you show me how to?
Hi! If you use setCancelled() in the same case like I did above, the player can not place a block with the specified Itemid