public function shoot() { if (!$this->shoot) { $time = microtime(true); if (!$this->canShoot($time)) { return false; } if ($this->ammo <= 0) { return false; } $this->ammo--; $this->onShoot(); $this->shoot = true; $players = []; foreach ($this->player->getLevel()->getPlayers() as $player) { if ($player->getName() === $this->player->getName()) { continue; } $players[$player->getName()] = [$player->getX(), $player->getY() + 1.62, $player->getZ()]; } $thr = new ShootTask($this->player->getX(), $this->player->getY() + 1.62, $this->player->getZ(), $this->player->yaw, $this->player->pitch, $players, $this->getMaxRange(), $this->player->getName()); $this->plugin->submitAsyncTask($thr); } return true; }
public function onCompletion(Server $server) { if (($gun = MineCombat::getInstance()->getGunByPlayer($this->player)) !== null) { $gun->processShoot($this->ret); } }