mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Added Inventory interfaces and types, updated long array() to []
This commit is contained in:
@ -113,7 +113,7 @@ class Binary{
|
||||
*/
|
||||
public static function readMetadata($value, $types = false){
|
||||
$offset = 0;
|
||||
$m = array();
|
||||
$m = [];
|
||||
$b = ord($value{$offset});
|
||||
++$offset;
|
||||
while($b !== 127 and isset($value{$offset})){
|
||||
@ -143,7 +143,7 @@ class Binary{
|
||||
$offset += $len;
|
||||
break;
|
||||
case 5:
|
||||
$r = array();
|
||||
$r = [];
|
||||
$r[] = self::readLShort(substr($value, $offset, 2));
|
||||
$offset += 2;
|
||||
$r[] = ord($value{$offset});
|
||||
@ -152,7 +152,7 @@ class Binary{
|
||||
$offset += 2;
|
||||
break;
|
||||
case 6:
|
||||
$r = array();
|
||||
$r = [];
|
||||
for($i = 0; $i < 3; ++$i){
|
||||
$r[] = self::readLInt(substr($value, $offset, 4));
|
||||
$offset += 4;
|
||||
|
@ -23,7 +23,7 @@ namespace pocketmine\utils;
|
||||
|
||||
|
||||
class Cache{
|
||||
public static $cached = array();
|
||||
public static $cached = [];
|
||||
|
||||
/**
|
||||
* Adds something to the cache
|
||||
|
@ -71,7 +71,7 @@ class Config{
|
||||
* @param array $default Array with the default values, will be set if not existent
|
||||
* @param null &$correct Sets correct to true if everything has been loaded correctly
|
||||
*/
|
||||
public function __construct($file, $type = Config::DETECT, $default = array(), &$correct = null){
|
||||
public function __construct($file, $type = Config::DETECT, $default = [], &$correct = null){
|
||||
$this->load($file, $type, $default);
|
||||
$correct = $this->correct;
|
||||
}
|
||||
@ -102,12 +102,12 @@ class Config{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function load($file, $type = Config::DETECT, $default = array()){
|
||||
public function load($file, $type = Config::DETECT, $default = []){
|
||||
$this->correct = true;
|
||||
$this->type = (int) $type;
|
||||
$this->file = $file;
|
||||
if(!is_array($default)){
|
||||
$default = array();
|
||||
$default = [];
|
||||
}
|
||||
if(!file_exists($file)){
|
||||
$this->config = $default;
|
||||
@ -275,7 +275,7 @@ class Config{
|
||||
$final = array_pop($components);
|
||||
foreach($components as $component){
|
||||
if(!isset($currPath[$component])){
|
||||
$currPath[$component] = array();
|
||||
$currPath[$component] = [];
|
||||
}
|
||||
$currPath =& $currPath[$component];
|
||||
}
|
||||
@ -347,7 +347,7 @@ class Config{
|
||||
foreach($default as $k => $v){
|
||||
if(is_array($v)){
|
||||
if(!isset($data[$k]) or !is_array($data[$k])){
|
||||
$data[$k] = array();
|
||||
$data[$k] = [];
|
||||
}
|
||||
$changed += $this->fillDefaults($v, $data[$k]);
|
||||
}elseif(!isset($data[$k])){
|
||||
|
Reference in New Issue
Block a user