Merge branch '3.5' into 3.6

This commit is contained in:
Dylan K. Taylor 2019-02-13 14:53:00 +00:00
commit 10b72c895d
5 changed files with 13 additions and 2 deletions

View File

@ -177,7 +177,6 @@ namespace pocketmine {
ini_set("default_charset", "utf-8");
ini_set("memory_limit", '-1');
define('pocketmine\START_TIME', microtime(true));
define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR);
@ -245,6 +244,8 @@ namespace pocketmine {
}
}
//TODO: move this to a Server field
define('pocketmine\START_TIME', microtime(true));
ThreadManager::init();
new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);

View File

@ -53,6 +53,9 @@ class DeopCommand extends VanillaCommand{
}
$name = array_shift($args);
if(!Player::isValidUserName($name)){
throw new InvalidCommandSyntaxException();
}
$player = $sender->getServer()->getOfflinePlayer($name);
$player->setOp(false);

View File

@ -83,7 +83,7 @@ class EffectCommand extends VanillaCommand{
$amplification = 0;
if(count($args) >= 3){
if(($d = $this->getBoundedInt($sender, $args[2], 0, INT32_MAX)) === null){
if(($d = $this->getBoundedInt($sender, $args[2], 0, (int) (INT32_MAX / 20))) === null){
return false;
}
$duration = $d * 20; //ticks

View File

@ -53,6 +53,9 @@ class OpCommand extends VanillaCommand{
}
$name = array_shift($args);
if(!Player::isValidUserName($name)){
throw new InvalidCommandSyntaxException();
}
$player = $sender->getServer()->getOfflinePlayer($name);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.op.success", [$player->getName()]));

View File

@ -27,6 +27,7 @@ use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\lang\TranslationContainer;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use function count;
use function implode;
@ -94,6 +95,9 @@ class WhitelistCommand extends VanillaCommand{
if($this->badPerm($sender, strtolower($args[0]))){
return false;
}
if(!Player::isValidUserName($args[1])){
throw new InvalidCommandSyntaxException();
}
switch(strtolower($args[0])){
case "add":
$sender->getServer()->getOfflinePlayer($args[1])->setWhitelisted(true);