mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 13:09:44 +00:00
Fixed changing gamemodes
This commit is contained in:
parent
8b41246f2d
commit
724e9d9bb2
1 changed files with 9 additions and 3 deletions
|
|
@ -558,16 +558,22 @@ class Player{
|
||||||
|
|
||||||
$inv =& $this->inventory;
|
$inv =& $this->inventory;
|
||||||
if(($this->gamemode & 0x01) === ($gm & 0x01)){
|
if(($this->gamemode & 0x01) === ($gm & 0x01)){
|
||||||
$this->sendSettings();
|
if(($gm & 0x01) === 0x01 and ($gm & 0x02) === 0x02){
|
||||||
if(($this->gamemode & 0x01) === 0x01 and ($this->gamemode & 0x02) === 0x02){
|
|
||||||
$inv = array();
|
$inv = array();
|
||||||
foreach(BlockAPI::$creative as $item){
|
foreach(BlockAPI::$creative as $item){
|
||||||
$inv[] = array(DANDELION, 0, 1);
|
$inv[] = array(DANDELION, 0, 1);
|
||||||
}
|
}
|
||||||
|
}elseif(($gm & 0x01) === 0x01){
|
||||||
|
$inv = array();
|
||||||
|
foreach(BlockAPI::$creative as $item){
|
||||||
|
$inv[] = array($item[0], $item[1], 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$this->gamemode = $gm;
|
||||||
$this->eventHandler("Your gamemode has been changed to ".$this->getGamemode().".", "server.chat");
|
$this->eventHandler("Your gamemode has been changed to ".$this->getGamemode().".", "server.chat");
|
||||||
}else{
|
}else{
|
||||||
$this->blocked = true;
|
$this->blocked = true;
|
||||||
|
$this->gamemode = $gm;
|
||||||
$this->eventHandler("Your gamemode has been changed to ".$this->getGamemode().", you've to do a forced reconnect.", "server.chat");
|
$this->eventHandler("Your gamemode has been changed to ".$this->getGamemode().", you've to do a forced reconnect.", "server.chat");
|
||||||
$this->server->schedule(30, array($this, "close"), "gamemode change"); //Forces a kick
|
$this->server->schedule(30, array($this, "close"), "gamemode change"); //Forces a kick
|
||||||
if(($gm & 0x01) === 0x01){
|
if(($gm & 0x01) === 0x01){
|
||||||
|
|
@ -575,7 +581,7 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->inventory = $inv;
|
$this->inventory = $inv;
|
||||||
$this->gamemode = $gm;
|
$this->sendSettings();
|
||||||
if($this->itemEnforcement === true){
|
if($this->itemEnforcement === true){
|
||||||
$this->sendInventory();
|
$this->sendInventory();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue