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