Removed not valid TimeCommand

This commit is contained in:
Shoghi Cervantes 2014-05-23 22:46:08 +02:00
parent 683ab8d2cd
commit a2b3a4bb90
5 changed files with 9 additions and 77 deletions

View File

@ -102,7 +102,6 @@ class SimpleCommandMap implements CommandMap{
$this->register("pocketmine", new SetWorldSpawnCommand("setworldspawn"));
$this->register("pocketmine", new TeleportCommand("tp"));
$this->register("pocketmine", new ReloadCommand("reload"));
$this->register("pocketmine", new TimeCommand("time"));
if($this->server->getConfigBoolean("debug.commands", false) === true){
$this->register("pocketmine", new StatusCommand("status"));

View File

@ -70,7 +70,9 @@ class GiveCommand extends VanillaCommand{
return true;
}
$player->addItem(clone $item);
//TODO: overflow
$player->getInventory()->addItem(clone $item);
}else{
$sender->sendMessage(TextFormat::RED . "Can't find player " . $args[0]);

View File

@ -31,9 +31,9 @@ class StatusCommand extends VanillaCommand{
parent::__construct(
$name,
"Reads back the server's performance.",
"/list"
"/status"
);
$this->setPermission("pocketmine.command.list");
$this->setPermission("pocketmine.command.status");
}
public function execute(CommandSender $sender, $currentAlias, array $args){

View File

@ -1,69 +0,0 @@
<?php
namespace pocketmine\command\defaults;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\Server;
use pocketmine\utils\TextFormat;
class TimeCommand extends VanillaCommand{
public function __construct($name){
parent::__construct(
$name,
"Changes the time on each world",
"/time set <value>\n/time add <value>"
);
$this->setPermission("pocketmine.command.time.add;pocketmine.command.set;");
}
public function execute(CommandSender $sender, $label, array $args){
if(count($args) < 2){
$sender->sendMessage(TextFormat::RED . "Incorrect usage. Correct usage:\n" . $this->getUsage());
return false;
}
switch(strtolower($args[0])){
case "set":
if(!$sender->hasPermission("pocketmine.command.time.add")){
$sender->sendMessage(TextFormat::RED . "You don't have permission to set the time");
return true;
}
if($args[1] === "day"){
$value = 0;
}elseif($args[1] === "night"){
$value = 12500;
}else{
$value = $this->getInteger($sender, $args[1], 0);
}
foreach(Server::getInstance()->getLevels() as $level){
$level->setTime($value);
}
Command::broadcastCommandMessage($sender, "Set time to " . $value);
return true;
case "add":
if(!$sender->hasPermission("pocketmine.command.time.add")){
$sender->sendMessage(TextFormat::RED . "You don't have permission to set the time");
return true;
}
$value = $this->getInteger($sender, $args[1], 0);
foreach(Server::getInstance()->getLevels() as $level){
$level->setTime($level->getTime() + $value);
}
Command::broadcastCommandMessage($sender, "Added " . $value . " to time");
return true;
default:
$sender->sendMessage("Unknown method. Usage: " . $this->getUsage());
}
}
}

View File

@ -19,12 +19,12 @@ if exist PocketMine-MP.phar (
)
)
if exist bin\php\php_wxwidgets.dll (
%PHP_BINARY% %POCKETMINE_FILE% --enable-gui %*
) else (
#if exist bin\php\php_wxwidgets.dll (
# %PHP_BINARY% %POCKETMINE_FILE% --enable-gui %*
#) else (
if exist bin\mintty.exe (
start "" bin\mintty.exe -o Columns=88 -o Rows=32 -o AllowBlinking=0 -o FontQuality=3 -o Font="DejaVu Sans Mono" -o FontHeight=10 -o CursorType=0 -o CursorBlinks=1 -h error -t "PocketMine-MP" -i bin/pocketmine.ico -w max %PHP_BINARY% %POCKETMINE_FILE% --enable-ansi %*
) else (
%PHP_BINARY% %POCKETMINE_FILE% %*
)
)
#)