diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index b0269dd7..63947086 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -126,6 +126,10 @@ class BanAPI{ case "sudo": $target = strtolower(array_shift($params)); $player = $this->server->api->player->get($target); + if(!isset($params[0])){ + $output .= "Usage: /sudo \n"; + break; + } if(!($player instanceof Player)){ $output .= "Player not connected.\n"; break; @@ -134,11 +138,11 @@ class BanAPI{ $output .= "Command ran as " . $player->username . ".\n"; break; case "op": - $user = strtolower($params[0]); - if($user == null){ + if(!isset($params[0])){ $output .= "Usage: /op \n"; break; } + $user = strtolower($params[0]); $player = $this->server->api->player->get($user); if(!($player instanceof Player)){ $this->ops->set($user); @@ -152,6 +156,10 @@ class BanAPI{ $this->server->api->chat->sendTo(false, "You are now op.", $player->iusername); break; case "deop": + if(!isset($params[0])){ + $output .= "Usage: /deop \n"; + break; + } $user = strtolower($params[0]); $player = $this->server->api->player->get($user); if(!($player instanceof Player)){ diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 19dc0079..cda65425 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -191,7 +191,7 @@ class ConsoleAPI{ "spectator" => VIEW, "v" => VIEW, ]; - if(!isset($gms[strtolower($params[0])])){ + if(!isset($params[0]) or !isset($gms[strtolower($params[0])])){ $output .= "Usage: /$cmd \n"; break; } @@ -205,9 +205,6 @@ class ConsoleAPI{ $info = $this->server->debugInfo(); $output .= "TPS: " . $info["tps"] . ", Memory usage: " . $info["memory_usage"] . " (Peak " . $info["memory_peak_usage"] . ")\n"; break; - case "update-done": - $this->server->api->setProperty("last-update", time()); - break; case "stop": $this->loop->stop = true; $output .= "Stopping the server\n"; diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index b4b18b0d..640d61a6 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -93,7 +93,7 @@ class EntityAPI{ "z" => $spawnZ, "Health" => $this->hp[$type], ]); - $this->spawnToAll($entityit, $level); + $this->spawnToAll($entityit, $spawnLevel); $output .= $this->mobName[$type] . " spawned in " . $spawnX . ", " . $spawnY . ", " . $spawnZ . "."; break; }elseif(is_numeric($args[1])){//summon [amount] @@ -104,7 +104,7 @@ class EntityAPI{ } $isBaby = 0; - if(strtolower($args[2]) == 'baby'){//summon [amount] [baby] + if(isset($args[2]) and strtolower($args[2]) == 'baby'){//summon [amount] [baby] if($type > 13){ $output .= "This mob cant be baby!"; break; @@ -125,7 +125,7 @@ class EntityAPI{ "Health" => $this->hp[$type], "IsBaby" => $isBaby, ]); - $this->spawnToAll($entityit, $level); + $this->spawnToAll($entityit, $spawnLevel); } if($type == 13 or $amount == 1) @@ -155,7 +155,7 @@ class EntityAPI{ "Health" => $this->hp[$type], "isBaby" => 1, ]); - $this->spawnToAll($entityit, $level); + $this->spawnToAll($entityit, $spawnLevel); $output .= "Baby " . $this->mobName[$type] . " spawned in " . $spawnX . ", " . $spawnY . ", " . $spawnZ . "."; break; } @@ -262,11 +262,11 @@ class EntityAPI{ return $entities; } - public function heal($eid, $heal = 1, $cause){ + public function heal($eid, $heal, $cause){ $this->harm($eid, -$heal, $cause); } - public function harm($eid, $attack = 1, $cause, $force = false){ + public function harm($eid, $attack, $cause, $force = false){ $e = $this->get($eid); if($e === false or $e->dead === true){ return false; diff --git a/src/API/LevelAPI.php b/src/API/LevelAPI.php index d3b28c8b..28ffffea 100644 --- a/src/API/LevelAPI.php +++ b/src/API/LevelAPI.php @@ -147,11 +147,12 @@ class LevelAPI{ return ("Spawn set!"); break; case "save-all": + $output .= "Saving...\n"; $save = $this->server->saveEnabled; $this->server->saveEnabled = true; $this->saveAll(); $this->server->saveEnabled = $save; - $this->server->api->chat->broadcast("[NostalgiaCore] All files are saved."); + $output .= "Saved the world"; break; case "save-on": $this->server->saveEnabled = true; diff --git a/src/API/TimeAPI.php b/src/API/TimeAPI.php index da4786b7..cc31c37a 100644 --- a/src/API/TimeAPI.php +++ b/src/API/TimeAPI.php @@ -65,7 +65,7 @@ class TimeAPI{ $output .= "Added $addTime ticks" . $world . "\n"; break; case "set": - if(substr($args[1], 0, 2) === "w:"){ + if(isset($args[1]) and substr($args[1], 0, 2) === "w:"){ $levelName = preg_replace("/w:/", "", $args[1]); $level = $this->server->api->level->get($levelName); if($level instanceof Level){ @@ -83,6 +83,7 @@ class TimeAPI{ ; else{ $output .= "Wrong time!"; + break; } $this->set($setTime, $level); $output .= "Set the time to " . $setTime . $world . "\n"; diff --git a/src/Player.php b/src/Player.php index b79332b6..9dc21de2 100755 --- a/src/Player.php +++ b/src/Player.php @@ -2332,7 +2332,6 @@ class Player{ }else{ $this->setSlot($slot, BlockAPI::getItem($item->getID(), $item->getMetadata(), $s->count + $item->count), false); } - console($item->getID()); switch($item->getID()){ case WORKBENCH: AchievementAPI::grantAchievement($this, "buildWorkBench"); diff --git a/src/entity/EntityRegistry.php b/src/entity/EntityRegistry.php index 233f156f..fd964c44 100644 --- a/src/entity/EntityRegistry.php +++ b/src/entity/EntityRegistry.php @@ -58,7 +58,7 @@ class EntityRegistry{ //self::$entityList[$className::TYPE] = $className; self::$entityList->addEntity(new PropertyEntity($className::CLASS_TYPE, $className::TYPE, $className)); //self::$shortNames[$className] = $class->getShortName(); what is this even supposed to do? - console("Registered a ".$className); + console("[INFO] Registered a ".$className); return true; } diff --git a/src/network/protocol/packet/PlayerActionPacket.php b/src/network/protocol/packet/PlayerActionPacket.php index 690dc117..cdcc64ad 100644 --- a/src/network/protocol/packet/PlayerActionPacket.php +++ b/src/network/protocol/packet/PlayerActionPacket.php @@ -19,7 +19,6 @@ class PlayerActionPacket extends RakNetDataPacket{ $this->z = $this->getInt(); $this->face = $this->getInt(); $this->eid = $this->getInt(); - console($this->getInt()); } public function encode(){