Example #1
0
 public function setVisible($reason)
 {
     $wasInvisible = $this->isInvisible();
     $this->invisibilityFactors[$reason] = 0;
     if ($wasInvisible and !$this->isInvisible()) {
         foreach ($this->getPlayer()->getLevel()->getPlayers() as $p) {
             if (!isset($this->invisibleTo[$this->sesList->getSession($p)->getUID()])) {
                 $this->getPlayer()->spawnTo($p);
             }
         }
     }
 }
Example #2
0
 public function onDisable()
 {
     foreach ($this->getServer()->getOnlinePlayers() as $player) {
         $this->sessions->onPlayerDisconnect(new PlayerQuitEvent($player, "Server stop"));
     }
     $this->teamMgr->saveTeams();
     $this->mysqli->close();
     $url = $this->pasteTimings();
     $mem = memory_get_usage(true) / 1048576 . "MB";
     $msg = $this->getDescription()->getFullName() . " has been disabled at " . Utils::getIP() . ":{$this->getServer()->getPort()} with peak memory reaching {$mem}. ";
     $msg .= "The process ID is " . getmypid() . ". ";
     $dateTime = (new \DateTime())->setTimestamp($this->timestamp);
     $msg .= "The plugin was built on " . $dateTime->format("jS F, Y \\a\\t H:i:s (T, \\G\\M\\T P). ");
     $msg .= "Timings has been pasted to {$url}.";
     if (!IS_TEST) {
         Utils::getURL(self::IRC_WEBHOOK . urlencode($msg), 2);
     }
     $this->getLogger()->info($msg);
 }