mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Added force-gamemode property
This commit is contained in:
parent
0e679139d2
commit
ecbfff9b0f
@ -58,6 +58,7 @@ use pocketmine\metadata\MetadataValue;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\Byte;
|
||||
use pocketmine\nbt\tag\Compound;
|
||||
use pocketmine\nbt\tag\Int;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\network\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\protocol\AnimatePacket;
|
||||
@ -1142,6 +1143,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$nbt["NameTag"] = $this->username;
|
||||
}
|
||||
$this->gamemode = $nbt["playerGameType"] & 0x03;
|
||||
if($this->server->getForceGamemode()){
|
||||
$this->gamemode = $this->server->getGamemode();
|
||||
$nbt->playerGameType = new Int("playerGameType", $this->gamemode);
|
||||
}
|
||||
if(($level = $this->server->getLevelByName($nbt["Level"])) === null){
|
||||
$this->setLevel($this->server->getDefaultLevel(), true);
|
||||
$nbt["Level"] = $this->getLevel()->getName();
|
||||
|
@ -307,6 +307,13 @@ class Server{
|
||||
return $this->getConfigInt("gamemode", 0) & 0b11;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getForceGamemode(){
|
||||
return $this->getConfigBoolean("force-gamemode", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gamemode text name
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user