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


PHP player\PlayerInteractEvent类代码示例

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


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

示例1: onPlayerInteract

 /**
  * @param PlayerInteractEvent $event
  *
  * @priority HIGHEST
  */
 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     echo __METHOD__ . "," . __LINE__ . "\n";
     //##DEBUG
     if (!$this->auth->isPlayerAuthenticated($event->getPlayer())) {
         echo __METHOD__ . "," . __LINE__ . "\n";
         //##DEBUG
         $event->setCancelled(true);
     }
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:15,代码来源:EventListener.php

示例2: onBlockTouch

 public function onBlockTouch(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     if (!$player->haspermission("worldprotetor.block.break")) {
         $event->setCancelled(true);
     } else {
         $event->setCancelled(false);
     }
 }
开发者ID:HeroGamingZ,项目名称:PocketMine-MP-Plugins,代码行数:9,代码来源:Main.php

示例3: onTouth

 public function onTouth(PlayerInteractEvent $event)
 {
     if (!isset($this->wands[$event->getPlayer()->getName()])) {
         $eventname = "Touch";
         $this->regi($event, $eventname);
     } else {
         $this->chk($event);
         $event->setCancelled(true);
     }
 }
开发者ID:PMMP-JPN,项目名称:KillBearBoys,代码行数:10,代码来源:KillBearBoys.php

示例4: 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

示例5: onPlayerInteract

 /**
  * @priority HIGHEST
  */
 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     if ($event->isCancelled()) {
         return;
     }
     $p = $event->getPlayer();
     $b = $event->getBlock();
     if ($b->getID() !== 26) {
         return;
     }
     $event->setCancelled();
     $xTabel = [3 => 1, 1 => -1];
     $b = $b->getSide(5, isset($xTabel[$dmg = $b->getDamage()]) ? $xTabel[$dmg] : 0);
     $zTabel = [0 => 1, 2 => -1];
     $b = $b->getSide(3, isset($zTabel[$dmg]) ? $zTabel[$dmg] : 0);
     $this->getServer()->getPluginManager()->callEvent($ev = new PlayerBedEnterEvent($p, $b));
     if ($ev->isCancelled()) {
         return;
     }
     $property = (new \ReflectionClass("\\pocketmine\\Player"))->getProperty("sleeping");
     $property->setAccessible(true);
     foreach ($p->getLevel()->getNearbyEntities($p->getBoundingBox()->grow(2, 1, 2), $p) as $pl) {
         if ($pl instanceof Player && $pl->isSleeping()) {
             if ($b->distance($property->getValue($pl)) <= 0.1) {
                 $p->sendMessage("This bed is occupied");
                 return;
             }
         }
     }
     $property->setValue($p, $b);
     $p->teleport($b->add(0.5, 0.5, 0.5));
     $p->sendMetadata($p->getViewers());
     $p->sendMetadata($p);
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:37,代码来源:HealBed.php

示例6: onInteract

 /**
  * @param PlayerInteractEvent $event
  *
  * @priority LOW
  */
 public function onInteract(PlayerInteractEvent $event)
 {
     if ($event->getAction() !== PlayerInteractEvent::RIGHT_CLICK_BLOCK) {
         return;
     }
     $player = $event->getPlayer();
     $gamer = $this->hub->getGamerForPlayer($player);
     $item = $event->getItem();
     $block = $event->getBlock();
     if ($block instanceof SignPost) {
         $sign = $block->getLevel()->getTile($block);
         if (!$sign instanceof Sign) {
             unset($sign);
         }
     }
     foreach ($this->hub->getJoinMethods() as $method) {
         if (!$method->isLevelCorrect($player->getLevel())) {
             continue;
         }
         if ($method instanceof KeyJoinMethod) {
             if ($method->key === null or $method->key->equals($item, true, false)) {
                 if ($method->lock === null or $method->lock->equals($block)) {
                     $gamer->setModule($this->hub->getModule($method->target));
                     return;
                 }
             }
         } elseif (isset($sign) and $method instanceof SignJoinMethod) {
             if ($method->matches($sign)) {
                 $gamer->setModule($this->hub->getModule($method->target));
                 return;
             }
         }
     }
 }
开发者ID:gitter-badger,项目名称:DynamicHub,代码行数:39,代码来源:JoinListener.php

示例7: 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

示例8: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     $block = $event->getBlock();
     $player = $event->getPlayer();
     if (isset($this->normalSessions[$player->getName()])) {
         if ($this->normalSessions[$player->getName()] === 'action') {
             $player->sendMessage("Please write your command into chat (with a slash!), other players won't be able to see it!");
             $player->sendMessage("Execution Mode Tags: %pow, %op");
             $player->sendMessage("Special Tags: %p, %x, %y, %z, %l, %ip, %n");
             $this->normalSessions[$player->getName()] = $block;
             $this->cmdSessions[$player->getName()] = false;
         } else {
             if (($tempBlock = $this->getBlock($block, null, null, null)) instanceof Block) {
                 $this->deleteBlock($tempBlock);
                 $player->sendMessage("Removed all actions assigned to the block.");
                 unset($this->normalSessions[$player->getName()]);
             } else {
                 $player->sendMessage("Error: Block doesn't exist.");
             }
         }
     }
     if (!isset($this->normalSessions[$player->getName()]) && ($block = $this->getBlock($event->getBlock(), null, null, null)) instanceof Block && $event->getPlayer()->hasPermission("ttdleet.tap")) {
         $block->executeCommands($event->getPlayer());
     }
 }
