当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerInteractEvent::getPlayer方法代码示例

本文整理汇总了PHP中pocketmine\event\player\PlayerInteractEvent::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerInteractEvent::getPlayer方法的具体用法?PHP PlayerInteractEvent::getPlayer怎么用?PHP PlayerInteractEvent::getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\player\PlayerInteractEvent的用法示例。


在下文中一共展示了PlayerInteractEvent::getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compassTracker

 public function compassTracker(PlayerInteractEvent $ev)
 {
     $p = $ev->getPlayer();
     if ($p->getInventory()->getItemInHand()->getId() === 345 && $ev->getAction() === PlayerInteractEvent::RIGHT_CLICK_AIR) {
         if (in_array($ev->getPlayer()->getName(), $this->compass)) {
             $p->sendMessage("§c§lYou cant use this for 3 minutes!");
             $ev->setCancelled(true);
             return;
         }
         if (!in_array($ev->getPlayer()->getName(), $this->compass)) {
             array_push($this->compass, $ev->getPlayer()->getName());
             $p->sendTip("§c§lYou cant use this for 3 minutes!");
             $task = new Task($this, $ev->getPlayer());
             $this->getServer()->getScheduler()->scheduleDelayedTask($task, 3600);
             $pickqv = [];
             $distSqMap = [];
             foreach ($p->getLevel()->getPlayers() as $player) {
                 asort($distSqMap);
             }
             foreach ($distSqMap as $id => $distSq) {
                 $p->sendMessage("§b§l" . $picked[$id]->getDisplayName() . " §fis §c" . round(sqrt($distSq)) . " §fblocks from you.");
             }
         }
     }
 }
开发者ID:EXkurumi,项目名称:CompassTracker,代码行数:25,代码来源:Main.php

示例2: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     if ($event->getPlayer() instanceof Player) {
         $player = $event->getPlayer();
         $block = $event->getBlock();
         if ($this->plugin->blockhud) {
             $event->getPlayer()->sendMessage("TOUCHED " . $block->getId() . " [x=" . round($block->x) . " y=" . round($block->y) . " z=" . round($block->z) . "]");
         }
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:10,代码来源:PlayerWelcomeListener.php

示例3: onBlock

 public function onBlock(PlayerInteractEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("Farms") and !$event->getPlayer()->hasPermission("Farms.VIP")) {
         return;
     }
     $block = $event->getBlock()->getSide(1);
     // Cocoa been
     if ($event->getItem()->getId() == Item::DYE and $event->getItem()->getDamage() == 3) {
         $tree = $event->getBlock()->getSide($event->getFace());
         // Jungle wood
         if ($tree->getId() == Block::WOOD and $tree->getDamage() == 3) {
             $event->getBlock()->getLevel()->setBlock($event->getBlock()->getSide($event->getFace()), new CocoaBeanBlock($event->getFace()), true, true);
             return;
         }
     }
     // Farmland or sand
     if ($event->getBlock()->getId() == Item::FARMLAND or $event->getBlock()->getId() == Item::SAND) {
         foreach ($this->crops as $crop) {
             if ($event->getItem()->getId() == $crop["item"]) {
                 $key = $block->x . "." . $block->y . "." . $block->z;
                 $this->farmData[$key]['id'] = $crop["block"];
                 $this->farmData[$key]['damage'] = 0;
                 $this->farmData[$key]['level'] = $block->getLevel()->getFolderName();
                 $this->farmData[$key]['time'] = $this->makeTimestamp(date("Y-m-d H:i:s"));
                 $this->farmData[$key]['growtime'] = $this->speedData[$event->getPlayer()->hasPermission("Farms.VIP") ? "vip-growing-time" : "growing-time"];
                 break;
             }
         }
     }
 }
开发者ID:pilock,项目名称:Farms,代码行数:30,代码来源:Farms.php

