mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite
This commit is contained in:
commit
b50d58e46f
@ -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"));
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
|
||||
|
50
src/pocketmine/command/defaults/StatusCommand.php
Normal file
50
src/pocketmine/command/defaults/StatusCommand.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user