Removed hardcoded Server name from source

This commit is contained in:
Shoghi Cervantes 2014-08-22 18:31:17 +02:00
parent 6077190a62
commit 60ea4d0e96
6 changed files with 13 additions and 13 deletions

View File

@ -43,7 +43,7 @@ class CrashDump{
$this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log"; $this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = fopen($this->path, "wb"); $this->fp = fopen($this->path, "wb");
$this->data["time"] = $this->time; $this->data["time"] = $this->time;
$this->addLine("PocketMine-MP Crash Dump " . date("D M j H:i:s T Y", $this->time)); $this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine(); $this->addLine();
$this->baseCrash(); $this->baseCrash();
$this->generalData(); $this->generalData();

View File

@ -1467,7 +1467,7 @@ class Server{
$value = array("M" => 1, "G" => 1024); $value = array("M" => 1, "G" => 1024);
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
if($real < 128){ if($real < 128){
$this->logger->warning("PocketMine-MP may not work right with less than 128MB of RAM", true, true, 0); $this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0);
} }
@ini_set("memory_limit", $memory); @ini_set("memory_limit", $memory);
}else{ }else{
@ -1490,7 +1490,7 @@ class Server{
Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 7); Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 7);
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and function_exists("cli_set_process_title")){ if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and function_exists("cli_set_process_title")){
@cli_set_process_title("PocketMine-MP " . $this->getPocketMineVersion()); @cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
} }
$this->logger->info("Starting Minecraft PE server on " . ($this->getIp() === "" ? "*" : $this->getIp()) . ":" . $this->getPort()); $this->logger->info("Starting Minecraft PE server on " . ($this->getIp() === "" ? "*" : $this->getIp()) . ":" . $this->getPort());
@ -1499,8 +1499,8 @@ class Server{
$this->addInterface($this->mainInterface = new RakLibInterface($this)); $this->addInterface($this->mainInterface = new RakLibInterface($this));
$this->logger->info("This server is running PocketMine-MP version " . ($version->isDev() ? TextFormat::YELLOW : "") . $version->get(false) . TextFormat::RESET . " \"" . $this->getCodename() . "\" (API " . $this->getApiVersion() . ")", true, true, 0); $this->logger->info("This server is running " . $this->getName() . " version " . ($version->isDev() ? TextFormat::YELLOW : "") . $version->get(false) . TextFormat::RESET . " \"" . $this->getCodename() . "\" (API " . $this->getApiVersion() . ")", true, true, 0);
$this->logger->info("PocketMine-MP is distributed under the LGPL License", true, true, 0); $this->logger->info($this->getName() . " is distributed under the LGPL License", true, true, 0);
$this->consoleSender = new ConsoleCommandSender(); $this->consoleSender = new ConsoleCommandSender();
$this->commandMap = new SimpleCommandMap($this); $this->commandMap = new SimpleCommandMap($this);
@ -1728,7 +1728,7 @@ class Server{
$value = array("M" => 1, "G" => 1024); $value = array("M" => 1, "G" => 1024);
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
if($real < 256){ if($real < 256){
$this->logger->warning("PocketMine-MP may not work right with less than 256MB of RAM", true, true, 0); $this->logger->warning($this->getName() . " may not work right with less than 256MB of RAM", true, true, 0);
} }
@ini_set("memory_limit", $memory); @ini_set("memory_limit", $memory);
}else{ }else{
@ -1893,7 +1893,7 @@ class Server{
$reply = Utils::postURL("http://" . $this->getProperty("auto-report.host", "crash.pocketmine.net") . "/submit/api", [ $reply = Utils::postURL("http://" . $this->getProperty("auto-report.host", "crash.pocketmine.net") . "/submit/api", [
"report" => "yes", "report" => "yes",
"name" => "PocketMine-MP " . $this->getPocketMineVersion(), "name" => $this->getName() . " " . $this->getPocketMineVersion(),
"email" => "crash@pocketmine.net", "email" => "crash@pocketmine.net",
"reportPaste" => base64_encode($dump->getEncodedData()) "reportPaste" => base64_encode($dump->getEncodedData())
]); ]);
@ -2029,7 +2029,7 @@ class Server{
private function titleTick(){ private function titleTick(){
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and \pocketmine\ANSI === true){ if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and \pocketmine\ANSI === true){
echo "\x1b]0;PocketMine-MP " . $this->getPocketMineVersion() . " | Online " . count($this->players) . "/" . $this->getMaxPlayers() . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "/" . round((memory_get_usage(true) / 1024) / 1024, 2) . " MB | U " . round($this->mainInterface->getUploadUsage() / 1024, 2) . " D " . round($this->mainInterface->getDownloadUsage() / 1024, 2) . " kB/s | TPS " . $this->getTicksPerSecond() . "\x07"; echo "\x1b]0;". $this->getName() . " " . $this->getPocketMineVersion() . " | Online " . count($this->players) . "/" . $this->getMaxPlayers() . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "/" . round((memory_get_usage(true) / 1024) / 1024, 2) . " MB | U " . round($this->mainInterface->getUploadUsage() / 1024, 2) . " D " . round($this->mainInterface->getDownloadUsage() / 1024, 2) . " kB/s | TPS " . $this->getTicksPerSecond() . "\x07";
} }
} }

View File

@ -94,7 +94,7 @@ class TimingsCommand extends VanillaCommand{
fseek($fileTimings, 0); fseek($fileTimings, 0);
$data = [ $data = [
"public" => false, "public" => false,
"description" => "PocketMine-MP Timings", "description" => $this->getName() . " Timings",
"files" => [ "files" => [
"timings.txt" => [ "timings.txt" => [
"content" => stream_get_contents($fileTimings) "content" => stream_get_contents($fileTimings)
@ -111,7 +111,7 @@ class TimingsCommand extends VanillaCommand{
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_SLASHES));
curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json", "User-Agent: PocketMine-MP " . $sender->getServer()->getPocketMineVersion()]); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json", "User-Agent: " . $this->getName() . " " . $sender->getServer()->getPocketMineVersion()]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ret = curl_exec($ch); $ret = curl_exec($ch);
$data = json_decode($ret); $data = json_decode($ret);

View File

@ -44,7 +44,7 @@ class VersionCommand extends VanillaCommand{
} }
if(count($args) === 0){ if(count($args) === 0){
$output = "This server is running PocketMine-MP version " . $sender->getServer()->getPocketMineVersion() . "" . $sender->getServer()->getCodename() . "」 (Implementing API version " . $sender->getServer()->getApiVersion() . " for Minecraft: PE " . $sender->getServer()->getVersion() . " protocol version " . Info::CURRENT_PROTOCOL . ")"; $output = "This server is running ". $this->getName() . " version " . $sender->getServer()->getPocketMineVersion() . "" . $sender->getServer()->getCodename() . "」 (Implementing API version " . $sender->getServer()->getApiVersion() . " for Minecraft: PE " . $sender->getServer()->getVersion() . " protocol version " . Info::CURRENT_PROTOCOL . ")";
if(\pocketmine\GIT_COMMIT !== str_repeat("00", 20)){ if(\pocketmine\GIT_COMMIT !== str_repeat("00", 20)){
$output .= " [git " . \pocketmine\GIT_COMMIT . "]"; $output .= " [git " . \pocketmine\GIT_COMMIT . "]";
} }

View File

@ -71,7 +71,7 @@ class TimingsHandler{
} }
fwrite($fp, "# Version " . Server::getInstance()->getVersion() . PHP_EOL); fwrite($fp, "# Version " . Server::getInstance()->getVersion() . PHP_EOL);
fwrite($fp, "# PocketMine-MP " . Server::getInstance()->getPocketMineVersion() . PHP_EOL); fwrite($fp, "# ". Server::getInstance()->getName() . " " . Server::getInstance()->getPocketMineVersion() . PHP_EOL);
$entities = 0; $entities = 0;
$livingEntities = 0; $livingEntities = 0;

View File

@ -58,7 +58,7 @@ class QueryHandler{
public function regenerateInfo(){ public function regenerateInfo(){
$str = ""; $str = "";
$plist = "PocketMine-MP " . $this->server->getPocketMineVersion(); $plist = $this->server->getName() . " " . $this->server->getPocketMineVersion();
$pl = $this->server->getPluginManager()->getPlugins(); $pl = $this->server->getPluginManager()->getPlugins();
if(count($pl) > 0 and $this->server->getProperty("settings.query-plugins", true) === true){ if(count($pl) > 0 and $this->server->getProperty("settings.query-plugins", true) === true){
$plist .= ":"; $plist .= ":";