mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 15:36:08 +00:00
Adventure Mode
This commit is contained in:
@@ -96,7 +96,7 @@ class BlockAPI{
|
||||
return;
|
||||
}
|
||||
$target = $this->server->api->level->getBlock($data["x"], $data["y"], $data["z"]);
|
||||
if(isset(Material::$unbreakable[$target[0]])){
|
||||
if(isset(Material::$unbreakable[$target[0]]) or $this->server->gamemode === 2){
|
||||
return $this->cancelAction($target);
|
||||
}
|
||||
$drop = array(
|
||||
@@ -392,6 +392,10 @@ class BlockAPI{
|
||||
if($cancelPlace === true){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->server->gamemode === 2){
|
||||
return $this->cancelAction($block);
|
||||
}
|
||||
|
||||
$replace = false;
|
||||
switch($data["block"]){
|
||||
|
@@ -90,12 +90,12 @@ class ConsoleAPI{
|
||||
break;
|
||||
case "gamemode":
|
||||
$s = trim(array_shift($params));
|
||||
if($s == "" or (((int) $s) !== 0 and ((int) $s) !== 1)){
|
||||
console("[INFO] Usage: /gamemode <0 | 1>");
|
||||
if($s == "" or (((int) $s) !== 0 and ((int) $s) !== 1 and ((int) $s) !== 2)){
|
||||
console("[INFO] Usage: /gamemode <0 | 1 | 2>");
|
||||
break;
|
||||
}
|
||||
$this->server->api->setProperty("gamemode", (int) $s);
|
||||
console("[INFO] Gamemode changed to ".$this->server->gamemode);
|
||||
console("[INFO] Gamemode changed to ".$this->server->getGamemode());
|
||||
break;
|
||||
case "difficulty":
|
||||
$s = trim(array_shift($params));
|
||||
|
Reference in New Issue
Block a user