diff --git a/src/pocketmine/Achievement.php b/src/pocketmine/Achievement.php index 43dc4d217..eb5fc537d 100644 --- a/src/pocketmine/Achievement.php +++ b/src/pocketmine/Achievement.php @@ -30,78 +30,78 @@ abstract class Achievement{ /** * @var array[] */ - public static $list = array( + public static $list = [ /*"openInventory" => array( "name" => "Taking Inventory", "requires" => [], ),*/ - "mineWood" => array( + "mineWood" => [ "name" => "Getting Wood", - "requires" => array( //"openInventory", - ), - ), - "buildWorkBench" => array( + "requires" => [ //"openInventory", + ], + ], + "buildWorkBench" => [ "name" => "Benchmarking", - "requires" => array( + "requires" => [ "mineWood", - ), - ), - "buildPickaxe" => array( + ], + ], + "buildPickaxe" => [ "name" => "Time to Mine!", - "requires" => array( + "requires" => [ "buildWorkBench", - ), - ), - "buildFurnace" => array( + ], + ], + "buildFurnace" => [ "name" => "Hot Topic", - "requires" => array( + "requires" => [ "buildPickaxe", - ), - ), - "acquireIron" => array( + ], + ], + "acquireIron" => [ "name" => "Acquire hardware", - "requires" => array( + "requires" => [ "buildFurnace", - ), - ), - "buildHoe" => array( + ], + ], + "buildHoe" => [ "name" => "Time to Farm!", - "requires" => array( + "requires" => [ "buildWorkBench", - ), - ), - "makeBread" => array( + ], + ], + "makeBread" => [ "name" => "Bake Bread", - "requires" => array( + "requires" => [ "buildHoe", - ), - ), - "bakeCake" => array( + ], + ], + "bakeCake" => [ "name" => "The Lie", - "requires" => array( + "requires" => [ "buildHoe", - ), - ), - "buildBetterPickaxe" => array( + ], + ], + "buildBetterPickaxe" => [ "name" => "Getting an Upgrade", - "requires" => array( + "requires" => [ "buildPickaxe", - ), - ), - "buildSword" => array( + ], + ], + "buildSword" => [ "name" => "Time to Strike!", - "requires" => array( + "requires" => [ "buildWorkBench", - ), - ), - "diamonds" => array( + ], + ], + "diamonds" => [ "name" => "DIAMONDS!", - "requires" => array( + "requires" => [ "acquireIron", - ), - ), + ], + ], - ); + ]; public static function broadcast(Player $player, $achievementId){ @@ -120,10 +120,10 @@ abstract class Achievement{ public static function add($achievementId, $achievementName, array $requires = []){ if(!isset(Achievement::$list[$achievementId])){ - Achievement::$list[$achievementId] = array( + Achievement::$list[$achievementId] = [ "name" => $achievementName, "requires" => $requires, - ); + ]; return true; } diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index 30eebff0a..537234bb9 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -137,7 +137,7 @@ class CrashDump{ }else{ $error = (array) error_get_last(); $error["trace"] = getTrace(4); - $errorConversion = array( + $errorConversion = [ E_ERROR => "E_ERROR", E_WARNING => "E_WARNING", E_PARSE => "E_PARSE", @@ -153,7 +153,7 @@ class CrashDump{ E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR", E_DEPRECATED => "E_DEPRECATED", E_USER_DEPRECATED => "E_USER_DEPRECATED", - ); + ]; $error["fullFile"] = $error["file"]; $error["file"] = cleanPath($error["file"]); $error["type"] = isset($errorConversion[$error["type"]]) ? $errorConversion[$error["type"]] : $error["type"]; diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 0dca6fb9f..5d20038f1 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -809,7 +809,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->sendMetadata($this); $this->setSpawn($pos); - $this->tasks[] = $this->server->getScheduler()->scheduleDelayedTask(new CallbackTask(array($this, "checkSleep")), 60); + $this->tasks[] = $this->server->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "checkSleep"]), 60); return true; @@ -1135,7 +1135,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->displayName = $this->username; $this->nameTag = $this->username; $this->iusername = strtolower($this->username); - $this->loginData = array("clientId" => $packet->clientId, "loginData" => $packet->loginData); + $this->loginData = ["clientId" => $packet->clientId, "loginData" => $packet->loginData]; if(count($this->server->getOnlinePlayers()) > $this->server->getMaxPlayers()){ if($this->kick("server full") === true){ @@ -1297,9 +1297,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->orderChunks(); - $this->tasks[] = $this->server->getScheduler()->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "orderChunks")), 10, 40); + $this->tasks[] = $this->server->getScheduler()->scheduleDelayedRepeatingTask(new CallbackTask([$this, "orderChunks"]), 10, 40); $this->sendNextChunk(); - $this->tasks[] = $this->chunkLoadTask = $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask(array($this, "sendNextChunk")), 1); + $this->tasks[] = $this->chunkLoadTask = $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "sendNextChunk"]), 1); break; case ProtocolInfo::ROTATE_HEAD_PACKET: @@ -1790,7 +1790,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } switch($packet->event){ case 9: //Eating - $items = array( + $items = [ Item::APPLE => 4, Item::MUSHROOM_STEW => 10, Item::BEETROOT_SOUP => 10, @@ -1810,7 +1810,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ //Item::COOKIE => 2, //Item::COOKED_FISH => 5, //Item::RAW_FISH => 2, - ); + ]; $slot = $this->inventory->getItemInHand(); if($this->getHealth() < 20 and isset($items[$slot->getID()])){ $this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $slot)); @@ -2309,17 +2309,17 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $flags |= $this->fireTicks > 0 ? 1 : 0; //$flags |= ($this->crouched === true ? 0b10:0) << 1; $flags |= ($this->inAction === true ? 0b10000:0); - $d = array( - 0 => array("type" => 0, "value" => $flags), - 1 => array("type" => 1, "value" => $this->airTicks), - 16 => array("type" => 0, "value" => 0), - 17 => array("type" => 6, "value" => array(0, 0, 0)), - ); + $d = [ + 0 => ["type" => 0, "value" => $flags], + 1 => ["type" => 1, "value" => $this->airTicks], + 16 => ["type" => 0, "value" => 0], + 17 => ["type" => 6, "value" => [0, 0, 0]], + ]; if($this->sleeping !== false){ $d[16]["value"] = 2; - $d[17]["value"] = array($this->sleeping->x, $this->sleeping->y, $this->sleeping->z); + $d[17]["value"] = [$this->sleeping->x, $this->sleeping->y, $this->sleeping->z]; } diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index cca5cb1ad..3f5cd24fc 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -148,7 +148,7 @@ namespace pocketmine { ini_set("memory_limit", "256M"); //Default define("pocketmine\\START_TIME", microtime(true)); - $opts = getopt("", array("enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler")); + $opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]); define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR); define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR); @@ -217,7 +217,7 @@ namespace pocketmine { if(error_reporting() === 0){ //@ error-control return false; } - $errorConversion = array( + $errorConversion = [ E_ERROR => "E_ERROR", E_WARNING => "E_WARNING", E_PARSE => "E_PARSE", @@ -233,7 +233,7 @@ namespace pocketmine { E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR", E_DEPRECATED => "E_DEPRECATED", E_USER_DEPRECATED => "E_USER_DEPRECATED", - ); + ]; $type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? LogLevel::ERROR : LogLevel::NOTICE; $errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno; if(($pos = strpos($errstr, "\n")) !== false){ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index cd927edde..315dce5e4 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -626,14 +626,14 @@ class Server{ $path = $this->getDataPath() . "players/"; if(!file_exists($path . "$name.dat")){ $spawn = $this->getDefaultLevel()->getSafeSpawn(); - $nbt = new Compound(false, array( + $nbt = new Compound(false, [ new Long("firstPlayed", floor(microtime(true) * 1000)), new Long("lastPlayed", floor(microtime(true) * 1000)), - new Enum("Pos", array( + new Enum("Pos", [ new Double(0, $spawn->x), new Double(1, $spawn->y), new Double(2, $spawn->z) - )), + ]), new String("Level", $this->getDefaultLevel()->getName()), //new String("SpawnLevel", $this->getDefaultLevel()->getName()), //new Int("SpawnX", (int) $spawn->x), @@ -643,22 +643,22 @@ class Server{ new Enum("Inventory", []), new Compound("Achievements", []), new Int("playerGameType", $this->getGamemode()), - new Enum("Motion", array( + new Enum("Motion", [ new Double(0, 0.0), new Double(1, 0.0), new Double(2, 0.0) - )), - new Enum("Rotation", array( + ]), + new Enum("Rotation", [ new Float(0, 0.0), new Float(1, 0.0) - )), + ]), new Float("FallDistance", 0.0), new Short("Fire", 0), new Short("Air", 0), new Byte("OnGround", 1), new Byte("Invulnerable", 0), new String("NameTag", $name), - )); + ]); $nbt->Pos->setTagType(NBT::TAG_Double); $nbt->Inventory->setTagType(NBT::TAG_Compound); $nbt->Motion->setTagType(NBT::TAG_Double); @@ -678,35 +678,35 @@ class Server{ $this->logger->notice("Old Player data found for \"" . $name . "\", upgrading profile"); foreach($data->get("inventory") as $slot => $item){ if(count($item) === 3){ - $nbt->Inventory[$slot + 9] = new Compound(false, array( + $nbt->Inventory[$slot + 9] = new Compound(false, [ new Short("id", $item[0]), new Short("Damage", $item[1]), new Byte("Count", $item[2]), new Byte("Slot", $slot + 9), new Byte("TrueSlot", $slot + 9) - )); + ]); } } foreach($data->get("hotbar") as $slot => $itemSlot){ if(isset($nbt->Inventory[$itemSlot + 9])){ $item = $nbt->Inventory[$itemSlot + 9]; - $nbt->Inventory[$slot] = new Compound(false, array( + $nbt->Inventory[$slot] = new Compound(false, [ new Short("id", $item["id"]), new Short("Damage", $item["Damage"]), new Byte("Count", $item["Count"]), new Byte("Slot", $slot), new Byte("TrueSlot", $item["TrueSlot"]) - )); + ]); } } foreach($data->get("armor") as $slot => $item){ if(count($item) === 2){ - $nbt->Inventory[$slot + 100] = new Compound(false, array( + $nbt->Inventory[$slot + 100] = new Compound(false, [ new Short("id", $item[0]), new Short("Damage", $item[1]), new Byte("Count", 1), new Byte("Slot", $slot + 100) - )); + ]); } } foreach($data->get("achievements") as $achievement => $status){ @@ -788,7 +788,7 @@ class Server{ $matchedPlayers = []; foreach($this->getOnlinePlayers() as $player){ if(strtolower($player->getName()) === $partialName){ - $matchedPlayers = array($player); + $matchedPlayers = [$player]; break; }elseif(stripos($player->getName(), $partialName) !== false){ $matchedPlayers[] = $player; @@ -1142,7 +1142,7 @@ class Server{ * @return string */ public function getConfigString($variable, $defaultValue = ""){ - $v = getopt("", array("$variable::")); + $v = getopt("", ["$variable::"]); if(isset($v[$variable])){ return (string) $v[$variable]; } @@ -1192,7 +1192,7 @@ class Server{ * @return int */ public function getConfigInt($variable, $defaultValue = 0){ - $v = getopt("", array("$variable::")); + $v = getopt("", ["$variable::"]); if(isset($v[$variable])){ return (int) $v[$variable]; } @@ -1215,7 +1215,7 @@ class Server{ * @return boolean */ public function getConfigBoolean($variable, $defaultValue = false){ - $v = getopt("", array("$variable::")); + $v = getopt("", ["$variable::"]); if(isset($v[$variable])){ $value = $v[$variable]; }else{ @@ -1427,7 +1427,7 @@ class Server{ $this->config = new Config($this->dataPath . "pocketmine.yml", Config::YAML, []); $this->logger->info("Loading server properties..."); - $this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, array( + $this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [ "motd" => "Minecraft: PE Server", "server-port" => 19132, "memory-limit" => "256M", @@ -1451,7 +1451,7 @@ class Server{ "enable-rcon" => false, "rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10), "auto-save" => true, - )); + ]); ServerScheduler::$WORKERS = $this->getProperty("settings.async-workers", ServerScheduler::$WORKERS); @@ -1464,7 +1464,7 @@ class Server{ $this->maxPlayers = $this->getConfigInt("max-players", 20); if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){ - $value = array("M" => 1, "G" => 1024); + $value = ["M" => 1, "G" => 1024]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; if($real < 128){ $this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0); @@ -1582,7 +1582,7 @@ class Server{ $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask("pocketmine\\utils\\Cache::cleanup"), $this->getProperty("ticks-per.cache-cleanup", 900), $this->getProperty("ticks-per.cache-cleanup", 900)); if($this->getConfigBoolean("auto-save", true) === true and $this->getProperty("ticks-per.autosave", 6000) > 0){ - $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "doAutoSave")), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000)); + $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doAutoSave"]), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000)); } if($this->getProperty("chunk-gc.period-in-ticks", 600) > 0){ @@ -1725,7 +1725,7 @@ class Server{ $this->maxPlayers = $this->getConfigInt("max-players", 20); if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){ - $value = array("M" => 1, "G" => 1024); + $value = ["M" => 1, "G" => 1024]; $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; if($real < 256){ $this->logger->warning($this->getName() . " may not work right with less than 256MB of RAM", true, true, 0); @@ -1809,7 +1809,7 @@ class Server{ if($this->getProperty("settings.send-usage", true) !== false){ - $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "sendUsage")), 6000, 6000); + $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "sendUsage"]), 6000, 6000); $this->sendUsage(); } @@ -2014,11 +2014,11 @@ class Server{ $plist = ""; foreach($this->getPluginManager()->getPlugins() as $p){ $d = $p->getDescription(); - $plist .= str_replace(array(";", ":"), "", $d->getName()) . ":" . str_replace(array(";", ":"), "", $d->getVersion()) . ";"; + $plist .= str_replace([";", ":"], "", $d->getName()) . ":" . str_replace([";", ":"], "", $d->getVersion()) . ";"; } $version = new VersionString(); - $this->lastSendUsage = new SendUsageTask("http://stats.pocketmine.net/usage.php", array( + $this->lastSendUsage = new SendUsageTask("http://stats.pocketmine.net/usage.php", [ "serverid" => Binary::readLong(substr(Utils::getUniqueID(true, $this->getIp() . ":" . $this->getPort()), 0, 8)), "port" => $this->getPort(), "os" => Utils::getOS(), @@ -2032,7 +2032,7 @@ class Server{ "online" => count($this->players), "max" => $this->getMaxPlayers(), "plugins" => $plist, - )); + ]); $this->scheduler->scheduleAsyncTask($this->lastSendUsage); } diff --git a/src/pocketmine/block/AcaciaWoodStairs.php b/src/pocketmine/block/AcaciaWoodStairs.php index 92902a23e..0df975661 100644 --- a/src/pocketmine/block/AcaciaWoodStairs.php +++ b/src/pocketmine/block/AcaciaWoodStairs.php @@ -29,8 +29,8 @@ class AcaciaWoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Bed.php b/src/pocketmine/block/Bed.php index a1723bf77..e94f22d73 100644 --- a/src/pocketmine/block/Bed.php +++ b/src/pocketmine/block/Bed.php @@ -86,12 +86,12 @@ class Bed extends Transparent{ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ $down = $this->getSide(0); if($down->isTransparent === false){ - $faces = array( + $faces = [ 0 => 3, 1 => 4, 2 => 2, 3 => 5, - ); + ]; $d = $player instanceof Player ? $player->getDirection() : 0; $next = $this->getSide($faces[(($d + 3) % 4)]); $downNext = $this->getSide(0); @@ -140,9 +140,9 @@ class Bed extends Transparent{ } public function getDrops(Item $item){ - return array( - array(Item::BED, 0, 1), - ); + return [ + [Item::BED, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Beetroot.php b/src/pocketmine/block/Beetroot.php index a603a3cbc..36c0be437 100644 --- a/src/pocketmine/block/Beetroot.php +++ b/src/pocketmine/block/Beetroot.php @@ -86,10 +86,10 @@ class Beetroot extends Flowable{ public function getDrops(Item $item){ $drops = []; if($this->meta >= 0x07){ - $drops[] = array(Item::BEETROOT, 0, 1); - $drops[] = array(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)); + $drops[] = [Item::BEETROOT, 0, 1]; + $drops[] = [Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)]; }else{ - $drops[] = array(Item::BEETROOT_SEEDS, 0, 1); + $drops[] = [Item::BEETROOT_SEEDS, 0, 1]; } return $drops; diff --git a/src/pocketmine/block/BirchWoodStairs.php b/src/pocketmine/block/BirchWoodStairs.php index ed4a3049b..885e6142c 100644 --- a/src/pocketmine/block/BirchWoodStairs.php +++ b/src/pocketmine/block/BirchWoodStairs.php @@ -29,8 +29,8 @@ class BirchWoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 40cbd0cd4..677d0b682 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -230,7 +230,7 @@ abstract class Block extends Position implements Metadatable{ const GLOWING_OBSIDIAN = 246; const NETHER_REACTOR = 247; - public static $creative = array( + public static $creative = [ //Building [Item::COBBLESTONE, 0], [Item::STONE_BRICKS, 0], @@ -500,7 +500,7 @@ abstract class Block extends Position implements Metadatable{ [Item::DYE, 9], [Item::DYE, 8], - ); + ]; /** @var Block[] */ public static $list = []; @@ -526,7 +526,7 @@ abstract class Block extends Position implements Metadatable{ public static function init(){ if(count(self::$list) === 0){ - self::$list = array( + self::$list = [ self::AIR => Air::class, self::STONE => Stone::class, self::GRASS => Grass::class, @@ -663,7 +663,7 @@ abstract class Block extends Position implements Metadatable{ self::STONECUTTER => Stonecutter::class, self::GLOWING_OBSIDIAN => GlowingObsidian::class, self::NETHER_REACTOR => NetherReactor::class, - ); + ]; } } @@ -759,7 +759,7 @@ abstract class Block extends Position implements Metadatable{ return []; }else{ return [ - array($this->id, $this->meta, 1), + [$this->id, $this->meta, 1], ]; } } diff --git a/src/pocketmine/block/Bricks.php b/src/pocketmine/block/Bricks.php index 16ec86cb0..bd61f37f3 100644 --- a/src/pocketmine/block/Bricks.php +++ b/src/pocketmine/block/Bricks.php @@ -48,9 +48,9 @@ class Bricks extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::BRICKS_BLOCK, 0, 1), - ); + return [ + [Item::BRICKS_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/BurningFurnace.php b/src/pocketmine/block/BurningFurnace.php index 161a1286b..3a9a871d0 100644 --- a/src/pocketmine/block/BurningFurnace.php +++ b/src/pocketmine/block/BurningFurnace.php @@ -39,21 +39,21 @@ class BurningFurnace extends Solid{ } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 4, 1 => 2, 2 => 5, 3 => 3, - ); + ]; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0]; $this->getLevel()->setBlock($block, $this, true, false, true); - $nbt = new Compound(false, array( + $nbt = new Compound(false, [ new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) - )); + ]); $nbt->Items->setTagType(NBT::TAG_Compound); new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt); @@ -73,13 +73,13 @@ class BurningFurnace extends Solid{ if($t instanceof Furnace){ $furnace = $t; }else{ - $nbt = new Compound(false, array( + $nbt = new Compound(false, [ new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) - )); + ]); $nbt->Items->setTagType(NBT::TAG_Compound); $furnace = new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt); } @@ -114,14 +114,14 @@ class BurningFurnace extends Solid{ public function getDrops(Item $item){ $drops = []; if($item->isPickaxe() >= 1){ - $drops[] = array(Item::FURNACE, 0, 1); + $drops[] = [Item::FURNACE, 0, 1]; } $t = $this->getLevel()->getTile($this); if($t instanceof Furnace){ for($s = 0; $s < $t->getInventory()->getSize(); ++$s){ $slot = $t->getInventory()->getItem($s); if($slot->getID() > Item::AIR and $slot->getCount() > 0){ - $drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount()); + $drops[] = [$slot->getID(), $slot->getDamage(), $slot->getCount()]; } } } diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index 0b495d02a..25a3ece93 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -84,8 +84,8 @@ class Cactus extends Transparent{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Carpet.php b/src/pocketmine/block/Carpet.php index 0159e45cf..1f2d28260 100644 --- a/src/pocketmine/block/Carpet.php +++ b/src/pocketmine/block/Carpet.php @@ -28,7 +28,7 @@ use pocketmine\Player; class Carpet extends Flowable{ public function __construct($meta = 0){ parent::__construct(self::CARPET, $meta, "Carpet"); - $names = array( + $names = [ 0 => "White Carpet", 1 => "Orange Carpet", 2 => "Magenta Carpet", @@ -45,7 +45,7 @@ class Carpet extends Flowable{ 13 => "Green Carpet", 14 => "Red Carpet", 15 => "Black Carpet", - ); + ]; $this->name = $names[$this->meta]; $this->hardness = 0; $this->isFullBlock = false; diff --git a/src/pocketmine/block/Carrot.php b/src/pocketmine/block/Carrot.php index fc3249adc..627f3576d 100644 --- a/src/pocketmine/block/Carrot.php +++ b/src/pocketmine/block/Carrot.php @@ -88,9 +88,9 @@ class Carrot extends Flowable{ public function getDrops(Item $item){ $drops = []; if($this->meta >= 0x07){ - $drops[] = array(Item::CARROT, 0, mt_rand(1, 4)); + $drops[] = [Item::CARROT, 0, mt_rand(1, 4)]; }else{ - $drops[] = array(Item::CARROT, 0, 1); + $drops[] = [Item::CARROT, 0, 1]; } return $drops; diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index 759ddc91c..cffc10ead 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -42,12 +42,12 @@ class Chest extends Transparent{ } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 4, 1 => 2, 2 => 5, 3 => 3, - ); + ]; $chest = false; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0]; @@ -69,13 +69,13 @@ class Chest extends Transparent{ } $this->getLevel()->setBlock($block, $this, true, false, true); - $nbt = new Compound(false, array( + $nbt = new Compound(false, [ new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) - )); + ]); $nbt->Items->setTagType(NBT::TAG_Compound); $tile = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt); @@ -109,13 +109,13 @@ class Chest extends Transparent{ if($t instanceof TileChest){ $chest = $t; }else{ - $nbt = new Compound(false, array( + $nbt = new Compound(false, [ new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z) - )); + ]); $nbt->Items->setTagType(NBT::TAG_Compound); $chest = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt); } @@ -131,15 +131,15 @@ class Chest extends Transparent{ } public function getDrops(Item $item){ - $drops = array( - array($this->id, 0, 1), - ); + $drops = [ + [$this->id, 0, 1], + ]; $t = $this->getLevel()->getTile($this); if($t instanceof TileChest){ for($s = 0; $s < $t->getRealInventory()->getSize(); ++$s){ $slot = $t->getRealInventory()->getItem($s); if($slot->getID() > Item::AIR and $slot->getCount() > 0){ - $drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount()); + $drops[] = [$slot->getID(), $slot->getDamage(), $slot->getCount()]; } } } diff --git a/src/pocketmine/block/Clay.php b/src/pocketmine/block/Clay.php index 055e3fc02..8e61c95ff 100644 --- a/src/pocketmine/block/Clay.php +++ b/src/pocketmine/block/Clay.php @@ -30,8 +30,8 @@ class Clay extends Solid{ } public function getDrops(Item $item){ - return array( - array(Item::CLAY, 0, 4), - ); + return [ + [Item::CLAY, 0, 4], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Coal.php b/src/pocketmine/block/Coal.php index ee224883d..ab25433ba 100644 --- a/src/pocketmine/block/Coal.php +++ b/src/pocketmine/block/Coal.php @@ -48,9 +48,9 @@ class Coal extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::COAL_BLOCK, 0, 1), - ); + return [ + [Item::COAL_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/CoalOre.php b/src/pocketmine/block/CoalOre.php index 49b0c630d..35baf4fc1 100644 --- a/src/pocketmine/block/CoalOre.php +++ b/src/pocketmine/block/CoalOre.php @@ -48,9 +48,9 @@ class CoalOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::COAL, 0, 1), - ); + return [ + [Item::COAL, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Cobblestone.php b/src/pocketmine/block/Cobblestone.php index 186157d23..53f6ec566 100644 --- a/src/pocketmine/block/Cobblestone.php +++ b/src/pocketmine/block/Cobblestone.php @@ -48,9 +48,9 @@ class Cobblestone extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::COBBLESTONE, 0, 1), - ); + return [ + [Item::COBBLESTONE, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/DarkOakWoodStairs.php b/src/pocketmine/block/DarkOakWoodStairs.php index b89439abe..28d14c12d 100644 --- a/src/pocketmine/block/DarkOakWoodStairs.php +++ b/src/pocketmine/block/DarkOakWoodStairs.php @@ -29,8 +29,8 @@ class DarkOakWoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Diamond.php b/src/pocketmine/block/Diamond.php index 6c211656a..a80a05543 100644 --- a/src/pocketmine/block/Diamond.php +++ b/src/pocketmine/block/Diamond.php @@ -42,9 +42,9 @@ class Diamond extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::DIAMOND_BLOCK, 0, 1), - ); + return [ + [Item::DIAMOND_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/DiamondOre.php b/src/pocketmine/block/DiamondOre.php index d6a48baab..2eab1db2d 100644 --- a/src/pocketmine/block/DiamondOre.php +++ b/src/pocketmine/block/DiamondOre.php @@ -42,9 +42,9 @@ class DiamondOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::DIAMOND, 0, 1), - ); + return [ + [Item::DIAMOND, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Door.php b/src/pocketmine/block/Door.php index 6882c4eed..5e476dbae 100644 --- a/src/pocketmine/block/Door.php +++ b/src/pocketmine/block/Door.php @@ -57,12 +57,12 @@ abstract class Door extends Transparent{ return false; } $direction = $player instanceof Player ? $player->getDirection() : 0; - $face = array( + $face = [ 0 => 3, 1 => 4, 2 => 2, 3 => 5, - ); + ]; $next = $this->getSide($face[(($direction + 2) % 4)]); $next2 = $this->getSide($face[$direction]); $metaUp = 0x08; diff --git a/src/pocketmine/block/DoubleSlab.php b/src/pocketmine/block/DoubleSlab.php index 7ab51b6ab..e85c1dee0 100644 --- a/src/pocketmine/block/DoubleSlab.php +++ b/src/pocketmine/block/DoubleSlab.php @@ -26,7 +26,7 @@ use pocketmine\item\Item; class DoubleSlab extends Solid{ public function __construct($meta = 0){ parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab"); - $names = array( + $names = [ 0 => "Stone", 1 => "Sandstone", 2 => "Wooden", @@ -34,7 +34,7 @@ class DoubleSlab extends Solid{ 4 => "Brick", 5 => "Stone Brick", 6 => "Quartz", - ); + ]; $this->name = "Double " . $names[$this->meta & 0x07] . " Slab"; $this->hardness = 30; } @@ -58,9 +58,9 @@ class DoubleSlab extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::SLAB, $this->meta & 0x07, 2), - ); + return [ + [Item::SLAB, $this->meta & 0x07, 2], + ]; }else{ return []; } diff --git a/src/pocketmine/block/DoubleWoodSlab.php b/src/pocketmine/block/DoubleWoodSlab.php index e59432218..deeea59f2 100644 --- a/src/pocketmine/block/DoubleWoodSlab.php +++ b/src/pocketmine/block/DoubleWoodSlab.php @@ -26,14 +26,14 @@ use pocketmine\item\Item; class DoubleWoodSlab extends Solid{ public function __construct($meta = 0){ parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab"); - $names = array( + $names = [ 0 => "Oak", 1 => "Spruce", 2 => "Birch", 3 => "Jungle", 4 => "Acacia", 5 => "Dark Oak", - ); + ]; $this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab"; $this->hardness = 15; } @@ -56,9 +56,9 @@ class DoubleWoodSlab extends Solid{ } public function getDrops(Item $item){ - return array( - array(Item::WOOD_SLAB, $this->meta & 0x07, 2), - ); + return [ + [Item::WOOD_SLAB, $this->meta & 0x07, 2], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Emerald.php b/src/pocketmine/block/Emerald.php index db7e5e9d1..916cdda8d 100644 --- a/src/pocketmine/block/Emerald.php +++ b/src/pocketmine/block/Emerald.php @@ -42,9 +42,9 @@ class Emerald extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::EMERALD_BLOCK, 0, 1), - ); + return [ + [Item::EMERALD_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/EmeraldOre.php b/src/pocketmine/block/EmeraldOre.php index 9ed6bc43a..859804a5b 100644 --- a/src/pocketmine/block/EmeraldOre.php +++ b/src/pocketmine/block/EmeraldOre.php @@ -42,9 +42,9 @@ class EmeraldOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::EMERALD, 0, 1), - ); + return [ + [Item::EMERALD, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Farmland.php b/src/pocketmine/block/Farmland.php index 9e1e341f3..293886b90 100644 --- a/src/pocketmine/block/Farmland.php +++ b/src/pocketmine/block/Farmland.php @@ -30,8 +30,8 @@ class Farmland extends Solid{ } public function getDrops(Item $item){ - return array( - array(Item::DIRT, 0, 1), - ); + return [ + [Item::DIRT, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index 9f5a0f7cd..93f030629 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -37,12 +37,12 @@ class FenceGate extends Transparent{ } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 3, 1 => 0, 2 => 1, 3 => 2, - ); + ]; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03; $this->getLevel()->setBlock($block, $this, true, false, true); @@ -50,18 +50,18 @@ class FenceGate extends Transparent{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } public function onActivate(Item $item, Player $player = null){ - $faces = array( + $faces = [ 0 => 3, 1 => 0, 2 => 1, 3 => 2, - ); + ]; $this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04); if(($this->meta & 0x04) === 0x04){ $this->isFullBlock = true; diff --git a/src/pocketmine/block/Generic.php b/src/pocketmine/block/Generic.php index 491b44c22..5902fd3dc 100644 --- a/src/pocketmine/block/Generic.php +++ b/src/pocketmine/block/Generic.php @@ -43,12 +43,12 @@ class Generic extends Block{ if($this->hasPhysics === true and $type === Level::BLOCK_UPDATE_NORMAL){ $down = $this->getSide(0); if($down->getID() === self::AIR or ($down instanceof Liquid)){ - $data = array( + $data = [ "x" => $this->x + 0.5, "y" => $this->y + 0.5, "z" => $this->z + 0.5, "Tile" => $this->id, - ); + ]; /*$this->getLevel()->setBlock($this, new Air(), false, false, true); //TODO //$e = $server->api->entity->add($this->getLevel(), ENTITY_FALLING, FALLING_SAND, $data); diff --git a/src/pocketmine/block/GlowingRedstoneOre.php b/src/pocketmine/block/GlowingRedstoneOre.php index 5ede4d643..2ebb26fee 100644 --- a/src/pocketmine/block/GlowingRedstoneOre.php +++ b/src/pocketmine/block/GlowingRedstoneOre.php @@ -54,9 +54,9 @@ class GlowingRedstoneOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)), - ); + return [ + [Item::REDSTONE_DUST, 0, mt_rand(4, 5)], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Glowstone.php b/src/pocketmine/block/Glowstone.php index f7d3a1863..85df970ec 100644 --- a/src/pocketmine/block/Glowstone.php +++ b/src/pocketmine/block/Glowstone.php @@ -30,8 +30,8 @@ class Glowstone extends Transparent{ } public function getDrops(Item $item){ - return array( - array(Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)), - ); + return [ + [Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Gold.php b/src/pocketmine/block/Gold.php index e5ad32278..e2089d88a 100644 --- a/src/pocketmine/block/Gold.php +++ b/src/pocketmine/block/Gold.php @@ -42,9 +42,9 @@ class Gold extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::GOLD_BLOCK, 0, 1), - ); + return [ + [Item::GOLD_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/GoldOre.php b/src/pocketmine/block/GoldOre.php index 74f38024b..137213140 100644 --- a/src/pocketmine/block/GoldOre.php +++ b/src/pocketmine/block/GoldOre.php @@ -42,9 +42,9 @@ class GoldOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 4){ - return array( - array(Item::GOLD_ORE, 0, 1), - ); + return [ + [Item::GOLD_ORE, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Gravel.php b/src/pocketmine/block/Gravel.php index 2ffc98bde..1cbe9c1a2 100644 --- a/src/pocketmine/block/Gravel.php +++ b/src/pocketmine/block/Gravel.php @@ -31,14 +31,14 @@ class Gravel extends Fallable{ public function getDrops(Item $item){ if(mt_rand(1, 10) === 1){ - return array( - array(Item::FLINT, 0, 1), - ); + return [ + [Item::FLINT, 0, 1], + ]; } - return array( - array(Item::GRAVEL, 0, 1), - ); + return [ + [Item::GRAVEL, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/HayBale.php b/src/pocketmine/block/HayBale.php index 95195b07f..5ef683338 100644 --- a/src/pocketmine/block/HayBale.php +++ b/src/pocketmine/block/HayBale.php @@ -31,14 +31,14 @@ class HayBale extends Solid{ } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 0, 1 => 0, 2 => 0b1000, 3 => 0b1000, 4 => 0b0100, 5 => 0b0100, - ); + ]; $this->meta = ($this->meta & 0x03) | $faces[$face]; $this->getLevel()->setBlock($block, $this, true, false, true); @@ -47,9 +47,9 @@ class HayBale extends Solid{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Iron.php b/src/pocketmine/block/Iron.php index 90f06d2b1..d507ac7c6 100644 --- a/src/pocketmine/block/Iron.php +++ b/src/pocketmine/block/Iron.php @@ -44,9 +44,9 @@ class Iron extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 3){ - return array( - array(Item::IRON_BLOCK, 0, 1), - ); + return [ + [Item::IRON_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/IronDoor.php b/src/pocketmine/block/IronDoor.php index f0e570b87..45e91bb06 100644 --- a/src/pocketmine/block/IronDoor.php +++ b/src/pocketmine/block/IronDoor.php @@ -49,9 +49,9 @@ class IronDoor extends Door{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::IRON_DOOR, 0, 1), - ); + return [ + [Item::IRON_DOOR, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/IronOre.php b/src/pocketmine/block/IronOre.php index f3af7c45e..a4a52a227 100644 --- a/src/pocketmine/block/IronOre.php +++ b/src/pocketmine/block/IronOre.php @@ -44,9 +44,9 @@ class IronOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 3){ - return array( - array(Item::IRON_ORE, 0, 1), - ); + return [ + [Item::IRON_ORE, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/JungleWoodStairs.php b/src/pocketmine/block/JungleWoodStairs.php index 3706548e8..9bc3bdeeb 100644 --- a/src/pocketmine/block/JungleWoodStairs.php +++ b/src/pocketmine/block/JungleWoodStairs.php @@ -29,8 +29,8 @@ class JungleWoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Ladder.php b/src/pocketmine/block/Ladder.php index 1814d1ccc..1e74d8573 100644 --- a/src/pocketmine/block/Ladder.php +++ b/src/pocketmine/block/Ladder.php @@ -40,12 +40,12 @@ class Ladder extends Transparent{ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ if($target->isTransparent === false){ - $faces = array( + $faces = [ 2 => 2, 3 => 3, 4 => 4, 5 => 5, - ); + ]; if(isset($faces[$face])){ $this->meta = $faces[$face]; $this->getLevel()->setBlock($block, $this, true, false, true); @@ -70,8 +70,8 @@ class Ladder extends Transparent{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Lapis.php b/src/pocketmine/block/Lapis.php index 5c160f94f..b2db19713 100644 --- a/src/pocketmine/block/Lapis.php +++ b/src/pocketmine/block/Lapis.php @@ -44,9 +44,9 @@ class Lapis extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 3){ - return array( - array(Item::LAPIS_BLOCK, 0, 1), - ); + return [ + [Item::LAPIS_BLOCK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/LapisOre.php b/src/pocketmine/block/LapisOre.php index ff1a69b38..eee6d45ad 100644 --- a/src/pocketmine/block/LapisOre.php +++ b/src/pocketmine/block/LapisOre.php @@ -45,9 +45,9 @@ class LapisOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 3){ - return array( - array(Item::DYE, 4, mt_rand(4, 8)), - ); + return [ + [Item::DYE, 4, mt_rand(4, 8)], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Leaves.php b/src/pocketmine/block/Leaves.php index 238e6b0a9..a9e176725 100644 --- a/src/pocketmine/block/Leaves.php +++ b/src/pocketmine/block/Leaves.php @@ -35,12 +35,12 @@ class Leaves extends Transparent{ public function __construct($meta = 0){ parent::__construct(self::LEAVES, $meta, "Leaves"); - $names = array( + $names = [ self::OAK => "Oak Leaves", self::SPRUCE => "Spruce Leaves", self::BIRCH => "Birch Leaves", self::JUNGLE => "Jungle Leaves", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 1; } @@ -148,13 +148,13 @@ class Leaves extends Transparent{ public function getDrops(Item $item){ $drops = []; if($item->isShears()){ - $drops[] = array(Item::LEAVES, $this->meta & 0x03, 1); + $drops[] = [Item::LEAVES, $this->meta & 0x03, 1]; }else{ if(mt_rand(1, 20) === 1){ //Saplings - $drops[] = array(Item::SAPLING, $this->meta & 0x03, 1); + $drops[] = [Item::SAPLING, $this->meta & 0x03, 1]; } if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples - $drops[] = array(Item::APPLE, 0, 1); + $drops[] = [Item::APPLE, 0, 1]; } } diff --git a/src/pocketmine/block/Leaves2.php b/src/pocketmine/block/Leaves2.php index 8c7eb16e7..f065b601e 100644 --- a/src/pocketmine/block/Leaves2.php +++ b/src/pocketmine/block/Leaves2.php @@ -29,10 +29,10 @@ class Leaves2 extends Leaves{ public function __construct($meta = 0){ Transparent::__construct(self::LEAVES, $meta, "Leaves"); - $names = array( + $names = [ self::ACACIA => "Acacia Leaves", self::DARK_OAK => "Dark Oak Leaves", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 1; } @@ -137,10 +137,10 @@ class Leaves2 extends Leaves{ public function getDrops(Item $item){ $drops = []; if($item->isShears()){ - $drops[] = array(Item::LEAVES2, $this->meta & 0x03, 1); + $drops[] = [Item::LEAVES2, $this->meta & 0x03, 1]; }else{ if(mt_rand(1, 20) === 1){ //Saplings - $drops[] = array(Item::SAPLING, $this->meta & 0x03, 1); + $drops[] = [Item::SAPLING, $this->meta & 0x03, 1]; } } diff --git a/src/pocketmine/block/Melon.php b/src/pocketmine/block/Melon.php index 8a9bc5d56..1a661ee7e 100644 --- a/src/pocketmine/block/Melon.php +++ b/src/pocketmine/block/Melon.php @@ -30,8 +30,8 @@ class Melon extends Transparent{ } public function getDrops(Item $item){ - return array( - array(Item::MELON_SLICE, 0, mt_rand(3, 7)), - ); + return [ + [Item::MELON_SLICE, 0, mt_rand(3, 7)], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/MelonStem.php b/src/pocketmine/block/MelonStem.php index 80bac0a9a..14d49d4cd 100644 --- a/src/pocketmine/block/MelonStem.php +++ b/src/pocketmine/block/MelonStem.php @@ -99,8 +99,8 @@ class MelonStem extends Flowable{ } public function getDrops(Item $item){ - return array( - array(Item::MELON_SEEDS, 0, mt_rand(0, 2)), - ); + return [ + [Item::MELON_SEEDS, 0, mt_rand(0, 2)], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/MossStone.php b/src/pocketmine/block/MossStone.php index 0217df5bf..ea33095d0 100644 --- a/src/pocketmine/block/MossStone.php +++ b/src/pocketmine/block/MossStone.php @@ -49,9 +49,9 @@ class MossStone extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::MOSS_STONE, $this->meta, 1), - ); + return [ + [Item::MOSS_STONE, $this->meta, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/NetherBrick.php b/src/pocketmine/block/NetherBrick.php index fe6f73da4..8c8e0995d 100644 --- a/src/pocketmine/block/NetherBrick.php +++ b/src/pocketmine/block/NetherBrick.php @@ -49,9 +49,9 @@ class NetherBrick extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::NETHER_BRICKS, 0, 1), - ); + return [ + [Item::NETHER_BRICKS, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Netherrack.php b/src/pocketmine/block/Netherrack.php index da6687486..d15c89523 100644 --- a/src/pocketmine/block/Netherrack.php +++ b/src/pocketmine/block/Netherrack.php @@ -49,9 +49,9 @@ class Netherrack extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::NETHERRACK, 0, 1), - ); + return [ + [Item::NETHERRACK, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Obsidian.php b/src/pocketmine/block/Obsidian.php index 396515aab..9adb00215 100644 --- a/src/pocketmine/block/Obsidian.php +++ b/src/pocketmine/block/Obsidian.php @@ -40,9 +40,9 @@ class Obsidian extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 5){ - return array( - array(Item::OBSIDIAN, 0, 1), - ); + return [ + [Item::OBSIDIAN, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Planks.php b/src/pocketmine/block/Planks.php index 946347abe..8a1003359 100644 --- a/src/pocketmine/block/Planks.php +++ b/src/pocketmine/block/Planks.php @@ -32,14 +32,14 @@ class Planks extends Solid{ public function __construct($meta = 0){ parent::__construct(self::PLANKS, $meta, "Wood Planks"); - $names = array( + $names = [ self::OAK => "Oak Wood Planks", self::SPRUCE => "Spruce Wood Planks", self::BIRCH => "Birch Wood Planks", self::JUNGLE => "Jungle Wood Planks", self::ACACIA => "Acacia Wood Planks", self::DARK_OAK => "Jungle Wood Planks", - ); + ]; $this->name = $names[$this->meta & 0x07]; $this->hardness = 15; } diff --git a/src/pocketmine/block/Potato.php b/src/pocketmine/block/Potato.php index d14df4001..a9d942ef4 100644 --- a/src/pocketmine/block/Potato.php +++ b/src/pocketmine/block/Potato.php @@ -89,9 +89,9 @@ class Potato extends Flowable{ public function getDrops(Item $item){ $drops = []; if($this->meta >= 0x07){ - $drops[] = array(Item::POTATO, 0, mt_rand(1, 4)); + $drops[] = [Item::POTATO, 0, mt_rand(1, 4)]; }else{ - $drops[] = array(Item::POTATO, 0, 1); + $drops[] = [Item::POTATO, 0, 1]; } return $drops; diff --git a/src/pocketmine/block/PumpkinStem.php b/src/pocketmine/block/PumpkinStem.php index 69efbdf6d..a21cb3ba6 100644 --- a/src/pocketmine/block/PumpkinStem.php +++ b/src/pocketmine/block/PumpkinStem.php @@ -100,8 +100,8 @@ class PumpkinStem extends Flowable{ } public function getDrops(Item $item){ - return array( - array(Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)), - ); + return [ + [Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Quartz.php b/src/pocketmine/block/Quartz.php index 39a2019a1..d60376f7d 100644 --- a/src/pocketmine/block/Quartz.php +++ b/src/pocketmine/block/Quartz.php @@ -26,12 +26,12 @@ use pocketmine\item\Item; class Quartz extends Solid{ public function __construct($meta = 0){ parent::__construct(self::QUARTZ_BLOCK, $meta, "Quartz Block"); - $names = array( + $names = [ 0 => "Quartz Block", 1 => "Chiseled Quartz Block", 2 => "Quartz Pillar", 3 => "Quartz Pillar", - ); + ]; $this->name = $names[$this->meta & 0x03]; } @@ -55,9 +55,9 @@ class Quartz extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::QUARTZ_BLOCK, $this->meta & 0x03, 1), - ); + return [ + [Item::QUARTZ_BLOCK, $this->meta & 0x03, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index fd537cee6..3954e9e50 100644 --- a/src/pocketmine/block/RedstoneOre.php +++ b/src/pocketmine/block/RedstoneOre.php @@ -42,9 +42,9 @@ class RedstoneOre extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 2){ - return array( - array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)), - ); + return [ + [Item::REDSTONE_DUST, 0, mt_rand(4, 5)], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Sandstone.php b/src/pocketmine/block/Sandstone.php index b25cb0289..fa046ff7e 100644 --- a/src/pocketmine/block/Sandstone.php +++ b/src/pocketmine/block/Sandstone.php @@ -26,11 +26,11 @@ use pocketmine\item\Item; class Sandstone extends Solid{ public function __construct($meta = 0){ parent::__construct(self::SANDSTONE, $meta, "Sandstone"); - $names = array( + $names = [ 0 => "Sandstone", 1 => "Chiseled Sandstone", 2 => "Smooth Sandstone", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 4; } @@ -55,9 +55,9 @@ class Sandstone extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::SANDSTONE, $this->meta & 0x03, 1), - ); + return [ + [Item::SANDSTONE, $this->meta & 0x03, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index bb5f3014d..833424145 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -37,14 +37,14 @@ class Sapling extends Flowable{ public function __construct($meta = Sapling::OAK){ parent::__construct(self::SAPLING, $meta, "Sapling"); $this->isActivable = true; - $names = array( + $names = [ 0 => "Oak Sapling", 1 => "Spruce Sapling", 2 => "Birch Sapling", 3 => "Jungle Sapling", 4 => "Acacia Sapling", 5 => "Dark Oak Sapling", - ); + ]; $this->name = $names[$this->meta & 0x07]; $this->hardness = 0; } @@ -107,8 +107,8 @@ class Sapling extends Flowable{ } public function getDrops(Item $item){ - return array( - array($this->id, $this->meta & 0x07, 1), - ); + return [ + [$this->id, $this->meta & 0x07, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/SignPost.php b/src/pocketmine/block/SignPost.php index 56f45b257..f744571a6 100644 --- a/src/pocketmine/block/SignPost.php +++ b/src/pocketmine/block/SignPost.php @@ -40,12 +40,12 @@ class SignPost extends Transparent{ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ if($face !== 0){ - $faces = array( + $faces = [ 2 => 2, 3 => 3, 4 => 4, 5 => 5, - ); + ]; if(!isset($faces[$face])){ $this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0F; $this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true, false, true); @@ -83,8 +83,8 @@ class SignPost extends Transparent{ } public function getDrops(Item $item){ - return array( - array(Item::SIGN, 0, 1), - ); + return [ + [Item::SIGN, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Slab.php b/src/pocketmine/block/Slab.php index 3cb15e215..223ec9b85 100644 --- a/src/pocketmine/block/Slab.php +++ b/src/pocketmine/block/Slab.php @@ -27,7 +27,7 @@ use pocketmine\Player; class Slab extends Transparent{ public function __construct($meta = 0){ parent::__construct(self::SLAB, $meta, "Slab"); - $names = array( + $names = [ 0 => "Stone", 1 => "Sandstone", 2 => "Wooden", @@ -36,7 +36,7 @@ class Slab extends Transparent{ 5 => "Stone Brick", 6 => "Quartz", 7 => "", - ); + ]; $this->name = (($this->meta & 0x08) === 0x08 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab"; if(($this->meta & 0x08) === 0x08){ $this->isFullBlock = true; @@ -116,9 +116,9 @@ class Slab extends Transparent{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array($this->id, $this->meta & 0x07, 1), - ); + return [ + [$this->id, $this->meta & 0x07, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/SnowLayer.php b/src/pocketmine/block/SnowLayer.php index f434ee839..635a3557a 100644 --- a/src/pocketmine/block/SnowLayer.php +++ b/src/pocketmine/block/SnowLayer.php @@ -64,9 +64,9 @@ class SnowLayer extends Flowable{ public function getDrops(Item $item){ if($item->isShovel() !== false){ - return array( - array(Item::SNOWBALL, 0, 1), - ); + return [ + [Item::SNOWBALL, 0, 1], + ]; } return []; diff --git a/src/pocketmine/block/SpruceWoodStairs.php b/src/pocketmine/block/SpruceWoodStairs.php index 22bb4f2fe..0c06f3f03 100644 --- a/src/pocketmine/block/SpruceWoodStairs.php +++ b/src/pocketmine/block/SpruceWoodStairs.php @@ -29,8 +29,8 @@ class SpruceWoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/StainedClay.php b/src/pocketmine/block/StainedClay.php index 1eaa041e6..9be2c33e4 100644 --- a/src/pocketmine/block/StainedClay.php +++ b/src/pocketmine/block/StainedClay.php @@ -26,7 +26,7 @@ use pocketmine\item\Item; class StainedClay extends Solid{ public function __construct($meta = 0){ parent::__construct(self::STAINED_CLAY, $meta, "Stained Clay"); - $names = array( + $names = [ 0 => "White Stained Clay", 1 => "Orange Stained Clay", 2 => "Magenta Stained Clay", @@ -43,7 +43,7 @@ class StainedClay extends Solid{ 13 => "Green Stained Clay", 14 => "Red Stained Clay", 15 => "Black Stained Clay", - ); + ]; $this->name = $names[$this->meta]; $this->hardness = 30; } diff --git a/src/pocketmine/block/Stair.php b/src/pocketmine/block/Stair.php index 72a77097c..8da691a0d 100644 --- a/src/pocketmine/block/Stair.php +++ b/src/pocketmine/block/Stair.php @@ -37,12 +37,12 @@ class Stair extends Transparent{ } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 0, 1 => 2, 2 => 1, 3 => 3, - ); + ]; $this->meta = $faces[$player->getDirection()] & 0x03; if(($fy > 0.5 and $face !== 1) or $face === 0){ $this->meta |= 0x04; //Upside-down stairs @@ -54,9 +54,9 @@ class Stair extends Transparent{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Stone.php b/src/pocketmine/block/Stone.php index 6044a7bed..396cd5b3c 100644 --- a/src/pocketmine/block/Stone.php +++ b/src/pocketmine/block/Stone.php @@ -68,9 +68,9 @@ class Stone extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::COBBLESTONE, 0, 1), - ); + return [ + [Item::COBBLESTONE, 0, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/StoneBricks.php b/src/pocketmine/block/StoneBricks.php index 28aa66664..5a776cd72 100644 --- a/src/pocketmine/block/StoneBricks.php +++ b/src/pocketmine/block/StoneBricks.php @@ -26,12 +26,12 @@ use pocketmine\item\Item; class StoneBricks extends Solid{ public function __construct($meta = 0){ parent::__construct(self::STONE_BRICKS, $meta, "Stone Bricks"); - $names = array( + $names = [ 0 => "Stone Bricks", 1 => "Mossy Stone Bricks", 2 => "Cracked Stone Bricks", 3 => "Chiseled Stone Bricks", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 30; } @@ -56,9 +56,9 @@ class StoneBricks extends Solid{ public function getDrops(Item $item){ if($item->isPickaxe() >= 1){ - return array( - array(Item::STONE_BRICKS, $this->meta & 0x03, 1), - ); + return [ + [Item::STONE_BRICKS, $this->meta & 0x03, 1], + ]; }else{ return []; } diff --git a/src/pocketmine/block/Stonecutter.php b/src/pocketmine/block/Stonecutter.php index 17da9731e..6a32b788b 100644 --- a/src/pocketmine/block/Stonecutter.php +++ b/src/pocketmine/block/Stonecutter.php @@ -40,8 +40,8 @@ class Stonecutter extends Solid{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index ca3421950..3b6429299 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -38,9 +38,9 @@ class Sugarcane extends Flowable{ public function getDrops(Item $item){ - return array( - array(Item::SUGARCANE, 0, 1), - ); + return [ + [Item::SUGARCANE, 0, 1], + ]; } public function onActivate(Item $item, Player $player = null){ diff --git a/src/pocketmine/block/TNT.php b/src/pocketmine/block/TNT.php index bb207826f..0e52a8dcf 100644 --- a/src/pocketmine/block/TNT.php +++ b/src/pocketmine/block/TNT.php @@ -36,13 +36,13 @@ class TNT extends Solid{ if(($player->gamemode & 0x01) === 0){ $item->useOn($this); } - $data = array( + $data = [ "x" => $this->x + 0.5, "y" => $this->y + 0.5, "z" => $this->z + 0.5, "power" => 4, "fuse" => 20 * 4, //4 seconds - ); + ]; $this->getLevel()->setBlock($this, new Air(), false, false, true); //TODO //$e = Server::getInstance()->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data); diff --git a/src/pocketmine/block/TallGrass.php b/src/pocketmine/block/TallGrass.php index 5dfb950ee..f9d25e98c 100644 --- a/src/pocketmine/block/TallGrass.php +++ b/src/pocketmine/block/TallGrass.php @@ -28,11 +28,11 @@ class TallGrass extends Flowable{ public function __construct($meta = 1){ parent::__construct(self::TALL_GRASS, $meta, "Tall Grass"); $this->isReplaceable = true; - $names = array( + $names = [ 0 => "Dead Shrub", 1 => "Tall Grass", 2 => "Fern", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 0; } diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index d93c916a9..7d46a1b21 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -39,7 +39,7 @@ class Torch extends Flowable{ public function onUpdate($type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $side = $this->getDamage(); - $faces = array( + $faces = [ 1 => 4, 2 => 5, 3 => 2, @@ -47,7 +47,7 @@ class Torch extends Flowable{ 5 => 0, 6 => 0, 0 => 0, - ); + ]; if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === self::FENCE)){ //Replace with common break method //TODO @@ -63,13 +63,13 @@ class Torch extends Flowable{ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ if($target->isTransparent === false and $face !== 0){ - $faces = array( + $faces = [ 1 => 5, 2 => 4, 3 => 3, 4 => 2, 5 => 1, - ); + ]; $this->meta = $faces[$face]; $this->getLevel()->setBlock($block, $this, true, false, true); @@ -85,8 +85,8 @@ class Torch extends Flowable{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Trapdoor.php b/src/pocketmine/block/Trapdoor.php index 75e41415c..da2303af9 100644 --- a/src/pocketmine/block/Trapdoor.php +++ b/src/pocketmine/block/Trapdoor.php @@ -38,12 +38,12 @@ class Trapdoor extends Transparent{ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ if(($target->isTransparent === false or $target->getID() === self::SLAB) and $face !== 0 and $face !== 1){ - $faces = array( + $faces = [ 2 => 0, 3 => 1, 4 => 2, 5 => 3, - ); + ]; $this->meta = $faces[$face] & 0x03; if($fy > 0.5){ $this->meta |= 0x08; @@ -57,9 +57,9 @@ class Trapdoor extends Transparent{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } public function onActivate(Item $item, Player $player = null){ diff --git a/src/pocketmine/block/Wheat.php b/src/pocketmine/block/Wheat.php index 8e9d6390b..89735e3c8 100644 --- a/src/pocketmine/block/Wheat.php +++ b/src/pocketmine/block/Wheat.php @@ -86,10 +86,10 @@ class Wheat extends Flowable{ public function getDrops(Item $item){ $drops = []; if($this->meta >= 0x07){ - $drops[] = array(Item::WHEAT, 0, 1); - $drops[] = array(Item::WHEAT_SEEDS, 0, mt_rand(0, 3)); + $drops[] = [Item::WHEAT, 0, 1]; + $drops[] = [Item::WHEAT_SEEDS, 0, mt_rand(0, 3)]; }else{ - $drops[] = array(Item::WHEAT_SEEDS, 0, 1); + $drops[] = [Item::WHEAT_SEEDS, 0, 1]; } return $drops; diff --git a/src/pocketmine/block/Wood.php b/src/pocketmine/block/Wood.php index 6b0a0fc32..b7b855e40 100644 --- a/src/pocketmine/block/Wood.php +++ b/src/pocketmine/block/Wood.php @@ -34,25 +34,25 @@ class Wood extends Solid{ public function __construct($meta = 0){ parent::__construct(self::WOOD, $meta, "Wood"); - $names = array( + $names = [ self::OAK => "Oak Wood", self::SPRUCE => "Spruce Wood", self::BIRCH => "Birch Wood", self::JUNGLE => "Jungle Wood", - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 10; } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ - $faces = array( + $faces = [ 0 => 0, 1 => 0, 2 => 0b1000, 3 => 0b1000, 4 => 0b0100, 5 => 0b0100, - ); + ]; $this->meta = ($this->meta & 0x03) | $faces[$face]; $this->getLevel()->setBlock($block, $this, true, false, true); @@ -61,8 +61,8 @@ class Wood extends Solid{ } public function getDrops(Item $item){ - return array( - array($this->id, $this->meta & 0x03, 1), - ); + return [ + [$this->id, $this->meta & 0x03, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Wood2.php b/src/pocketmine/block/Wood2.php index 52d5d89b6..3840f588b 100644 --- a/src/pocketmine/block/Wood2.php +++ b/src/pocketmine/block/Wood2.php @@ -26,10 +26,10 @@ class Wood2 extends Wood{ public function __construct($meta = 0){ Solid::__construct(self::WOOD2, $meta, "Wood"); - $names = array( + $names = [ 0 => "Acacia Wood", 1 => "Dark Oak Wood" - ); + ]; $this->name = $names[$this->meta & 0x03]; $this->hardness = 10; } diff --git a/src/pocketmine/block/WoodDoor.php b/src/pocketmine/block/WoodDoor.php index 2041be6b5..25962e31a 100644 --- a/src/pocketmine/block/WoodDoor.php +++ b/src/pocketmine/block/WoodDoor.php @@ -31,8 +31,8 @@ class WoodDoor extends Door{ } public function getDrops(Item $item){ - return array( - array(Item::WOODEN_DOOR, 0, 1), - ); + return [ + [Item::WOODEN_DOOR, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/WoodSlab.php b/src/pocketmine/block/WoodSlab.php index 8bfb54b56..c16948177 100644 --- a/src/pocketmine/block/WoodSlab.php +++ b/src/pocketmine/block/WoodSlab.php @@ -27,14 +27,14 @@ use pocketmine\Player; class WoodSlab extends Transparent{ public function __construct($meta = 0){ parent::__construct(self::WOOD_SLAB, $meta, "Wooden Slab"); - $names = array( + $names = [ 0 => "Oak", 1 => "Spruce", 2 => "Birch", 3 => "Jungle", 4 => "Acacia", 5 => "Dark Oak", - ); + ]; $this->name = (($this->meta & 0x08) === 0x08 ? "Upper " : "") . $names[$this->meta & 0x07] . " Wooden Slab"; if(($this->meta & 0x08) === 0x08){ $this->isFullBlock = true; @@ -112,8 +112,8 @@ class WoodSlab extends Transparent{ } public function getDrops(Item $item){ - return array( - array($this->id, $this->meta & 0x07, 1), - ); + return [ + [$this->id, $this->meta & 0x07, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/WoodStairs.php b/src/pocketmine/block/WoodStairs.php index 4efe0e701..64f5dc5e3 100644 --- a/src/pocketmine/block/WoodStairs.php +++ b/src/pocketmine/block/WoodStairs.php @@ -47,8 +47,8 @@ class WoodStairs extends Stair{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/block/Wool.php b/src/pocketmine/block/Wool.php index 0285e0ef0..6d7fb3390 100644 --- a/src/pocketmine/block/Wool.php +++ b/src/pocketmine/block/Wool.php @@ -25,7 +25,7 @@ namespace pocketmine\block; class Wool extends Solid{ public function __construct($meta = 0){ parent::__construct(self::WOOL, $meta, "Wool"); - $names = array( + $names = [ 0 => "White Wool", 1 => "Orange Wool", 2 => "Magenta Wool", @@ -42,7 +42,7 @@ class Wool extends Solid{ 13 => "Green Wool", 14 => "Red Wool", 15 => "Black Wool", - ); + ]; $this->name = $names[$this->meta]; $this->hardness = 4; } diff --git a/src/pocketmine/block/Workbench.php b/src/pocketmine/block/Workbench.php index f82d51bba..8b5c287d6 100644 --- a/src/pocketmine/block/Workbench.php +++ b/src/pocketmine/block/Workbench.php @@ -41,8 +41,8 @@ class Workbench extends Solid{ } public function getDrops(Item $item){ - return array( - array($this->id, 0, 1), - ); + return [ + [$this->id, 0, 1], + ]; } } \ No newline at end of file diff --git a/src/pocketmine/entity/Arrow.php b/src/pocketmine/entity/Arrow.php index 50748765e..df29c1990 100644 --- a/src/pocketmine/entity/Arrow.php +++ b/src/pocketmine/entity/Arrow.php @@ -108,7 +108,7 @@ class Arrow extends Projectile{ $flags |= $this->fireTicks > 0 ? 1 : 0; return [ - 0 => array("type" => 0, "value" => $flags) + 0 => ["type" => 0, "value" => $flags] ]; } diff --git a/src/pocketmine/entity/DroppedItem.php b/src/pocketmine/entity/DroppedItem.php index 6bbbdedfd..c825e293d 100644 --- a/src/pocketmine/entity/DroppedItem.php +++ b/src/pocketmine/entity/DroppedItem.php @@ -142,7 +142,7 @@ class DroppedItem extends Entity{ $flags |= $this->fireTicks > 0 ? 1 : 0; return [ - 0 => array("type" => 0, "value" => $flags) + 0 => ["type" => 0, "value" => $flags] ]; } diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index c9cb24c19..a71b5dd1a 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -989,7 +989,7 @@ abstract class Entity extends Position implements Metadatable{ public function setMotion(Vector3 $motion){ if(!$this->justCreated){ - Server::getInstance()->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion)); + $this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion)); if($ev->isCancelled()){ return false; } @@ -1007,6 +1007,8 @@ abstract class Entity extends Position implements Metadatable{ } $this->updateMovement(); } + + return true; } public function isOnGround(){ diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index fd48a1826..354e3121b 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -104,23 +104,23 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ if($hotbarSlot !== -1){ $item = $this->inventory->getItem($hotbarSlot); if($item->getID() !== 0 and $item->getCount() > 0){ - $this->namedtag->Inventory[$slot] = new Compound(false, array( + $this->namedtag->Inventory[$slot] = new Compound(false, [ new Byte("Count", $item->getCount()), new Short("Damage", $item->getDamage()), new Byte("Slot", $slot), new Byte("TrueSlot", $hotbarSlot), new Short("id", $item->getID()), - )); + ]); continue; } } - $this->namedtag->Inventory[$slot] = new Compound(false, array( + $this->namedtag->Inventory[$slot] = new Compound(false, [ new Byte("Count", 0), new Short("Damage", 0), new Byte("Slot", $slot), new Byte("TrueSlot", -1), new Short("id", 0), - )); + ]); } //Normal inventory @@ -128,24 +128,24 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ //$slotCount = (($this instanceof Player and ($this->gamemode & 0x01) === 1) ? Player::CREATIVE_SLOTS : Player::SURVIVAL_SLOTS) + 9; for($slot = 9; $slot < $slotCount; ++$slot){ $item = $this->inventory->getItem($slot - 9); - $this->namedtag->Inventory[$slot] = new Compound(false, array( + $this->namedtag->Inventory[$slot] = new Compound(false, [ new Byte("Count", $item->getCount()), new Short("Damage", $item->getDamage()), new Byte("Slot", $slot), new Short("id", $item->getID()), - )); + ]); } //Armor for($slot = 100; $slot < 104; ++$slot){ $item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100); if($item instanceof Item and $item->getID() !== Item::AIR){ - $this->namedtag->Inventory[$slot] = new Compound(false, array( + $this->namedtag->Inventory[$slot] = new Compound(false, [ new Byte("Count", $item->getCount()), new Short("Damage", $item->getDamage()), new Byte("Slot", $slot), new Short("id", $item->getID()), - )); + ]); } } } @@ -200,12 +200,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $flags |= $this->fireTicks > 0 ? 1 : 0; //$flags |= ($this->crouched === true ? 0b10:0) << 1; //$flags |= ($this->inAction === true ? 0b10000:0); - $d = array( - 0 => array("type" => 0, "value" => $flags), - 1 => array("type" => 1, "value" => $this->airTicks), - 16 => array("type" => 0, "value" => 0), - 17 => array("type" => 6, "value" => array(0, 0, 0)), - ); + $d = [ + 0 => ["type" => 0, "value" => $flags], + 1 => ["type" => 1, "value" => $this->airTicks], + 16 => ["type" => 0, "value" => 0], + 17 => ["type" => 6, "value" => [0, 0, 0]], + ]; /*if($this->class === ENTITY_MOB and $this->type === MOB_SHEEP){ if(!isset($this->data["Sheared"])){ diff --git a/src/pocketmine/entity/Villager.php b/src/pocketmine/entity/Villager.php index 7b045e23a..b2f01cc50 100644 --- a/src/pocketmine/entity/Villager.php +++ b/src/pocketmine/entity/Villager.php @@ -80,12 +80,12 @@ class Villager extends Creature implements NPC, Ageable{ $flags |= $this->fireTicks > 0 ? 1 : 0; //$flags |= ($this->crouched === true ? 0b10:0) << 1; //$flags |= ($this->inAction === true ? 0b10000:0); - $d = array( - 0 => array("type" => 0, "value" => $flags), - 1 => array("type" => 1, "value" => $this->airTicks), - 16 => array("type" => 0, "value" => 0), - 17 => array("type" => 6, "value" => array(0, 0, 0)), - ); + $d = [ + 0 => ["type" => 0, "value" => $flags], + 1 => ["type" => 1, "value" => $this->airTicks], + 16 => ["type" => 0, "value" => 0], + 17 => ["type" => 6, "value" => [0, 0, 0]], + ]; return $d; } diff --git a/src/pocketmine/entity/Zombie.php b/src/pocketmine/entity/Zombie.php index b12956731..5d7c95442 100644 --- a/src/pocketmine/entity/Zombie.php +++ b/src/pocketmine/entity/Zombie.php @@ -71,12 +71,12 @@ class Zombie extends Monster{ $flags |= $this->fireTicks > 0 ? 1 : 0; //$flags |= ($this->crouched === true ? 0b10:0) << 1; //$flags |= ($this->inAction === true ? 0b10000:0); - $d = array( - 0 => array("type" => 0, "value" => $flags), - 1 => array("type" => 1, "value" => $this->airTicks), - 16 => array("type" => 0, "value" => 0), - 17 => array("type" => 6, "value" => array(0, 0, 0)), - ); + $d = [ + 0 => ["type" => 0, "value" => $flags], + 1 => ["type" => 1, "value" => $this->airTicks], + 16 => ["type" => 0, "value" => 0], + 17 => ["type" => 6, "value" => [0, 0, 0]], + ]; return $d; } diff --git a/src/pocketmine/event/HandlerList.php b/src/pocketmine/event/HandlerList.php index 424fa8f98..67fb3efac 100644 --- a/src/pocketmine/event/HandlerList.php +++ b/src/pocketmine/event/HandlerList.php @@ -69,14 +69,14 @@ class HandlerList{ } public function __construct(){ - $this->handlerSlots = array( + $this->handlerSlots = [ EventPriority::LOWEST => [], EventPriority::LOW => [], EventPriority::NORMAL => [], EventPriority::HIGH => [], EventPriority::HIGHEST => [], EventPriority::MONITOR => [] - ); + ]; self::$allLists[] = $this; } diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index b5675b64a..f4f35360e 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -343,7 +343,7 @@ class CraftingManager{ $this->recipes[spl_object_hash($recipe)] = $recipe; $hash = ""; $ingredients = $recipe->getIngredientList(); - usort($ingredients, array($this, "sort")); + usort($ingredients, [$this, "sort"]); foreach($ingredients as $item){ $hash .= $item->getID() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ","; } @@ -376,7 +376,7 @@ class CraftingManager{ } $hash = ""; $input = $ts->getRecipe(); - usort($input, array($this, "sort")); + usort($input, [$this, "sort"]); $inputCount = 0; foreach($input as $item){ $inputCount += $item->getCount(); diff --git a/src/pocketmine/inventory/Fuel.php b/src/pocketmine/inventory/Fuel.php index 352afb300..30249cb2d 100644 --- a/src/pocketmine/inventory/Fuel.php +++ b/src/pocketmine/inventory/Fuel.php @@ -25,7 +25,7 @@ use pocketmine\item\Item; //TODO: remove this abstract class Fuel{ - public static $duration = array( + public static $duration = [ Item::COAL => 80, Item::COAL_BLOCK => 800, Item::TRUNK => 15, @@ -49,6 +49,6 @@ abstract class Fuel{ Item::CHEST => 15, Item::BUCKET => 1000, - ); + ]; } \ No newline at end of file diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index d1ba1b96a..a6035ea27 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -392,7 +392,7 @@ class Item{ public static function init(){ if(count(self::$list) === 0){ - self::$list = array( + self::$list = [ self::SUGARCANE => Sugarcane::class, self::WHEAT_SEEDS => WheatSeeds::class, self::PUMPKIN_SEEDS => PumpkinSeeds::class, @@ -447,7 +447,7 @@ class Item{ self::FLINT_STEEL => FlintSteel::class, self::SHEARS => Shears::class, self::BOW => Bow::class, - ); + ]; foreach(Block::$list as $id => $class){ self::$list[$id] = $class; } diff --git a/src/pocketmine/item/Painting.php b/src/pocketmine/item/Painting.php index 76e1c72a5..50df3ef79 100644 --- a/src/pocketmine/item/Painting.php +++ b/src/pocketmine/item/Painting.php @@ -34,50 +34,50 @@ class Painting extends Item{ public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($target->isTransparent === false and $face > 1 and $block->isSolid === false){ - $faces = array( + $faces = [ 2 => 1, 3 => 3, 4 => 0, 5 => 2, - ); - $motives = array( + ]; + $motives = [ // Motive Width Height - array("Kebab", 1, 1), - array("Aztec", 1, 1), - array("Alban", 1, 1), - array("Aztec2", 1, 1), - array("Bomb", 1, 1), - array("Plant", 1, 1), - array("Wasteland", 1, 1), - array("Wanderer", 1, 2), - array("Graham", 1, 2), - array("Pool", 2, 1), - array("Courbet", 2, 1), - array("Sunset", 2, 1), - array("Sea", 2, 1), - array("Creebet", 2, 1), - array("Match", 2, 2), - array("Bust", 2, 2), - array("Stage", 2, 2), - array("Void", 2, 2), - array("SkullAndRoses", 2, 2), + ["Kebab", 1, 1], + ["Aztec", 1, 1], + ["Alban", 1, 1], + ["Aztec2", 1, 1], + ["Bomb", 1, 1], + ["Plant", 1, 1], + ["Wasteland", 1, 1], + ["Wanderer", 1, 2], + ["Graham", 1, 2], + ["Pool", 2, 1], + ["Courbet", 2, 1], + ["Sunset", 2, 1], + ["Sea", 2, 1], + ["Creebet", 2, 1], + ["Match", 2, 2], + ["Bust", 2, 2], + ["Stage", 2, 2], + ["Void", 2, 2], + ["SkullAndRoses", 2, 2], //array("Wither", 2, 2), - array("Fighters", 4, 2), - array("Skeleton", 4, 3), - array("DonkeyKong", 4, 3), - array("Pointer", 4, 4), - array("Pigscene", 4, 4), - array("Flaming Skull", 4, 4), - ); + ["Fighters", 4, 2], + ["Skeleton", 4, 3], + ["DonkeyKong", 4, 3], + ["Pointer", 4, 4], + ["Pigscene", 4, 4], + ["Flaming Skull", 4, 4], + ]; $motive = $motives[mt_rand(0, count($motives) - 1)]; - $data = array( + $data = [ "x" => $target->x, "y" => $target->y, "z" => $target->z, "yaw" => $faces[$face] * 90, "Motive" => $motive[0], - ); + ]; //TODO //$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data); //$e->spawnToAll(); diff --git a/src/pocketmine/item/Tool.php b/src/pocketmine/item/Tool.php index 5eece0020..30016b2b3 100644 --- a/src/pocketmine/item/Tool.php +++ b/src/pocketmine/item/Tool.php @@ -60,7 +60,7 @@ abstract class Tool extends Item{ */ public function getMaxDurability(){ - $levels = array( + $levels = [ 2 => 33, 1 => 60, 3 => 132, @@ -69,7 +69,7 @@ abstract class Tool extends Item{ self::FLINT_STEEL => 65, self::SHEARS => 239, self::BOW => 385, - ); + ]; if(($type = $this->isPickaxe()) === false){ if(($type = $this->isAxe()) === false){ diff --git a/src/pocketmine/level/Explosion.php b/src/pocketmine/level/Explosion.php index 733bba7d4..b2b9f9ab3 100644 --- a/src/pocketmine/level/Explosion.php +++ b/src/pocketmine/level/Explosion.php @@ -31,13 +31,13 @@ use pocketmine\network\protocol\ExplodePacket; use pocketmine\Server; class Explosion{ - public static $specialDrops = array( + public static $specialDrops = [ Item::GRASS => Item::DIRT, Item::STONE => Item::COBBLESTONE, Item::COAL_ORE => Item::COAL, Item::DIAMOND_ORE => Item::DIAMOND, Item::REDSTONE_ORE => Item::REDSTONE, - ); + ]; private $rays = 16; //Rays public $level; public $source; @@ -119,13 +119,13 @@ class Explosion{ foreach($this->affectedBlocks as $block){ if($block instanceof TNT){ - $data = array( + $data = [ "x" => $block->x + 0.5, "y" => $block->y + 0.5, "z" => $block->z + 0.5, "power" => 4, "fuse" => mt_rand(10, 30), //0.5 to 1.5 seconds - ); + ]; //TODO //$e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data); //$e->spawnToAll(); diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 1b30731b3..b52e4d64b 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1038,16 +1038,16 @@ class Level implements ChunkManager, Metadatable{ } if($hand->getID() === Item::SIGN_POST or $hand->getID() === Item::WALL_SIGN){ - $tile = new Sign($this->getChunkAt($block->x >> 4, $block->z >> 4), new Compound(false, array( - new String("id", Tile::SIGN), - new Int("x", $block->x), - new Int("y", $block->y), - new Int("z", $block->z), - new String("Text1", ""), - new String("Text2", ""), - new String("Text3", ""), - new String("Text4", "") - ))); + $tile = new Sign($this->getChunkAt($block->x >> 4, $block->z >> 4), new Compound(false, [ + "id" => new String("id", Tile::SIGN), + "x" => new Int("x", $block->x), + "y" => new Int("y", $block->y), + "z" => new Int("z", $block->z), + "Text1" => new String("Text1", ""), + "Text2" => new String("Text2", ""), + "Text3" => new String("Text3", ""), + "Text4" => new String("Text4", "") + ])); if($player instanceof Player){ $tile->namedtag->Creator = new String("Creator", $player->getName()); } diff --git a/src/pocketmine/level/LevelImport.php b/src/pocketmine/level/LevelImport.php index e9297aab6..9dbc13ea5 100644 --- a/src/pocketmine/level/LevelImport.php +++ b/src/pocketmine/level/LevelImport.php @@ -66,7 +66,7 @@ class LevelImport{ return false; } - $pmf = new LevelFormat($this->path . "level.pmf", array( + $pmf = new LevelFormat($this->path . "level.pmf", [ "name" => $level->LevelName, "seed" => $level->RandomSeed, "time" => $level->Time, @@ -77,13 +77,13 @@ class LevelImport{ "generator" => "default", "generatorSettings" => "", "extra" => "" - )); + ]); $chunks = new PocketChunkParser(); $chunks->loadFile($this->path . "chunks.dat"); $chunks->loadMap(); for($Z = 0; $Z < 16; ++$Z){ for($X = 0; $X < 16; ++$X){ - $chunk = array( + $chunk = [ 0 => "", 1 => "", 2 => "", @@ -92,7 +92,7 @@ class LevelImport{ 5 => "", 6 => "", 7 => "" - ); + ]; $pmf->initCleanChunk($X, $Z); for($z = 0; $z < 16; ++$z){ diff --git a/src/pocketmine/level/conversor/pmf/LevelFormat.php b/src/pocketmine/level/conversor/pmf/LevelFormat.php index 2089a9e94..a0f1696f0 100644 --- a/src/pocketmine/level/conversor/pmf/LevelFormat.php +++ b/src/pocketmine/level/conversor/pmf/LevelFormat.php @@ -188,10 +188,10 @@ class LevelFormat extends PMF{ private function upgrade_From1_To2(){ MainLogger::getLogger()->notice("Old PMF Level format version #1 detected, upgrading to version #2"); - $nbt = new Compound("", array( + $nbt = new Compound("", [ new Enum("Entities", []), new Enum("TileEntities", []) - )); + ]); $nbt->Entities->setTagType(NBT::TAG_Compound); $nbt->TileEntities->setTagType(NBT::TAG_Compound); $nbtCodec = new NBT(NBT::BIG_ENDIAN); @@ -217,7 +217,7 @@ class LevelFormat extends PMF{ $Z = $index >> 16; $X = ($index & 0x8000) === 0x8000 ? -($index & 0x7fff) : $index & 0x7fff; - return array($X, $Z); + return [$X, $Z]; } private function getChunkPath($X, $Z){ @@ -290,10 +290,10 @@ class LevelFormat extends PMF{ $chunk = zlib_decode($chunk); $offset = 0; - $this->chunkInfo[$index] = array( + $this->chunkInfo[$index] = [ 0 => ord($chunk{0}), 1 => Binary::readInt(substr($chunk, 1, 4)), - ); + ]; $offset += 5; $len = Binary::readInt(substr($chunk, $offset, 4)); $offset += 4; @@ -302,7 +302,7 @@ class LevelFormat extends PMF{ $this->chunkInfo[$index][2] = $nbt->getData(); $offset += $len; $this->chunks[$index] = []; - $this->chunkChange[$index] = array(-1 => false); + $this->chunkChange[$index] = [-1 => false]; $this->chunkInfo[$index][3] = substr($chunk, $offset, 256); //Biome data $offset += 256; for($Y = 0; $Y < 8; ++$Y){ @@ -399,7 +399,7 @@ class LevelFormat extends PMF{ public function initCleanChunk($X, $Z){ $index = self::getIndex($X, $Z); if(!isset($this->chunks[$index])){ - $this->chunks[$index] = array( + $this->chunks[$index] = [ 0 => false, 1 => false, 2 => false, @@ -408,8 +408,8 @@ class LevelFormat extends PMF{ 5 => false, 6 => false, 7 => false, - ); - $this->chunkChange[$index] = array( + ]; + $this->chunkChange[$index] = [ -1 => true, 0 => 8192, 1 => 8192, @@ -419,19 +419,19 @@ class LevelFormat extends PMF{ 5 => 8192, 6 => 8192, 7 => 8192, - ); - $nbt = new Compound("", array( + ]; + $nbt = new Compound("", [ new Enum("Entities", []), new Enum("TileEntities", []) - )); + ]); $nbt->Entities->setTagType(NBT::TAG_Compound); $nbt->TileEntities->setTagType(NBT::TAG_Compound); - $this->chunkInfo[$index] = array( + $this->chunkInfo[$index] = [ 0 => 0, 1 => 0, 2 => $nbt, 3 => str_repeat("\x00", 256), - ); + ]; } } @@ -593,13 +593,13 @@ class LevelFormat extends PMF{ $Z = $z >> 4; $Y = $y >> 4; if($y < 0 or $y > 127){ - return array(0, 0); + return [0, 0]; } $index = self::getIndex($X, $Z); if(!isset($this->chunks[$index]) and $this->loadChunk($X, $Z) === false){ - return array(0, 0); + return [0, 0]; }elseif($this->chunks[$index][$Y] === false){ - return array(0, 0); + return [0, 0]; } $aX = $x - ($X << 4); $aZ = $z - ($Z << 4); @@ -612,7 +612,7 @@ class LevelFormat extends PMF{ $m = $m >> 4; } - return array($b, $m); + return [$b, $m]; } public function setBlock($x, $y, $z, $block, $meta = 0){ diff --git a/src/pocketmine/level/format/PocketChunkParser.php b/src/pocketmine/level/format/PocketChunkParser.php index 70cb99c7e..9a1533a6a 100644 --- a/src/pocketmine/level/format/PocketChunkParser.php +++ b/src/pocketmine/level/format/PocketChunkParser.php @@ -113,12 +113,12 @@ class PocketChunkParser{ $offset = $this->getOffset($X, $Z); $len = Binary::readLInt(substr($this->raw, $offset, 4)); $offset += 4; - $chunk = array( + $chunk = [ 0 => [], //Block 1 => [], //Data 2 => [], //SkyLight 3 => [], //BlockLight - ); + ]; foreach($chunk as $section => &$data){ $l = $section === 0 ? 128 : 64; for($i = 0; $i < 256; ++$i){ @@ -198,7 +198,7 @@ class PocketChunkParser{ $meta = $meta >> 4; } - return array($block, $meta); + return [$block, $meta]; } public function getChunkColumn($X, $Z, $x, $z, $type = 0){ diff --git a/src/pocketmine/level/format/anvil/Chunk.php b/src/pocketmine/level/format/anvil/Chunk.php index f93e6fcd5..80e0453fc 100644 --- a/src/pocketmine/level/format/anvil/Chunk.php +++ b/src/pocketmine/level/format/anvil/Chunk.php @@ -192,7 +192,7 @@ class Chunk extends BaseChunk{ $nbt->Entities->setTagType(NBT::TAG_Compound); $writer = new NBT(NBT::BIG_ENDIAN); $nbt->setName("Level"); - $writer->setData(new Compound("", array("Level" => $nbt))); + $writer->setData(new Compound("", ["Level" => $nbt])); return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL); } diff --git a/src/pocketmine/level/format/anvil/RegionLoader.php b/src/pocketmine/level/format/anvil/RegionLoader.php index ff82aeea2..d95ac6f53 100644 --- a/src/pocketmine/level/format/anvil/RegionLoader.php +++ b/src/pocketmine/level/format/anvil/RegionLoader.php @@ -132,7 +132,7 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{ $nbt->TileTicks->setTagType(NBT::TAG_Compound); $writer = new NBT(NBT::BIG_ENDIAN); $nbt->setName("Level"); - $writer->setData(new Compound("", array("Level" => $nbt))); + $writer->setData(new Compound("", ["Level" => $nbt])); $chunkData = $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL); $this->saveChunk($x, $z, $chunkData); } diff --git a/src/pocketmine/level/format/mcregion/Chunk.php b/src/pocketmine/level/format/mcregion/Chunk.php index 2319721d8..84c297b3b 100644 --- a/src/pocketmine/level/format/mcregion/Chunk.php +++ b/src/pocketmine/level/format/mcregion/Chunk.php @@ -298,7 +298,7 @@ class Chunk extends BaseFullChunk{ $nbt->Entities->setTagType(NBT::TAG_Compound); $writer = new NBT(NBT::BIG_ENDIAN); $nbt->setName("Level"); - $writer->setData(new Compound("", array("Level" => $nbt))); + $writer->setData(new Compound("", ["Level" => $nbt])); return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL); } diff --git a/src/pocketmine/level/format/mcregion/RegionLoader.php b/src/pocketmine/level/format/mcregion/RegionLoader.php index a62002f76..8b6b40a0e 100644 --- a/src/pocketmine/level/format/mcregion/RegionLoader.php +++ b/src/pocketmine/level/format/mcregion/RegionLoader.php @@ -163,7 +163,7 @@ class RegionLoader{ $nbt->TileTicks->setTagType(NBT::TAG_Compound); $writer = new NBT(NBT::BIG_ENDIAN); $nbt->setName("Level"); - $writer->setData(new Compound("", array("Level" => $nbt))); + $writer->setData(new Compound("", ["Level" => $nbt])); $chunkData = $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, self::$COMPRESSION_LEVEL); $this->saveChunk($x, $z, $chunkData); @@ -212,11 +212,11 @@ class RegionLoader{ $chunk = fread($this->filePointer, $this->locationTable[$i][1] << 12); $length = Binary::readInt(substr($chunk, 0, 4)); if($length <= 1){ - $this->locationTable[$i] = array(0, 0, 0); //Non-generated chunk, remove it from index + $this->locationTable[$i] = [0, 0, 0]; //Non-generated chunk, remove it from index } $chunk = zlib_decode(substr($chunk, 5)); if(strlen($chunk) <= 1){ - $this->locationTable[$i] = array(0, 0, 0); //Corrupted chunk, remove it + $this->locationTable[$i] = [0, 0, 0]; //Corrupted chunk, remove it continue; } $chunk = chr(self::COMPRESSION_ZLIB) . zlib_encode($chunk, 15, 9); @@ -239,7 +239,7 @@ class RegionLoader{ $sectors = []; foreach($this->locationTable as $index => $data){ //Calculate file usage if($data[0] === 0 or $data[1] === 0){ - $this->locationTable[$index] = array(0, 0, 0); + $this->locationTable[$index] = [0, 0, 0]; continue; } for($i = 0; $i < $data[1]; ++$i){ @@ -280,7 +280,7 @@ class RegionLoader{ $table = fread($this->filePointer, 4 * 1024 * 2); for($i = 0; $i < 1024; ++$i){ $index = Binary::readInt(substr($table, $i << 2, 4)); - $this->locationTable[$i] = array(($index & ~0xff) >> 8, $index & 0xff, Binary::readInt(substr($table, 4096 + ($i << 2), 4))); + $this->locationTable[$i] = [($index & ~0xff) >> 8, $index & 0xff, Binary::readInt(substr($table, 4096 + ($i << 2), 4))]; if(($this->locationTable[$i][0] + $this->locationTable[$i][1] - 1) > $this->lastSector){ $this->lastSector = $this->locationTable[$i][0] + $this->locationTable[$i][1] - 1; } @@ -313,7 +313,7 @@ class RegionLoader{ $this->lastSector = 1; $table = ""; for($i = 0; $i < 1024; ++$i){ - $this->locationTable[$i] = array(0, 0); + $this->locationTable[$i] = [0, 0]; $table .= Binary::writeInt(0); } diff --git a/src/pocketmine/level/generator/Flat.php b/src/pocketmine/level/generator/Flat.php index 0270b03df..0b0032c8d 100644 --- a/src/pocketmine/level/generator/Flat.php +++ b/src/pocketmine/level/generator/Flat.php @@ -62,7 +62,7 @@ class Flat extends Generator{ if(isset($this->options["decoration"])){ $ores = new Ore(); - $ores->setOreTypes(array( + $ores->setOreTypes([ new object\OreType(new CoalOre(), 20, 16, 0, 128), new object\OreType(New IronOre(), 20, 8, 0, 64), new object\OreType(new RedstoneOre(), 8, 7, 0, 16), @@ -71,7 +71,7 @@ class Flat extends Generator{ new object\OreType(new DiamondOre(), 1, 7, 0, 16), new object\OreType(new Dirt(), 20, 32, 0, 128), new object\OreType(new Gravel(), 10, 16, 0, 128), - )); + ]); $this->populators[] = $ores; } diff --git a/src/pocketmine/level/generator/Normal.php b/src/pocketmine/level/generator/Normal.php index f68339b73..1ad9305ae 100644 --- a/src/pocketmine/level/generator/Normal.php +++ b/src/pocketmine/level/generator/Normal.php @@ -77,7 +77,7 @@ class Normal extends Generator{ $ores = new Ore(); - $ores->setOreTypes(array( + $ores->setOreTypes([ new OreType(new CoalOre(), 20, 16, 0, 128), new OreType(New IronOre(), 20, 8, 0, 64), new OreType(new RedstoneOre(), 8, 7, 0, 16), @@ -86,7 +86,7 @@ class Normal extends Generator{ new OreType(new DiamondOre(), 1, 7, 0, 16), new OreType(new Dirt(), 20, 32, 0, 128), new OreType(new Gravel(), 10, 16, 0, 128), - )); + ]); $this->populators[] = $ores; $trees = new Tree(); diff --git a/src/pocketmine/level/generator/object/SmallTree.php b/src/pocketmine/level/generator/object/SmallTree.php index 47fec4de0..a8d905e69 100644 --- a/src/pocketmine/level/generator/object/SmallTree.php +++ b/src/pocketmine/level/generator/object/SmallTree.php @@ -29,7 +29,7 @@ class SmallTree extends Tree{ public $type = 0; private $trunkHeight = 5; private static $leavesHeight = 4; // All trees appear to be 4 tall - private static $leafRadii = array(1, 1.41, 2.83, 2.24); + private static $leafRadii = [1, 1.41, 2.83, 2.24]; private $addLeavesVines = false; private $addLogVines = false; diff --git a/src/pocketmine/level/generator/object/Tree.php b/src/pocketmine/level/generator/object/Tree.php index f54e62988..1ec2ee45a 100644 --- a/src/pocketmine/level/generator/object/Tree.php +++ b/src/pocketmine/level/generator/object/Tree.php @@ -26,14 +26,14 @@ use pocketmine\level\ChunkManager; use pocketmine\utils\Random; class Tree{ - public $overridable = array( + public $overridable = [ 0 => true, 2 => true, 3 => true, 6 => true, 17 => true, 18 => true, - ); + ]; public static function growTree(ChunkManager $level, $x, $y, $z, Random $random, $type = 0){ switch($type & 0x03){ diff --git a/src/pocketmine/network/query/QueryHandler.php b/src/pocketmine/network/query/QueryHandler.php index 3c245e58a..ade5ff79d 100644 --- a/src/pocketmine/network/query/QueryHandler.php +++ b/src/pocketmine/network/query/QueryHandler.php @@ -64,11 +64,11 @@ class QueryHandler{ $plist .= ":"; foreach($pl as $p){ $d = $p->getDescription(); - $plist .= " " . str_replace(array(";", ":", " "), array("", "", "_"), $d->getName()) . " " . str_replace(array(";", ":", " "), array("", "", "_"), $d->getVersion()) . ";"; + $plist .= " " . str_replace([";", ":", " "], ["", "", "_"], $d->getName()) . " " . str_replace([";", ":", " "], ["", "", "_"], $d->getVersion()) . ";"; } $plist = substr($plist, 0, -1); } - $KVdata = array( + $KVdata = [ "splitnum" => chr(128), "hostname" => $this->server->getServerName(), "gametype" => ($this->server->getGamemode() & 0x01) === 0 ? "SMP" : "CMP", @@ -81,7 +81,7 @@ class QueryHandler{ "maxplayers" => $this->server->getMaxPlayers(), "whitelist" => $this->server->hasWhitelist() === true ? "on" : "off", "hostport" => $this->server->getPort() - ); + ]; foreach($KVdata as $key => $value){ $str .= $key . "\x00" . $value . "\x00"; } diff --git a/src/pocketmine/network/rcon/RCON.php b/src/pocketmine/network/rcon/RCON.php index 829a23a14..69b088525 100644 --- a/src/pocketmine/network/rcon/RCON.php +++ b/src/pocketmine/network/rcon/RCON.php @@ -66,7 +66,7 @@ class RCON{ } @socket_getsockname($this->socket, $addr, $port); $this->server->getLogger()->info("RCON running on $addr:$port"); - $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask(array($this, "check")), 3); + $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "check"]), 3); } public function stop(){ diff --git a/src/pocketmine/network/rcon/RCONInstance.php b/src/pocketmine/network/rcon/RCONInstance.php index de0103303..90f31e5c9 100644 --- a/src/pocketmine/network/rcon/RCONInstance.php +++ b/src/pocketmine/network/rcon/RCONInstance.php @@ -85,7 +85,7 @@ class RCONInstance extends \Thread{ while($this->stop !== true){ usleep(2000); - $r = array($socket = $this->socket); + $r = [$socket = $this->socket]; $w = null; $e = null; if(socket_select($r, $w, $e, 0) === 1){ @@ -163,7 +163,7 @@ class RCONInstance extends \Thread{ } usleep(1); }else{ - @socket_set_option($client, SOL_SOCKET, SO_LINGER, array("l_onoff" => 1, "l_linger" => 1)); + @socket_set_option($client, SOL_SOCKET, SO_LINGER, ["l_onoff" => 1, "l_linger" => 1]); @socket_shutdown($client, 2); @socket_set_block($client); @socket_read($client, 1); diff --git a/src/pocketmine/plugin/PluginDescription.php b/src/pocketmine/plugin/PluginDescription.php index 9ce905d38..b44db4ded 100644 --- a/src/pocketmine/plugin/PluginDescription.php +++ b/src/pocketmine/plugin/PluginDescription.php @@ -63,7 +63,7 @@ class PluginDescription{ $this->name = str_replace(" ", "_", $this->name); $this->version = $plugin["version"]; $this->main = $plugin["main"]; - $this->api = !is_array($plugin["api"]) ? array($plugin["api"]) : $plugin["api"]; + $this->api = !is_array($plugin["api"]) ? [$plugin["api"]] : $plugin["api"]; if(stripos($this->main, "pocketmine\\") === 0){ trigger_error("Invalid PluginDescription main, cannot start within the PocketMine namespace", E_USER_ERROR); diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index efd7ae9d7..994f1e451 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -242,7 +242,7 @@ class PluginManager{ if(isset($softDependencies[$before])){ $softDependencies[$before][] = $name; }else{ - $softDependencies[$before] = array($name); + $softDependencies[$before] = [$name]; } } } diff --git a/src/pocketmine/tile/Chest.php b/src/pocketmine/tile/Chest.php index 284965df3..8262a23d1 100644 --- a/src/pocketmine/tile/Chest.php +++ b/src/pocketmine/tile/Chest.php @@ -115,12 +115,12 @@ class Chest extends Spawnable implements InventoryHolder, Container{ public function setItem($index, Item $item){ $i = $this->getSlotIndex($index); - $d = new Compound(false, array( + $d = new Compound(false, [ new Byte("Count", $item->getCount()), new Byte("Slot", $index), new Short("id", $item->getID()), new Short("Damage", $item->getDamage()), - )); + ]); if($item->getID() === Item::AIR or $item->getCount() <= 0){ if($i >= 0){ @@ -226,21 +226,21 @@ class Chest extends Spawnable implements InventoryHolder, Container{ public function getSpawnCompound(){ if($this->isPaired()){ - return new Compound("", array( + return new Compound("", [ new String("id", Tile::CHEST), new Int("x", (int) $this->x), new Int("y", (int) $this->y), new Int("z", (int) $this->z), new Int("pairx", (int) $this->namedtag->pairx), new Int("pairz", (int) $this->namedtag->pairz) - )); + ]); }else{ - return new Compound("", array( + return new Compound("", [ new String("id", Tile::CHEST), new Int("x", (int) $this->x), new Int("y", (int) $this->y), new Int("z", (int) $this->z) - )); + ]); } } } \ No newline at end of file diff --git a/src/pocketmine/tile/Furnace.php b/src/pocketmine/tile/Furnace.php index e38a9abe1..c9760edcd 100644 --- a/src/pocketmine/tile/Furnace.php +++ b/src/pocketmine/tile/Furnace.php @@ -124,12 +124,12 @@ class Furnace extends Tile implements InventoryHolder, Container{ public function setItem($index, Item $item){ $i = $this->getSlotIndex($index); - $d = new Compound(false, array( + $d = new Compound(false, [ new Byte("Count", $item->getCount()), new Byte("Slot", $index), new Short("id", $item->getID()), new Short("Damage", $item->getDamage()), - )); + ]); if($item->getID() === Item::AIR or $item->getCount() <= 0){ if($i >= 0){ diff --git a/src/pocketmine/tile/Sign.php b/src/pocketmine/tile/Sign.php index 9754396ab..0d3df9e37 100644 --- a/src/pocketmine/tile/Sign.php +++ b/src/pocketmine/tile/Sign.php @@ -57,16 +57,16 @@ class Sign extends Spawnable{ } public function getText(){ - return array( + return [ $this->namedtag["Text1"], $this->namedtag["Text2"], $this->namedtag["Text3"], $this->namedtag["Text4"] - ); + ]; } public function getSpawnCompound(){ - return new Compound("", array( + return new Compound("", [ new String("Text1", $this->namedtag["Text1"]), new String("Text2", $this->namedtag["Text2"]), new String("Text3", $this->namedtag["Text3"]), @@ -75,7 +75,7 @@ class Sign extends Spawnable{ new Int("x", (int) $this->x), new Int("y", (int) $this->y), new Int("z", (int) $this->z) - )); + ]); } } diff --git a/src/pocketmine/utils/Binary.php b/src/pocketmine/utils/Binary.php index 944945d1a..fe474216a 100644 --- a/src/pocketmine/utils/Binary.php +++ b/src/pocketmine/utils/Binary.php @@ -163,7 +163,7 @@ class Binary{ } if($types === true){ - $m[$bottom] = array("value" => $r, "type" => $type); + $m[$bottom] = ["value" => $r, "type" => $type]; }else{ $m[$bottom] = $r; } diff --git a/src/pocketmine/utils/Cache.php b/src/pocketmine/utils/Cache.php index ee5e6a6ad..2b4121cbf 100644 --- a/src/pocketmine/utils/Cache.php +++ b/src/pocketmine/utils/Cache.php @@ -33,7 +33,7 @@ class Cache{ * @param float|int $minTTL The data will remain cached for at least $minTTL seconds */ public static function add($identifier, $blob, $minTTL = 30){ - self::$cached[$identifier] = array($blob, microtime(true) + $minTTL, $minTTL); + self::$cached[$identifier] = [$blob, microtime(true) + $minTTL, $minTTL]; } /** diff --git a/src/pocketmine/utils/Config.php b/src/pocketmine/utils/Config.php index 307236e1d..3c1d84f6e 100644 --- a/src/pocketmine/utils/Config.php +++ b/src/pocketmine/utils/Config.php @@ -47,7 +47,7 @@ class Config{ /** @var integer */ private $type = Config::DETECT; - public static $formats = array( + public static $formats = [ "properties" => Config::PROPERTIES, "cnf" => Config::CNF, "conf" => Config::CNF, @@ -63,7 +63,7 @@ class Config{ "txt" => Config::ENUM, "list" => Config::ENUM, "enum" => Config::ENUM, - ); + ]; /** * @param string $file Path of the file to be loaded diff --git a/src/pocketmine/utils/TextFormat.php b/src/pocketmine/utils/TextFormat.php index ed4baa90a..fb2b5e701 100644 --- a/src/pocketmine/utils/TextFormat.php +++ b/src/pocketmine/utils/TextFormat.php @@ -69,7 +69,7 @@ class TextFormat{ * @return mixed */ public static function clean($string){ - return preg_replace(array("/§[0123456789abcdefklmnor]/", "/\\x1b*/"), "", $string); + return preg_replace(["/§[0123456789abcdefklmnor]/", "/\\x1b*/"], "", $string); } /** diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index 400a3ec1a..40d4275f1 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -217,7 +217,7 @@ class Utils{ $drop = 0; while(!isset($output{$length - 1})){ //some entropy, but works ^^ - $weakEntropy = array( + $weakEntropy = [ is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(@stat(__FILE__)), __DIR__, @@ -249,7 +249,7 @@ class Utils{ (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime(), - ); + ]; shuffle($weakEntropy); $value = hash("sha512", implode($weakEntropy), true); @@ -261,13 +261,13 @@ class Utils{ unset($weakEntropy); if($secure === true){ - $strongEntropyValues = array( + $strongEntropyValues = [ is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), //Get a random index of the startEntropy, or just read it file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("\x00", 64), function_exists("openssl_random_pseudo_bytes") ? openssl_random_pseudo_bytes(64) : str_repeat("\x00", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("\x00", 64), $value, - ); + ]; $strongEntropy = array_pop($strongEntropyValues); foreach($strongEntropyValues as $value){ $strongEntropy = $strongEntropy ^ $value; @@ -330,7 +330,7 @@ class Utils{ } $ch = curl_init($page); - curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP")); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP"]); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); @@ -368,7 +368,7 @@ class Utils{ curl_setopt($ch, CURLOPT_POSTFIELDS, $args); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP")); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int) $timeout); $ret = curl_exec($ch); diff --git a/src/pocketmine/utils/VersionString.php b/src/pocketmine/utils/VersionString.php index 5e0579f66..36464f212 100644 --- a/src/pocketmine/utils/VersionString.php +++ b/src/pocketmine/utils/VersionString.php @@ -26,14 +26,14 @@ namespace pocketmine\utils; * Manages PocketMine-MP version strings, and compares them */ class VersionString{ - public static $stageOrder = array( + public static $stageOrder = [ "alpha" => 0, "a" => 0, "beta" => 1, "b" => 1, "final" => 2, "f" => 2, - ); + ]; private $stage; private $major; private $build; diff --git a/src/pocketmine/wizard/Installer.php b/src/pocketmine/wizard/Installer.php index 74c404790..7842eb946 100644 --- a/src/pocketmine/wizard/Installer.php +++ b/src/pocketmine/wizard/Installer.php @@ -197,7 +197,7 @@ LICENSE; $externalIP = Utils::getIP(); $internalIP = gethostbyname(trim(`hostname`)); - echo "[!] " . $this->lang->get("ip_warning", array("{{EXTERNAL_IP}}", "{{INTERNAL_IP}}"), array($externalIP, $internalIP)) . "\n"; + echo "[!] " . $this->lang->get("ip_warning", ["{{EXTERNAL_IP}}", "{{INTERNAL_IP}}"], [$externalIP, $internalIP]) . "\n"; echo "[!] " . $this->lang->ip_confirm; $this->getInput(); } diff --git a/src/pocketmine/wizard/InstallerLang.php b/src/pocketmine/wizard/InstallerLang.php index 1d0511114..79643ea97 100644 --- a/src/pocketmine/wizard/InstallerLang.php +++ b/src/pocketmine/wizard/InstallerLang.php @@ -23,7 +23,7 @@ namespace pocketmine\wizard; class InstallerLang{ - public static $languages = array( + public static $languages = [ "en" => "English", "es" => "Español", "zh" => "中文", @@ -43,7 +43,7 @@ class InstallerLang{ "fi" => "Suomi", "tr" => "Türkçe", //"et" => "Eesti", - ); + ]; private $texts = []; private $lang; private $langfile; @@ -84,14 +84,14 @@ class InstallerLang{ public function loadLang($langfile, $lang = "en"){ $this->texts[$lang] = []; - $texts = explode("\n", str_replace(array("\r", "\\/\\/"), array("", "//"), file_get_contents($langfile))); + $texts = explode("\n", str_replace(["\r", "\\/\\/"], ["", "//"], file_get_contents($langfile))); foreach($texts as $line){ $line = trim($line); if($line === ""){ continue; } $line = explode("=", $line); - $this->texts[$lang][trim(array_shift($line))] = trim(str_replace(array("\\n", "\\N",), "\n", implode("=", $line))); + $this->texts[$lang][trim(array_shift($line))] = trim(str_replace(["\\n", "\\N",], "\n", implode("=", $line))); } }