mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Updated gamemode constant names
This commit is contained in:
parent
6c4670421c
commit
45192c4448
@ -162,7 +162,7 @@ class BlockAPI{
|
||||
|
||||
$target = $this->getBlock($vector);
|
||||
$item = $player->equipment;
|
||||
if(!$target->isBreakable($item, $player) or $this->server->gamemode === 2){
|
||||
if(!$target->isBreakable($item, $player) or $this->server->gamemode === ADVENTURE){
|
||||
return $this->cancelAction($target);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ class BlockAPI{
|
||||
}
|
||||
|
||||
public function drop($x, $y, $z, $block, $meta, $stack = 1){
|
||||
if($block === AIR or $stack <= 0 or $this->server->gamemode === 1){
|
||||
if($block === AIR or $stack <= 0 or $this->server->gamemode === CREATIVE){
|
||||
return;
|
||||
}
|
||||
$data = array(
|
||||
@ -230,7 +230,7 @@ class BlockAPI{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if($this->server->gamemode === 2){ //Adventure mode!!
|
||||
if($this->server->gamemode === ADVENTURE){ //Adventure mode!!
|
||||
return $this->cancelAction($block);
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ class BlockAPI{
|
||||
$t->data["creator"] = $player->username;
|
||||
}
|
||||
|
||||
if($this->server->gamemode === 0 or $this->server->gamemode === 2){
|
||||
if($this->server->gamemode === SURVIVAL or $this->server->gamemode === ADVENTURE){
|
||||
$player->removeItem($item->getID(), $item->getMetadata(), 1);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Player{
|
||||
$this->inventory = array_fill(0, 36, array(AIR, 0, 0));
|
||||
$this->armor = array_fill(0, 4, array(AIR, 0, 0));
|
||||
$this->gamemode = $this->server->gamemode;
|
||||
if($this->gamemode === 0 or $this->gamemode === 2){
|
||||
if($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE){
|
||||
$this->equipment = BlockAPI::getItem(AIR);
|
||||
}else{
|
||||
$this->equipment = BlockAPI::getItem(STONE);
|
||||
@ -282,14 +282,14 @@ class Player{
|
||||
}
|
||||
break;
|
||||
case "player.block.place":
|
||||
if($data["eid"] === $this->eid and ($this->gamemode === 0 or $this->gamemode === 2)){
|
||||
if($data["eid"] === $this->eid and ($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE)){
|
||||
$this->removeItem($data["original"]->getID(), $data["original"]->getMetadata(), 1);
|
||||
}
|
||||
break;
|
||||
case "player.pickup":
|
||||
if($data["eid"] === $this->eid){
|
||||
$data["eid"] = 0;
|
||||
if(($this->gamemode === 0 or $this->gamemode === 2)){
|
||||
if(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE)){
|
||||
$this->addItem($data["entity"]->type, $data["entity"]->meta, $data["entity"]->stack);
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@ class Player{
|
||||
}
|
||||
$this->server->api->player->add($this->CID);
|
||||
$this->auth = true;
|
||||
if(!isset($this->data["inventory"]) or $this->gamemode === 1){
|
||||
if(!isset($this->data["inventory"]) or $this->gamemode === CREATIVE){
|
||||
$this->data["inventory"] = $this->inventory;
|
||||
}
|
||||
$this->inventory = &$this->data["inventory"];
|
||||
@ -608,7 +608,7 @@ class Player{
|
||||
0x80 ?
|
||||
*/
|
||||
$flags = 0;
|
||||
if($this->gamemode === 2){
|
||||
if($this->gamemode === ADVENTURE){
|
||||
$flags |= 0x01; //Not allow placing/breaking blocks
|
||||
}
|
||||
$flags |= 0x20; //Nametags
|
||||
@ -652,7 +652,7 @@ class Player{
|
||||
$data["eid"] = $this->eid;
|
||||
if(Utils::distance($this->entity->position, $data) > 10){
|
||||
break;
|
||||
}elseif(($this->gamemode === 0 or $this->gamemode === 2) and !$this->hasItem($data["block"], $data["meta"])){
|
||||
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"])){
|
||||
console("[DEBUG] Player \"".$this->username."\" tried to place not got block (or crafted block)", true, true, 2);
|
||||
//break;
|
||||
}
|
||||
@ -710,7 +710,7 @@ class Player{
|
||||
if($this->loggedIn === false){
|
||||
break;
|
||||
}
|
||||
if($this->gamemode === 1){
|
||||
if($this->gamemode === CREATIVE){
|
||||
break;
|
||||
}
|
||||
//$this->entity->setHealth($data["health"], "client");
|
||||
|
@ -81,7 +81,7 @@ class PocketMinecraftServer{
|
||||
$this->stop = false;
|
||||
}
|
||||
|
||||
function __construct($name, $gamemode = 1, $seed = false, $port = 19132, $serverID = false, $serverip = "0.0.0.0"){
|
||||
function __construct($name, $gamemode = CREATIVE, $seed = false, $port = 19132, $serverID = false, $serverip = "0.0.0.0"){
|
||||
$this->port = (int) $port; //19132 - 19135
|
||||
$this->gamemode = (int) $gamemode;
|
||||
$this->name = $name;
|
||||
@ -299,11 +299,11 @@ class PocketMinecraftServer{
|
||||
|
||||
public function getGamemode(){
|
||||
switch($this->gamemode){
|
||||
case 0:
|
||||
case SURVIVAL:
|
||||
return "survival";
|
||||
case 1:
|
||||
case CREATIVE:
|
||||
return "creative";
|
||||
case 2:
|
||||
case ADVENTURE:
|
||||
return "adventure";
|
||||
}
|
||||
}
|
||||
@ -548,7 +548,7 @@ class PocketMinecraftServer{
|
||||
$data[0],
|
||||
$this->serverID,
|
||||
MAGIC,
|
||||
$this->serverType. $this->name . " [".($this->gamemode === 1 ? "C":($this->gamemode === 2 ? "A":"S")).($this->whitelist !== false ? "W":"")." ".count($this->clients)."/".$this->maxClients."] ".$txt,
|
||||
$this->serverType. $this->name . " [".($this->gamemode === CREATIVE ? "C":($this->gamemode === ADVENTURE ? "A":"S")).($this->whitelist !== false ? "W":"")." ".count($this->clients)."/".$this->maxClients."] ".$txt,
|
||||
), false, $packet["ip"], $packet["port"]);
|
||||
$this->custom["times_".$CID] = ($this->custom["times_".$CID] + 1) % strlen($this->description);
|
||||
break;
|
||||
|
@ -32,7 +32,7 @@ class BedrockBlock extends SolidBlock{
|
||||
}
|
||||
|
||||
public function isBreakable(Item $item, Player $player){
|
||||
if($player->gamemode === 1){
|
||||
if($player->gamemode === CREATIVE){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user