Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite

This commit is contained in:
Shoghi Cervantes 2014-04-03 13:12:30 +02:00
commit b50d58e46f
3 changed files with 52 additions and 1 deletions

View File

@ -1435,7 +1435,7 @@ class Server{
//register_shutdown_function(array($this, "dumpError"));
register_shutdown_function(array($this, "shutdown"));
if(function_exists("pcntl_signal")){
//pcntl_signal(SIGTERM, array($this, "shutdown"));
pcntl_signal(SIGTERM, array($this, "shutdown"));
pcntl_signal(SIGINT, array($this, "shutdown"));
pcntl_signal(SIGHUP, array($this, "shutdown"));
}

View File

@ -96,6 +96,7 @@ class SimpleCommandMap implements CommandMap{
$this->register("pocketmine", new KillCommand("kill"));
$this->register("pocketmine", new SpawnpointCommand("spawnpoint"));
$this->register("pocketmine", new TeleportCommand("tp"));
$this->register("pocketmine", new StatusCommand("status"));
}

View File

@ -0,0 +1,50 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\command\defaults;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\Server;
class StatusCommand extends VanillaCommand{
public function __construct($name){
parent::__construct(
$name,
"Reads back the server's performance.",
"/list"
);
$this->setPermission("pocketmine.command.list");
}
public function execute(CommandSender $sender, $currentAlias, array $args){
if(!$this->testPermission($sender)){
return true;
}
$server = Server::getInstance();
$sender->sendMessage("TPS: ".$server->getTicksPerSecond()." Uploading: " . round($server->getNetwork()->getUploadSpeed() / 1024, 2) . " Downloading: " . round($server->getNetwork()->getDownloadSpeed() / 1024, 2) . " kB/s");
return true;
}
}