public function onActivate(Item $item, Player $player) { if ($item->getID() === FLINT_STEEL) { if (($player->gamemode & 0x1) === 0) { $item->useOn($this); } $data = array("x" => $this->x + 0.5, "y" => $this->y + 0.5, "z" => $this->z + 0.5, "power" => 4, "fuse" => 20 * 4); $this->level->setBlock($this, new AirBlock(), false, false, true); $e = ServerAPI::request()->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data); ServerAPI::request()->api->entity->spawnToAll($e); return true; } return false; }
public function onActivate(Item $item, Player $player) { if ($item->getID() === DYE and $item->getMetadata() === 0xf) { if (($player->gamemode & 0x1) === 0) { $item->count--; } TallGrassObject::growGrass($this->level, $this, new Random(), 8, 2); return true; } elseif ($item->isHoe()) { if (($player->gamemode & 0x1) === 0) { $item->useOn($this); } $this->level->setBlock($this, new FarmlandBlock()); return true; } return false; }