Re-enable support for debug information with /status

This commit is contained in:
William Teder 2014-04-02 21:14:22 -05:00
parent 2ab1997f21
commit 48f2927e08
2 changed files with 51 additions and 0 deletions

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;
}
}