diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 613424c4..d7a9d8fe 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -337,7 +337,6 @@ class BlockAPI{ $output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$issuer->username; break; } - break; } return $output; } diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 112dfb64..1efb0943 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -92,7 +92,7 @@ class ConsoleAPI{ $end = strlen($line); } $cmd = strtolower(substr($line, 0, $end)); - $params = (string) substr($line, $end + 1); + $params = substr($line, $end + 1); if(isset($this->alias[$cmd])){ return $this->run($this->alias[$cmd] . ($params !== "" ? " " . $params : ""), $issuer, $cmd); } diff --git a/src/API/LevelAPI.php b/src/API/LevelAPI.php index 30515e7a..3784363a 100644 --- a/src/API/LevelAPI.php +++ b/src/API/LevelAPI.php @@ -170,7 +170,6 @@ class LevelAPI{ } $issuer->entity->level->setSpawn(new Vector3($issuer->entity->x, $issuer->entity->y, $issuer->entity->z)); return ("Spawn set!"); - break; case "save-all": $output .= "Saving...\n"; foreach($this->server->clients as $p){ diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index 0d7311ae..373f3c70 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -218,7 +218,6 @@ class PlayerAPI{ }else{ return "Usage: /$cmd [player]\n"; } - break; case "list": $output .= "There are " . count($this->server->clients) . "/" . $this->server->maxClients . " players online:\n"; if(count($this->server->clients) == 0){ @@ -228,7 +227,6 @@ class PlayerAPI{ $output .= $c->username . ", "; } return substr($output, 0, -2) . "\n"; - break; case "loc": if(!($issuer instanceof Player)) return "Please run this command in-game."; $x = round($issuer->entity->x, 1, PHP_ROUND_HALF_UP); diff --git a/src/API/TimeAPI.php b/src/API/TimeAPI.php index 225f4046..e8e9f54e 100644 --- a/src/API/TimeAPI.php +++ b/src/API/TimeAPI.php @@ -22,7 +22,6 @@ class TimeAPI{ $output = ""; switch($cmd){ case "time": - $level = false; if($issuer instanceof Player){ $level = $issuer->level; }else{ diff --git a/src/Player.php b/src/Player.php index 358cad6b..b6443bcf 100755 --- a/src/Player.php +++ b/src/Player.php @@ -666,7 +666,7 @@ class Player{ public function sendInventorySlot($s){ $this->sendInventory(); - return; + return true; $s = (int) $s; if(!isset($this->inventory[$s])){ $pk = new ContainerSetSlotPacket; @@ -1727,7 +1727,7 @@ class Player{ $this->server->schedule(50, [$this, "measureLag"], [], true); $pk = new SetTimePacket; - $pk->time = (int) $this->level->getTime(); + $pk->time = $this->level->getTime(); $pk->started = !$this->level->isTimeStopped(); $this->dataPacket($pk); diff --git a/src/material/block/solid/GrassBlock.php b/src/material/block/solid/GrassBlock.php index f2850eba..9b689ff6 100644 --- a/src/material/block/solid/GrassBlock.php +++ b/src/material/block/solid/GrassBlock.php @@ -39,11 +39,8 @@ class GrassBlock extends SolidBlock{ $chance = lcg_value() * 100; if($chance <= 1){ ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(BEETROOT_SEEDS,0,1), 10); - return; - } - elseif($chance > 1 and $chance <= 16){ + }elseif($chance > 1 and $chance <= 16){ ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(SEEDS,0,1), 10); - return; } } public static function onRandomTick(Level $level, $x, $y, $z){ diff --git a/src/utils/AsyncMultipleQueue.php b/src/utils/AsyncMultipleQueue.php index e8de55a7..5581a63b 100644 --- a/src/utils/AsyncMultipleQueue.php +++ b/src/utils/AsyncMultipleQueue.php @@ -61,7 +61,7 @@ class AsyncMultipleQueue extends Thread{ ++$offset; } } - $this->input = (string) substr($this->input, $offset); + $this->input = substr($this->input, $offset); return $str; } } diff --git a/src/utils/Config.php b/src/utils/Config.php index 7c9db694..23b3c153 100644 --- a/src/utils/Config.php +++ b/src/utils/Config.php @@ -109,7 +109,6 @@ class Config{ default: $this->correct = false; return false; - break; } if(!is_array($this->config)){ $this->config = $default; @@ -247,7 +246,7 @@ class Config{ unset($this->correct); unset($this->type); $this->load($this->file); - $correct = $this->check(); + $this->check(); } /** diff --git a/src/utils/NBT.php b/src/utils/NBT.php index 1c3dfa51..6d1084ac 100644 --- a/src/utils/NBT.php +++ b/src/utils/NBT.php @@ -67,7 +67,6 @@ class NBT{ default: echo bin2hex(substr($this->binary, $this->offset - 1)) . PHP_EOL . PHP_EOL; die("Invalid NBT Tag $tag"); - break; } $node[$name] = $value; } @@ -155,7 +154,6 @@ class NBT{ default: echo bin2hex(substr($this->binary, $this->offset - 1)) . PHP_EOL . PHP_EOL; die("Invalid NBT Tag $tag"); - break; } $node[] = $value; } diff --git a/src/utils/Random.php b/src/utils/Random.php index 21a7f766..f2b146df 100644 --- a/src/utils/Random.php +++ b/src/utils/Random.php @@ -34,7 +34,6 @@ class Random{ $this->haveNextNextGaussian = false; return $this->nextNextGaussian; }else{ - $v1 = $v2 = $s = null; do{ $v1 = 2 * $this->nextFloat() - 1; // between -1.0 and 1.0 $v2 = 2 * $this->nextFloat() - 1; // between -1.0 and 1.0 diff --git a/src/world/Level.php b/src/world/Level.php index ea5d1ad9..fbec0a71 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -549,7 +549,7 @@ class Level{ $curChunkZ = (int)$e->z >> 4; $index = "$curChunkX $curChunkZ"; - if(isset($this->entityListPositioned[$index]) && isset($this->entityListPositioned[$index][$k])){ + if(isset($this->entityListPositioned[$index][$k])){ unset($this->entityListPositioned[$index][$k]); } diff --git a/src/world/PocketChunkParser.php b/src/world/PocketChunkParser.php index f9530a8a..2c85bb4a 100644 --- a/src/world/PocketChunkParser.php +++ b/src/world/PocketChunkParser.php @@ -7,10 +7,6 @@ class PocketChunkParser{ var $map; //21 * $sectorLength private $location, $raw = b"", $file; - function __construct(){ - $map = []; - } - public function loadFile($file){ if(file_exists($file . ".gz")){ $this->raw = gzinflate(file_get_contents($file . ".gz"));