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


PHP Player::sendTip方法代码示例

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


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

示例1: process

 public function process(Player $p)
 {
     $msg = "서버 상태 : ";
     switch ($this->o->status) {
         case 0:
             $msg .= "게임 중이 아님";
             break;
         case 1:
             $msg .= "능력 추첨/선택 중\n";
             break;
         case 2:
             $msg .= TextFormat::AQUA . "게임 중\n" . TextFormat::RESET;
     }
     if ($this->o->status === 1) {
         $msg .= TextFormat::GREEN . "남은 시간 : " . TextFormat::GOLD . ($this->o->timer - CrashBang::GAME_TIME) . TextFormat::GREEN . "초";
     } elseif ($this->o->status === 2) {
         if ($this->o->timer < 60) {
             $msg .= TextFormat::GREEN . "남은 시간 : " . TextFormat::RED . $this->o->timer . "/" . CrashBang::GAME_TIME . TextFormat::GREEN . "초";
         } else {
             $msg .= TextFormat::GREEN . "남은 시간 : " . TextFormat::GOLD . $this->o->timer . "/" . CrashBang::GAME_TIME . TextFormat::GREEN . "초";
         }
     }
     if ($this->tick === 0 && $this->o->status === 2) {
         $this->o->cooldown[$p->getName()]--;
     }
     if ($this->o->status === 2) {
         if (Skills::$passive[$this->o->skill[$p->getName()]]) {
             $msg .= "\n스킬 상태 : " . TextFormat::GREEN . "패시브(항상 적용)";
         } else {
             if ($this->o->cooldown[$p->getName()] > 0) {
                 $msg .= "\n스킬 상태 : " . TextFormat::RED . "사용 불가(쿨타임 " . TextFormat::RESET . $this->o->cooldown[$p->getName()] . TextFormat::RED . "초)";
             } else {
                 $msg .= "\n스킬 상태 : " . TextFormat::GREEN . "사용 가능";
             }
         }
     }
     $p->sendTip($msg);
 }
开发者ID:cr0sh,项目名称:CrashBang,代码行数:38,代码来源:Timer.php

示例2: onPlayerTrade

 public function onPlayerTrade(Player $giver, Player $taker)
 {
     $good = clone $giver->getInventory()->getItemInHand();
     $gift = clone $good;
     $gift->setCount(1);
     $taker->getInventory()->addItem($gift);
     $good->setCount($n = $good->getCount() - 1);
     $slot = $giver->getInventory()->getHeldItemSlot();
     if ($n <= 0) {
         $giver->getInventory()->clear($slot);
     } else {
         $giver->getInventory()->setItem($slot, $good);
     }
     $item = MPMU::itemName($good);
     if (MPMU::apiVersion("1.12.0")) {
         $giver->sendTip(mc::_("Gave one %1%", $item));
         $taker->sendTip(mc::_("Received %1%", $item));
     } else {
         $giver->sendMessage(mc::_("Gave one %1%", $item));
         $taker->sendMessage(mc::_("Received %1%", $item));
     }
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:22,代码来源:TradingMgr.php

示例3: killHandler

 public function killHandler(Player $entity)
 {
     // $this->getServer()->broadcastMessage("killHandler tries to handle");
     // player add deaths
     // $nr = $this->games[strtolower($entity->getLevel()->getName())]["players"][$entity->getName()]["deaths"] + 1;
     // $this->games[strtolower($entity->getLevel()->getName())]["players"][$entity->getName()]["deaths"] = $nr;
     // save to config.. WHY EVEN?! can't i do ranks just only by times played and wins?
     $this->getPlayerConfig();
     $this->players->getAll()[$entity->getName()]["deaths"]++;
     $this->setPlayerConfig();
     $entity->sendTip(TextFormat::RED . "You fell into void");
     $entity->setGamemode(3);
     $entity->teleport($entity->getLevel()->getSpawnLocation());
     $this->leaveLobby($entity, $entity->getLevel());
     // if killer add kills
     /*
      * if($killer !== null){
      * $players = array();
      * foreach(array_keys($this->games[strtolower($killer->getLevel()->getName())]["players"]) as $player){
      * array_push($players, $this->getServer()->getPlayer($player));
      * }
      * $this->getServer()->broadcastMessage(TextFormat::RED . $killer->getDisplayName() . " killed " . $entity->getDisplayName(), $players);
      * $this->games[strtolower($killer->getLevel()->getName())]["players"][$killer->getName()]["kills"]++;
      * // add arrow
      * $killer->getInventory()->addItem(Item::fromString("Arrow"));
      * // save to config.. WHY EVEN?! can't i do ranks just only by times played and wins?
      * $this->getPlayerConfig();
      * $this->players->getAll()[$killer->getName()]["kills"]++;
      * $this->setPlayerConfig();
      * $killer->sendTip(TextFormat::GOLD . "Kills: " . TextFormat::GREEN . $this->games[strtolower($killer->getLevel()->getName())]["players"][$killer->getName()]["kills"] . TextFormat::LIGHT_PURPLE . " | " . TextFormat::GOLD . "Deaths: " . TextFormat::RED . $this->games[strtolower($killer->getLevel()->getName())]["players"][$killer->getName()]["deaths"]);
      */
     if (isset($this->games[strtolower($entity->getLevel()->getName())])) {
         if (count(array_keys($this->games[strtolower($entity->getLevel()->getName())]["players"])) <= 1) {
             $this->stopGame($entity->getLevel(), $this->getServer()->getPlayer(array_keys($this->games[strtolower($entity->getLevel()->getName())]["players"])[0]));
             return;
         }
         // }
         // else{
         $this->getServer()->broadcastTip(TextFormat::RED . $entity->getName() . " fell into void\n" . TextFormat::GREEN . count(array_keys($this->games[strtolower($entity->getLevel()->getName())]["players"])) . " players remaining");
     }
     // }
     // end if died too often
     /*
      * if($nr >= $this->getConfig()->getNested("lobby-defaults.maxdeaths")){
      * $entity->setGamemode(3);
      * $entity->sendMessage(TextFormat::RED . "You died too many times.");
      * // leave or better let the player spectate? if spectate then the player has to do /spleef leave.. but the game will run until the player will do this
      * }
      * else{
      * $this->respawnPlayer($entity, strtolower($entity->getLevel()->getName()));
      * }
      */
     $this->leaveLobby($entity, $entity->getLevel());
 }
开发者ID:Edwardthedog2,项目名称:SpleefPE,代码行数:54,代码来源:Main.php


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