开发者ID:DWWf,项目名称:TapToDo-LEET.CC,代码行数:25,代码来源:TapToDo.php

示例9: onTouch

 public function onTouch(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($this->plugin->war->getSoldier($player) != null) {
         if ($block->getId() == 54) {
             $event->setCancelled();
             $block = $event->getBlock();
             if (!isset($this->touchinfo[$player->getName()])) {
                 $this->giveRandomItem($player);
                 $this->touchinfo[$player->getName()] = [];
                 array_push($this->touchinfo[$player->getName()], "{$block->getX()}.{$block->getY()}.{$block->getZ()}");
                 $this->plugin->message($player, $this->plugin->get("get-item-from-chest"));
             } else {
                 foreach ($this->touchinfo[$player->getName()] as $stringpos) {
                     if ($stringpos == "{$block->getX()}.{$block->getY()}.{$block->getZ()}") {
                         $this->plugin->alert($player, $this->plugin->get("already-get-item"));
                         return true;
                     }
                 }
                 $this->giveRandomItem($player);
                 array_push($this->touchinfo[$player->getName()], "{$block->getX()}.{$block->getY()}.{$block->getZ()}");
                 $this->plugin->message($player, $this->plugin->get("get-item-from-chest"));
             }
         }
     }
 }
开发者ID:organization,项目名称:MCFTWARS,代码行数:27,代码来源:EventListener.php

示例10: 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

示例11: onTouch

 public function onTouch(PlayerInteractEvent $event)
 {
     $block = $event->getBlock();
     if (isset($this->configData["{$block->x}:{$block->y}:{$block->z}"])) {
         $this->getServer()->getCommandMap()->dispatch($event->getPlayer(), $this->configData["{$block->x}:{$block->y}:{$block->z}"]);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:7,代码来源:SignCommand.php

示例12: onTouch

 public function onTouch(PlayerInteractEvent $event)
 {
     $block = $event->getBlock();
     $player = $event->getPlayer();
     $arena = "0";
     $level = $player->getLevel();
     if ($block->getID() === Block::SNOW_BLOCK) {
         $player->getLevel()->setBlock($block, new Block(Block::AIR));
     }
     if ($block->getId() === Block::SPONGE) {
         $player->sendMessage("Reseting Spleef");
         $X = $this->setup->get("X");
         $X1 = $this->setup->get("X");
         $Y = $this->setup->get("Y");
         $Z = $this->setup->get("Z");
         $Z1 = $this->setup->get("Z");
         for ($Z > $Z1 - 13; $Z < $Z1 + 13; $Z++) {
             $level->setBlock(new Vector3($X - 6, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X - 5, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X - 4, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X - 3, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X - 2, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X - 1, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 1, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 2, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 3, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 4, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 5, $Y, $Z), new Snow());
             $level->setBlock(new Vector3($X + 6, $Y, $Z), new Snow());
         }
     }
 }
开发者ID:SuperDude36,项目名称:Pocketmine-MP-Plugins,代码行数:33,代码来源:Main.php

示例13: 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

示例14: onBlockTap

 /**
  * @param PlayerInteractEvent $event
  *
  * @priority HIGH
  */
 public function onBlockTap(PlayerInteractEvent $event)
 {
     // PowerTool
     if ($this->getAPI()->executePowerTool($event->getPlayer(), $event->getItem())) {
         $event->setCancelled(true);
     }
 }
开发者ID:TBNRFrags2468,项目名称:EssentialsPE,代码行数:12,代码来源:OtherEvents.php

示例15: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     $p = $event->getPlayer();
     $i = $event->getItem();
     if ($i->getID() !== 339 || ($money = $i->getDamage()) < 1) {
         return;
     }
     $m = "[Check] ";
     $ik = $this->isKorean();
     if (!isset($this->touch[$n = $p->getName()])) {
         $this->touch[$n] = 0;
     }
     $c = microtime(true) - $this->touch[$n];
     if ($c > 0) {
         $m .= $ik ? "수표를 사용하시려면 다시한번눌러주세요. \n 수표 정보 : " . $money . "\$" : "If you want to use this check, One more touch block \n Check Info : " . $money . "\$";
     } else {
         $i->setCount($i->getCount() - 1);
         $p->getInventory()->setItem($p->getInventory()->getHeldItemSlot(), $i);
         $this->giveMoney($p, $money);
         $m .= $ik ? "수표를 사용하셨습니다.\n 수표 정보 : " . $money . "\$" : "You use the check. \n Check Info : " . $money . "\$";
     }
     $this->touch[$n] = microtime(true) + 1;
     if (isset($m)) {
         $p->sendMessage($m);
     }
     $event->setCancelled();
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:27,代码来源:Check.php


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