Exemplo n.º 1
0
 public function translateAndFormat($key, ...$args)
 {
     $message = $this->messages->getNested($key, false);
     if (!$message) {
         $this->tntRun->getServer()->getLogger()->warning("TntRun translation for " . $key . " not found in messages.yml");
         return "";
     }
     foreach ($args as $k => $str) {
         $message = str_replace("%" . $k, $str, $message);
     }
     return $this->translateColors($this->tag . $message);
 }
Exemplo n.º 2
0
 public function getMessage($key, $args = [])
 {
     $message = $this->messages->getNested($key, false);
     if (!$message) {
         $this->tntRun->getServer()->getLogger()->warning($this->tntRun->getTag() . "Translation for " . $key . " not found in messages.yml!");
         return "";
     }
     foreach ($args as $k => $str) {
         $message = str_replace("%" . $k, $str, $message);
     }
     return $this->tntRun->getTag() . trim($this->translateColors($message));
 }
Exemplo n.º 3
0
 public function __construct(Main $tntRun)
 {
     $this->tntRun = $tntRun;
     $settings = $this->tntRun->getConfig()->get("mysql-settings");
     $this->db = new \mysqli($settings["host"], $settings["username"], $settings["password"], $settings["database"], isset($settings["port"]) ? $settings["port"] : 3306);
     if ($this->db->connect_error) {
         $tntRun->getLogger()->critical("Couldn't connect to MySQL: " . $this->db->connect_error);
         $tntRun->getServer()->shutdown();
         return;
     }
     $this->db->query("CREATE TABLE IF NOT EXISTS tntstats (name VARCHAR(16) PRIMARY KEY, matches INT, wins INT)");
     $tntRun->getServer()->getScheduler()->scheduleRepeatingTask(new TaskPingMySQL($tntRun), 600);
 }
Exemplo n.º 4
0
 public function startArenaRegen()
 {
     $this->arena->getStatusManager()->setRegenerating();
     $level = $this->tntRun->getServer()->getLevelByName($this->arena->getStructureManager()->getLevelName());
     foreach ($this->arena->getStructureManager()->getFloors() as $floorY) {
         $this->tntRun->getServer()->getScheduler()->scheduleDelayedTask(new AddfloorTask($this->tntRun, $this->arena->getStructureManager()->getPos1(), $this->arena->getStructureManager()->getPos2(), $floorY, $level), 10);
     }
     $this->arena->getStatusManager()->setRegenerating(false);
 }
Exemplo n.º 5
0
 public function getSpawn()
 {
     return new Position($this->spawn["x"], $this->spawn["y"], $this->spawn["z"], $this->tntRun->getServer()->getLevelByName($this->levelName));
 }
Exemplo n.º 6
0
 public function __construct(Main $tntRun)
 {
     if ($tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney") instanceof Plugin) {
         $version = explode(".", $tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney")->getDescription()->getVersion());
         if ($version[0] < 4) {
             $tntRun->getLogger()->critical("The version of PocketMoney is too old! Please update PocketMoney to version 4.0.1");
             $tntRun->getServer()->shutdown();
         }
         $this->PocketMoney = $tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney");
     } elseif ($tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI") instanceof Plugin) {
         $version = explode(".", $tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI")->getDescription()->getVersion());
         if ($version[0] < 2) {
             $tntRun->getLogger()->critical("The version of EconomyAPI is too old! Please update EconomyAPI to version 2.0.8");
             $tntRun->getServer()->shutdown();
         }
         $this->EconomyS = $tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI");
     } elseif ($tntRun->getServer()->getPluginManager()->getPlugin("MassiveEconomy") instanceof Plugin) {
         $this->MassiveEconomy = $tntRun->getServer()->getPluginManager()->getPlugin("MassiveEconomy");
     } else {
         $tntRun->getLogger()->critical("This plugin to work needs the plugin PocketMoney or EconomyS or MassiveEconomy.");
         $tntRun->getServer()->shutdown();
     }
 }
Exemplo n.º 7
0
 private function posFromString($pos)
 {
     $e = explode(":", $pos);
     return new Position($e[0], $e[1], $e[2], $this->tntRun->getServer()->getLevelByName(str_replace("%", " ", $e[3])));
 }