示例4: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($player instanceof Player) {
         if (round($this->plugin->vipSignPos->x) === round($block->x) and round($this->plugin->vipSignPos->y) === round($block->y) and round($this->plugin->vipSignPos->z) === round($block->z)) {
             if ($this->plugin->vipenforceaccess) {
                 $vip = $this->checkInVIP($event->getPlayer());
                 if (!$vip) {
                     $message = TextFormat::YELLOW . "[HG] Require " . TextFormat::RED . "VIP+ " . TextFormat::YELLOW . "membership.";
                     $event->getPlayer()->sendMessage($message);
                     return;
                 }
             }
             MapPortal::teleportingToLobby($player, $this->plugin->vipLevelName, $this->plugin->vipSpawnPos);
             $this->plugin->log("[HG] teleporting to VIP lodge " . $this->plugin->vipSpawnPos->x . " " . $this->plugin->vipSpawnPos->y . " " . $this->plugin->vipSpawnPos->z);
             $player->sendTip(TextFormat::BOLD . TextFormat::WHITE . "Welcome to " . TextFormat::RED . "[V.I.P.+ " . TextFormat::GOLD . "Lodge]");
             return;
         }
         if (round($this->plugin->vipExitSignPos->x) === round($block->x) and round($this->plugin->vipExitSignPos->y) === round($block->y) and round($this->plugin->vipExitSignPos->z) === round($block->z)) {
             MapPortal::teleportingToLobby($player, $this->plugin->hubLevelName, $this->plugin->hubSpawnPos);
             $this->plugin->log("[HG] teleporting to HG lobby " . $this->plugin->hubSpawnPos->x . " " . $this->plugin->hubSpawnPos->y . " " . $this->plugin->hubSpawnPos->z);
             $player->sendTip(TextFormat::BOLD . TextFormat::WHITE . "Welcome to " . TextFormat::RED . "HG " . TextFormat::GOLD . "Lobby");
             return;
         }
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:27,代码来源:VIPPlayerListener.php

示例5: onPlayerTouch

 public function onPlayerTouch(PlayerInteractEvent $event)
 {
     if ($event->getBlock()->getId() == 68 || $event->getBlock()->getId() == 63) {
         $sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
         if ($sign instanceof Sign) {
             $signtext = $sign->getText();
             if ($signtext[0] == "§l§4[Brawl]") {
                 $player = $event->getPlayer();
                 $name = $player->getName();
                 $this->getServer()->getScheduler()->scheduleRepeatingTask(new Task1($this), 20 * 60);
                 if (empty($signtext[3]) !== true) {
                     $worlds = $signtext[3];
                     $this->getServer()->loadLevel($worlds);
                     $event->getPlayer()->teleport(Server::getInstance()->getLevelByName($worlds)->getSafeSpawn());
                     if ($world = $this->getServer()->getLevelByName($worlds)) {
                         $count = count($world->getPlayers());
                         $player->sendTip(TextFormat::GREEN . "§l§4[Brawl] Téléportation en cour !");
                         $this->getServer()->broadcastMessage("§l§4[Brawl]§a {$name} rejoin la partie §7[{$count}/8]");
                         $player->setNameTag("§7" . $player->getName());
                         $player->setDisplayName("§7" . $player->getName());
                         $duration = $this->cfg->get("Duration");
                         $player->getInventory()->clearAll();
                         if ($this->gameStarted === true & ($this->timer = 60 & count($this->players) > 8 & $player->isOp())) {
                             $event->setCancelled(true);
                             $player->sendMessage("§l§4[Brawl] Tu ne peut pas rejoindre cette partie");
                             $this->refreshSign();
                             return;
                             //sign event use
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:SuperAdam47,项目名称:BrawlPVP,代码行数:35,代码来源:Main.php

示例6: onBlockTap

 public function onBlockTap(PlayerInteractEvent $e)
 {
     $id = $e->getPlayer()->getInventory()->getItemInHand()->getID();
     if ($id == 283) {
         $this->Item_GoldenSword->useItem($e->getPlayer(), $e->getBlock());
     }
 }
开发者ID:moinngmg,项目名称:MagicalAPI_Item,代码行数:7,代码来源:Main.php

示例7: onPlayerTouch

 public function onPlayerTouch(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     $b = $event->getBlock();
     $name = $event->getPlayer()->getName();
     $name = strtolower($name);
     if ($b->getID() === 63 || $b->getID() === 68) {
         $sign = $player->getLevel()->getTile($b);
         if (!$sign instanceof Sign) {
             return;
         }
         $sign = $sign->getText();
         if (TextFormat::clean($sign[0]) === '[Checkpoint]') {
             $this->data->set($name, array($player->x, $player->y, $player->z, $player->getLevel()->getName()));
             $this->data->save();
             $player->sendMessage($this->getConfig()->get("CheckpointSaved"));
         }
         if (TextFormat::clean($sign[0]) === '[Earn Reward]') {
             $this->data->remove($name, array($player->x, $player->y, $player->z, $player->getLevel()->getName()));
             $this->data->save();
             $player->sendMessage($this->getConfig()->get("EarnReward"));
             if ($this->getConfig()->get("reward-command")) {
                 $player->getServer()->dispatchCommand(new ConsoleCommandSender(), str_ireplace("{PLAYER}", $player->getName(), $this->getConfig()->get("reward-command")));
                 $player->teleport($player->getLevel()->getSafeSpawn());
             }
         }
     }
     if ($b->getID() === $this->getConfig()->get("CheckPointBlock")) {
         $this->data->set($name, array($player->x, $player->y, $player->z, $player->getLevel()->getName()));
         $this->data->save();
         $player->sendMessage($this->getConfig()->get("CheckpointSaved"));
     }
 }
开发者ID:NL-4-DEVS,项目名称:Parkour,代码行数:33,代码来源:Main.php

示例8: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     if ($event->getPlayer() instanceof Player) {
         $player = $event->getPlayer();
         $block = $event->getBlock();
         $this->plugin->arenaManager->handleTapOnArenaSigns($player, $block);
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:8,代码来源:MapArenaListener.php

示例9: Touch1b

 public function Touch1b(PlayerInteractEvent $cto)
 {
     $blockDis = $cto->getBlock()->getID();
     $block = $cto->getBlock();
     if ($cto->getPlayer()->isOp()) {
         if ($blockDis == $this->ymlBlock) {
             // fix :>
             $cto->getPlayer()->getLevel()->dropItem(new \pocketmine\math\Vector3($block->x, $block->y, $block->z), Item::get($this->ymal["ItemID"]));
         }
     }
 }
开发者ID:NawafCraft,项目名称:DispenserPE,代码行数:11,代码来源:Main.php

示例10: onTouchCrate

 public function onTouchCrate(PlayerInteractEvent $e)
 {
     if ($e->getBlock()->getId() == 54) {
         if ($e->getItem()->getId() == $this->getConfig()->get("cratekey-item")) {
             if ($e->getPlayer()->hasPermission("mysterycrates.crates.open")) {
                 $e->setCancelled();
                 $this->openCrate($e->getPlayer());
             }
         }
     }
 }
开发者ID:ChiefArtz,项目名称:MysteryCrates,代码行数:11,代码来源:Main.php

示例11: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("customareas.bypass")) {
         foreach ($this->plugin->areas as $area) {
             if ($area->isInside($event->getBlock()) and !$area->canBuild($event->getPlayer())) {
                 $event->setCancelled();
                 $event->getPlayer()->sendMessage("This is " . $area->owner . "'s private area");
             }
         }
     }
 }
开发者ID:robske110,项目名称:CustomAreas,代码行数:11,代码来源:EventListener.php

示例12: onTouch

 public function onTouch(PlayerInteractEvent $event)
 {
     if (isset($this->synchro_queue[$event->getPlayer()->getName()])) {
         if (isset($this->synchro_queue[$event->getPlayer()->getName()])) {
             unset($this->synchro_queue[$event->getPlayer()->getName()]);
         }
         $event->setCancelled();
         $player = $event->getPlayer();
         $level = $player->getLevel();
         $idea_level = $this->getServer()->getLevelByName($level->getFolderName() . "_IDEA");
         if (!$idea_level instanceof Level) {
             $player->sendMessage(TextFormat::RED . $this->get("idea-doesnt-exist"));
             return;
         }
         $chunk = $idea_level->getChunk($event->getBlock()->x >> 4, $event->getBlock()->z >> 4, true);
         if (!$chunk instanceof FullChunk) {
             $player->sendMessage(TextFormat::RED . $this->get("idea-is-breakdown"));
             return;
         }
         $c_chunk = clone $chunk;
         $c_chunk->setX($chunk->getX());
         $c_chunk->setZ($chunk->getZ());
         $level->setChunk($chunk->getX(), $chunk->getZ(), $c_chunk, true);
         $level->save(true);
         $player->sendMessage(TextFormat::DARK_AQUA . $this->get("idea-instance-synchro-100"));
     } else {
         if (isset($this->shift_queue[$event->getPlayer()->getName()])) {
             if (isset($this->shift_queue[$event->getPlayer()->getName()])) {
                 unset($event->getPlayer()->shift_queue[$event->getPlayer()->getName()]);
             }
             $event->setCancelled();
             $player = $event->getPlayer();
             $level = $player->getLevel();
             $idea_level = $this->getServer()->getLevelByName($level->getFolderName() . "_IDEA");
             if (!$idea_level instanceof Level) {
                 $player->sendMessage(TextFormat::RED . $this->get("idea-doesnt-exist"));
                 return;
             }
             $chunk = $level->getChunk($event->getBlock()->x >> 4, $event->getBlock()->z >> 4, true);
             if (!$chunk instanceof FullChunk) {
                 $player->sendMessage(TextFormat::RED . $this->get("idea-is-breakdown"));
                 return;
             }
             $c_chunk = clone $chunk;
             $c_chunk->setX($chunk->getX());
             $c_chunk->setZ($chunk->getZ());
             $idea_level->setChunk($chunk->getX(), $chunk->getZ(), $c_chunk);
             $idea_level->save(true);
             $player->sendMessage(TextFormat::DARK_AQUA . $this->get("idea-instance-synchro-100"));
         }
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:52,代码来源:IDEA.php

示例13: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     $level = $event->getPlayer()->level;
     $player = $event->getPlayer();
     $blockTouched = $event->getBlock();
     //        if (\pocketmine\DEBUG > 1) {
     //            $direction = $player->getDirectionVector();
     //            $msg = "Player direction is X:" . round($direction->x, 2) . " Y:" . round($direction->y, 2) . " Z:" . round($direction->z, 2);
     //            $this->pgin->log($msg);
     //            $player->sendMessage($msg);
     //        }
     QRhelper::CreateQRAndUnmark($this->pgin, $player, $blockTouched, $level, true);
 }
开发者ID:JiangsNetworkAlpha,项目名称:URL_JIANGSTER,代码行数:13,代码来源:QRcraftPlugInListener.php

示例14: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     $sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
     if ($event->getBlock()->getId() == 63 or $event->getBlock()->getId() == 68) {
         if ($sign instanceof Sign) {
             $signtext = $sign->getText();
             if (TextFormat::clean($signtext[0]) === "[DeadEnd]") {
                 $player->teleport(126.3, 5, 128.3, DeadEnd - lobby);
                 $player->sendMessage(TextFormat::GOLD . "You entered DeadEnd!");
             }
         }
     }
 }
开发者ID:Skull3x,项目名称:DontStopRunning,代码行数:14,代码来源:Main.php

示例15: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     if (isset($this->c[$event->getPlayer()->getName()]) && $event->getBlock()->getID() == 54) {
         $tile = $event->getPlayer()->getLevel()->getTile(new Vector3($event->getBlock()->x, $event->getBlock()->y, $event->getBlock()->z));
         $new = [];
         for ($i = 0; $i < 27; $i++) {
             $new[] = array($tile->getItem($i)->getID(), $tile->getItem($i)->count, $tile->getItem($i)->getDamage());
         }
         $this->config->set($event->getBlock()->x . ":" . $event->getBlock()->y . ":" . $event->getBlock()->z . ":" . $event->getPlayer()->getLevel()->getName(), $new);
         $this->config->save();
         $event->getPlayer()->sendMessage("Chest added.");
         unset($this->c[$event->getPlayer()->getName()]);
     }
 }
开发者ID:KidPlaysMCPE,项目名称:ChestRefill,代码行数:14,代码来源:ChestRefill.php


注:本文中的pocketmine\event\player\PlayerInteractEvent::getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。