本文整理汇总了PHP中pocketmine\event\entity\ProjectileLaunchEvent::getEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectileLaunchEvent::getEntity方法的具体用法?PHP ProjectileLaunchEvent::getEntity怎么用?PHP ProjectileLaunchEvent::getEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\entity\ProjectileLaunchEvent
的用法示例。
在下文中一共展示了ProjectileLaunchEvent::getEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onProjectileLaunch
public function onProjectileLaunch(ProjectileLaunchEvent $event)
{
try {
$player = $event->getEntity()->shootingEntity;
if ($player instanceof Player and $event->getEntity() instanceof Arrow) {
if ($event->getEntity() instanceof Arrow) {
foreach ($this->plugin->gameLevelManager->levels as &$lv) {
if ($lv instanceof GameLevelModel) {
if (count($lv->joinedPlayers) === 0) {
continue;
}
if (isset($lv->currentMap)) {
if (isset($lv->currentMap->playerscores[$player->getName()])) {
$lv->currentMap->shooters[$event->getEntity()->getId()] = $player->getName();
$scores = $lv->currentMap->playerscores[$player->getName()];
$scores["shots"] = $scores["shots"] + 1;
$lv->currentMap->playerscores[$player->getName()] = $scores;
break;
}
}
}
}
}
}
} catch (\Exception $e) {
$this->plugin->printError($e);
}
}
示例2: burstMode
public function burstMode(ProjectileLaunchEvent $event)
{
$entity = $event->getEntity();
$player = $event->getEntity()->shootingEntity;
if (!$player instanceof Player) {
return;
}
if ($player->closed) {
return;
}
if ($entity instanceof Snowball) {
$this->getServer()->getScheduler()->scheduleDelayedTask(new BurstSnowballTask($this, $player), 10);
$this->getServer()->getScheduler()->scheduleDelayedTask(new BurstSnowballTask($this, $player), 20);
}
}
示例3: burstMode
public function burstMode(ProjectileLaunchEvent $event)
{
$entity = $event->getEntity();
$player = $event->getEntity()->shootingEntity;
if ($player == null) {
return;
}
if ($entity instanceof Snowball) {
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstSnowball"], [$player]), 10);
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstSnowball"], [$player]), 20);
}
if ($entity instanceof Arrow) {
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstArrow"], [$player]), 10);
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstArrow"], [$player]), 20);
}
}
示例4: checkArrow
public function checkArrow(ProjectileLaunchEvent $event)
{
if ($event->getEntity() instanceof Arrow) {
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "removeArrow"], [$event]), 20);
}
}
示例5: onLaunch
public function onLaunch(ProjectileLaunchEvent $event)
{
$shooter = $event->getEntity()->shootingEntity;
if ($shooter instanceof Player) {
if ($this->checkSpawn($shooter, 5)) {
$this->message($shooter, $this->get("cannot-spawn-pvp"));
$event->setCancelled();
}
}
}
示例6: checkArrow
public function checkArrow(ProjectileLaunchEvent $event)
{
if ($event->getEntity() instanceof Arrow) {
$this->getServer()->getScheduler()->scheduleDelayedTask(new removeArrowTask($event, $this->getServer()), 20);
}
}