sendTip() public method

public sendTip ( $message ) : boolean
$message
return boolean
Beispiel #1
0
 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);
 }
 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));
     }
 }
Beispiel #3
0
 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());
 }