mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Merge remote-tracking branch 'origin/master' into mcpe-1.2.5
This commit is contained in:
commit
883898682f
@ -116,7 +116,7 @@ abstract class Achievement{
|
||||
public static function broadcast(Player $player, string $achievementId) : bool{
|
||||
if(isset(Achievement::$list[$achievementId])){
|
||||
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"] . TextFormat::RESET]);
|
||||
if(Server::getInstance()->getConfigBoolean("announce-player-achievements", true) === true){
|
||||
if(Server::getInstance()->getConfigBool("announce-player-achievements", true) === true){
|
||||
Server::getInstance()->broadcastMessage($translation);
|
||||
}else{
|
||||
$player->sendMessage($translation);
|
||||
|
@ -2404,7 +2404,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
$cancelled = false;
|
||||
if($target instanceof Player and $this->server->getConfigBoolean("pvp", true) === false){
|
||||
if($target instanceof Player and $this->server->getConfigBool("pvp", true) === false){
|
||||
$cancelled = true;
|
||||
}
|
||||
|
||||
@ -2419,7 +2419,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}elseif($target instanceof Player){
|
||||
if(($target->getGamemode() & 0x01) > 0){
|
||||
return true;
|
||||
}elseif($this->server->getConfigBoolean("pvp") !== true){
|
||||
}elseif($this->server->getConfigBool("pvp") !== true){
|
||||
$cancelled = true;
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function getGenerateStructures() : bool{
|
||||
return $this->getConfigBoolean("generate-structures", true);
|
||||
return $this->getConfigBool("generate-structures", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,7 +442,7 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function getForceGamemode() : bool{
|
||||
return $this->getConfigBoolean("force-gamemode", false);
|
||||
return $this->getConfigBool("force-gamemode", false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -537,7 +537,7 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function hasWhitelist() : bool{
|
||||
return $this->getConfigBoolean("white-list", false);
|
||||
return $this->getConfigBool("white-list", false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -551,14 +551,14 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function getAllowFlight() : bool{
|
||||
return $this->getConfigBoolean("allow-flight", false);
|
||||
return $this->getConfigBool("allow-flight", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isHardcore() : bool{
|
||||
return $this->getConfigBoolean("hardcore", false);
|
||||
return $this->getConfigBool("hardcore", false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -757,9 +757,11 @@ class Server{
|
||||
}
|
||||
}
|
||||
$spawn = $this->getDefaultLevel()->getSafeSpawn();
|
||||
$currentTimeMillis = (int) (microtime(true) * 1000);
|
||||
|
||||
$nbt = new CompoundTag("", [
|
||||
new LongTag("firstPlayed", (int) (microtime(true) * 1000)),
|
||||
new LongTag("lastPlayed", (int) (microtime(true) * 1000)),
|
||||
new LongTag("firstPlayed", $currentTimeMillis),
|
||||
new LongTag("lastPlayed", $currentTimeMillis),
|
||||
new ListTag("Pos", [
|
||||
new DoubleTag("", $spawn->x),
|
||||
new DoubleTag("", $spawn->y),
|
||||
@ -1082,7 +1084,7 @@ class Server{
|
||||
|
||||
$level->setTickRate($this->baseTickRate);
|
||||
}catch(\Throwable $e){
|
||||
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.generateError", [$name, $e->getMessage()]));
|
||||
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.generationError", [$name, $e->getMessage()]));
|
||||
$this->logger->logException($e);
|
||||
return false;
|
||||
}
|
||||
@ -1234,7 +1236,7 @@ class Server{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getConfigBoolean(string $variable, bool $defaultValue = false) : bool{
|
||||
public function getConfigBool(string $variable, bool $defaultValue = false) : bool{
|
||||
$v = getopt("", ["$variable::"]);
|
||||
if(isset($v[$variable])){
|
||||
$value = $v[$variable];
|
||||
@ -1256,6 +1258,18 @@ class Server{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @param string $variable
|
||||
* @param bool $defaultValue
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getConfigBoolean(string $variable, bool $defaultValue = false) : bool{
|
||||
return $this->getConfigBool($variable, $defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $variable
|
||||
* @param bool $value
|
||||
@ -1379,7 +1393,7 @@ class Server{
|
||||
if(is_array($value)){
|
||||
$commands = $value;
|
||||
}else{
|
||||
$commands[] = $value;
|
||||
$commands[] = (string) $value;
|
||||
}
|
||||
|
||||
$result[$key] = $commands;
|
||||
@ -1528,7 +1542,7 @@ class Server{
|
||||
|
||||
$this->scheduler = new ServerScheduler();
|
||||
|
||||
if($this->getConfigBoolean("enable-rcon", false) === true){
|
||||
if($this->getConfigBool("enable-rcon", false) === true){
|
||||
try{
|
||||
$this->rcon = new RCON(
|
||||
$this,
|
||||
@ -1560,9 +1574,9 @@ class Server{
|
||||
$this->banByIP->load();
|
||||
|
||||
$this->maxPlayers = $this->getConfigInt("max-players", 20);
|
||||
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
|
||||
$this->setAutoSave($this->getConfigBool("auto-save", true));
|
||||
|
||||
$this->onlineMode = $this->getConfigBoolean("xbox-auth", true);
|
||||
$this->onlineMode = $this->getConfigBool("xbox-auth", true);
|
||||
if($this->onlineMode){
|
||||
$this->logger->notice($this->getLanguage()->translateString("pocketmine.server.auth", ["enabled", "will"]));
|
||||
$this->logger->notice($this->getLanguage()->translateString("pocketmine.server.authProperty", ["disable", "false"]));
|
||||
@ -1572,7 +1586,7 @@ class Server{
|
||||
$this->logger->warning($this->getLanguage()->translateString("pocketmine.server.authProperty", ["enable", "true"]));
|
||||
}
|
||||
|
||||
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){
|
||||
if($this->getConfigBool("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){
|
||||
$this->setConfigInt("difficulty", Level::DIFFICULTY_HARD);
|
||||
}
|
||||
|
||||
@ -1653,6 +1667,9 @@ class Server{
|
||||
Generator::addGenerator(Nether::class, "nether");
|
||||
|
||||
foreach((array) $this->getProperty("worlds", []) as $name => $options){
|
||||
if(!is_array($options)){
|
||||
continue;
|
||||
}
|
||||
if($this->loadLevel($name) === false){
|
||||
$seed = $options["seed"] ?? time();
|
||||
if(is_string($seed) and !is_numeric($seed)){
|
||||
@ -1989,7 +2006,7 @@ class Server{
|
||||
$this->properties->reload();
|
||||
$this->maxPlayers = $this->getConfigInt("max-players", 20);
|
||||
|
||||
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){
|
||||
if($this->getConfigBool("hardcore", false) === true and $this->getDifficulty() < Level::DIFFICULTY_HARD){
|
||||
$this->setConfigInt("difficulty", Level::DIFFICULTY_HARD);
|
||||
}
|
||||
|
||||
@ -2097,7 +2114,7 @@ class Server{
|
||||
* Starts the PocketMine-MP server and starts processing ticks and packets
|
||||
*/
|
||||
public function start(){
|
||||
if($this->getConfigBoolean("enable-query", true) === true){
|
||||
if($this->getConfigBool("enable-query", true) === true){
|
||||
$this->queryHandler = new QueryHandler();
|
||||
}
|
||||
|
||||
|
@ -273,8 +273,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
* @return bool
|
||||
*/
|
||||
public static function registerEntity(string $className, bool $force = false, array $saveNames = []) : bool{
|
||||
assert(is_a($className, Entity::class, true));
|
||||
|
||||
/** @var Entity $className */
|
||||
|
||||
$class = new \ReflectionClass($className);
|
||||
|
@ -1583,7 +1583,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param Player $player
|
||||
* @param Vector3 $vector
|
||||
*
|
||||
* @return bool false if spawn protection cancelled the action, true if not.
|
||||
* @return bool true if spawn protection cancelled the action, false if not.
|
||||
*/
|
||||
protected function checkSpawnProtection(Player $player, Vector3 $vector) : bool{
|
||||
if(!$player->hasPermission("pocketmine.spawnprotect.bypass") and ($distance = $this->server->getSpawnRadius()) > -1){
|
||||
|
@ -519,10 +519,11 @@ abstract class DataPacket extends BinaryStream{
|
||||
*/
|
||||
protected function getEntityLink() : EntityLink{
|
||||
$link = new EntityLink();
|
||||
|
||||
$link->fromEntityUniqueId = $this->getEntityUniqueId();
|
||||
$link->toEntityUniqueId = $this->getEntityUniqueId();
|
||||
$link->type = $this->getByte();
|
||||
$link->byte2 = $this->getByte();
|
||||
$link->bool1 = $this->getBool();
|
||||
|
||||
return $link;
|
||||
}
|
||||
@ -534,7 +535,6 @@ abstract class DataPacket extends BinaryStream{
|
||||
$this->putEntityUniqueId($link->fromEntityUniqueId);
|
||||
$this->putEntityUniqueId($link->toEntityUniqueId);
|
||||
$this->putByte($link->type);
|
||||
$this->putByte($link->byte2);
|
||||
|
||||
$this->putBool($link->bool1);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,13 @@ class EntityLink{
|
||||
public $toEntityUniqueId;
|
||||
/** @var int */
|
||||
public $type;
|
||||
/** @var int */
|
||||
public $byte2;
|
||||
/** @var bool */
|
||||
public $bool1;
|
||||
|
||||
public function __construct(int $fromEntityUniqueId = null, int $toEntityUniqueId = null, int $type = null, bool $bool1 = null){
|
||||
$this->fromEntityUniqueId = $fromEntityUniqueId;
|
||||
$this->toEntityUniqueId = $toEntityUniqueId;
|
||||
$this->type = $type;
|
||||
$this->bool1 = $bool1;
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 77528812280616f43f460f7f4d40a284c20bcf9e
|
||||
Subproject commit 9142e7decec23b302ab470a55e5ed160df4878db
|
@ -1 +1 @@
|
||||
Subproject commit 857e8afab4a7a34c7235ce06e43796bf64581e3d
|
||||
Subproject commit 4e28d74c9aafdf51b10bc274ddcf78fcb3b317d4
|
Loading…
x
Reference in New Issue
Block a user