Skip to content

Commit

Permalink
Merge pull request #16 from PocketDock/mcpe-0.11.0
Browse files Browse the repository at this point in the history
More fixes for PM 1.5 - Not backwards compatible
  • Loading branch information
Humerus committed Jun 13, 2015
2 parents 0d4de3b + 1aee8ae commit 5981b09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PocketDockConsole
prefix: PDC
main: PocketDockConsole\Main
version: 0.0.12
version: 0.0.13
api: [1.12.0]

load: POSTWORLD
Expand Down
11 changes: 9 additions & 2 deletions src/PocketDockConsole/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use pocketmine\utils\TextFormat;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\scheduler\PluginTask;
use pocketmine\utils\Utils;
use pocketmine\Player;

class RunCommand extends PluginTask {

Expand Down Expand Up @@ -71,6 +73,8 @@ public function parseJSON($string) {
if (($player = $this->getOwner()->getServer()->getPlayerExact($data[$keys[0]]['name'])) instanceof Player) {
$player->kick();
$this->getOwner()->getLogger()->info($data[$keys[0]]['name'] . " has been kicked!");
} else {
$this->getOwner()->getLogger()->info($data[$keys[0]]['name'] . " is not a valid player!");
}
break;
case "ban":
Expand Down Expand Up @@ -103,6 +107,8 @@ public function parseJSON($string) {
case "changegm":
if (($player = $this->getOwner()->getServer()->getPlayerExact($data[$keys[0]]['name'])) instanceof Player) {
$player->setGamemode($data[$keys[0]]['mode']);
} else {
$this->getOwner()->getLogger()->info($data[$keys[0]]['name'] . " is not a valid player!");
}
break;
case "getCode":
Expand Down Expand Up @@ -168,8 +174,9 @@ public function parseJSON($string) {
public function updateInfo($user = "") {
$data = array("type" => "data", "data" => array("players" => $this->sendPlayers($user), "bans" => $this->sendNameBans(), "ipbans" => $this->sendIPBans(), "ops" => $this->sendOps(), "plugins" => $this->sendPlugins()));
$this->getOwner()->thread->jsonStream.= json_encode($data) . "\n";
$u = $this->getOwner()->getServer()->getMemoryUsage(true);
$usage = round(($u[0] / 1024) / 1024, 2) . "/" . round(($u[1] / 1024) / 1024, 2) . " MB @ " . $this->getOwner()->getServer()->getThreadCount() . " threads";
$u = Utils::getMemoryUsage(true);
$d = Utils::getRealMemoryUsage();
$usage = round(($u[0] / 1024) / 1024, 2) . "/" . round(($d[0] / 1024) / 1024, 2) . "/" . round(($u[1] / 1024) / 1024, 2) . "/".round(($u[2] / 1024) / 1024, 2)." MB @ " . Utils::getThreadCount() . " threads";
$title = "\x1b]0;" . $this->getOwner()->getServer()->getName() . " " . $this->getOwner()->getServer()->getPocketMineVersion() . " | Online " . count($this->getOwner()->getServer()->getOnlinePlayers()) . "/" . $this->getOwner()->getServer()->getMaxPlayers() . " | Memory " . $usage . " | U " . round($this->getOwner()->getServer()->getNetwork()->getUpload() / 1024, 2) . " D " . round($this->getOwner()->getServer()->getNetwork()->getDownload() / 1024, 2) . " kB/s | TPS " . $this->getOwner()->getServer()->getTicksPerSecond() . " | Load " . $this->getOwner()->getServer()->getTickUsage() . "%\x07";
$this->getOwner()->thread->stuffTitle = $title;
return true;
Expand Down

0 comments on commit 5981b09

Please sign in to comment.