Added Inventory interfaces and types, updated long array() to []

This commit is contained in:
Shoghi Cervantes
2014-05-22 18:59:16 +02:00
parent 0be679c9d5
commit 6cbd39de9b
102 changed files with 637 additions and 334 deletions

View File

@@ -218,7 +218,7 @@ abstract class PluginBase implements Plugin{
* @return string[]
*/
public function getResources(){
$resources = array();
$resources = [];
if(is_dir($this->file . "resources/")){
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file . "resources/")) as $resource){
$resources[] = $resource;

View File

@@ -27,13 +27,13 @@ class PluginDescription{
private $name;
private $main;
private $api;
private $depend = array();
private $softDepend = array();
private $loadBefore = array();
private $depend = [];
private $softDepend = [];
private $loadBefore = [];
private $version;
private $commands = array();
private $commands = [];
private $description = null;
private $authors = array();
private $authors = [];
private $website = null;
private $prefix = null;
private $order = PluginLoadOrder::POSTWORLD;
@@ -41,7 +41,7 @@ class PluginDescription{
/**
* @var Permission[]
*/
private $permissions = array();
private $permissions = [];
/**
* @param string $yamlString
@@ -100,7 +100,7 @@ class PluginDescription{
$this->order = constant("pocketmine\\plugin\\PluginLoadOrder::" . $order);
}
}
$this->authors = array();
$this->authors = [];
if(isset($plugin["author"])){
$this->authors[] = $plugin["author"];
}

View File

@@ -45,12 +45,12 @@ class PluginManager{
/**
* @var Plugin[]
*/
protected $plugins = array();
protected $plugins = [];
/**
* @var Permission[]
*/
protected $permissions = array();
protected $permissions = [];
/**
* @var Permission[]
@@ -65,7 +65,7 @@ class PluginManager{
/**
* @var Permissible[]
*/
protected $permSubs = array();
protected $permSubs = [];
/**
* @var Permissible[]
@@ -80,7 +80,7 @@ class PluginManager{
/**
* @var PluginLoader[]
*/
protected $fileAssociations = array();
protected $fileAssociations = [];
/**
* @param Server $server
@@ -166,12 +166,12 @@ class PluginManager{
public function loadPlugins($directory, $newLoaders = null){
if(is_dir($directory)){
$plugins = array();
$loadedPlugins = array();
$dependencies = array();
$softDependencies = array();
$plugins = [];
$loadedPlugins = [];
$dependencies = [];
$softDependencies = [];
if(is_array($newLoaders)){
$loaders = array();
$loaders = [];
foreach($newLoaders as $key){
if(isset($this->fileAssociations[$key])){
$loaders[$key] = $this->fileAssociations[$key];
@@ -302,14 +302,14 @@ class PluginManager{
foreach($plugins as $name => $file){
console("[SEVERE] Could not load plugin '" . $name . "': circular dependency detected");
}
$plugins = array();
$plugins = [];
}
}
}
return $loadedPlugins;
}else{
return array();
return [];
}
}
@@ -432,7 +432,7 @@ class PluginManager{
return $this->permSubs[$permission];
}
return array();
return [];
}
/**
@@ -512,7 +512,7 @@ class PluginManager{
* @return PluginCommand[]
*/
protected function parseYamlCommands(Plugin $plugin){
$pluginCmds = array();
$pluginCmds = [];
foreach($plugin->getDescription()->getCommands() as $key => $data){
if(strpos($key, ":") !== false){
@@ -530,7 +530,7 @@ class PluginManager{
}
if(isset($data["aliases"]) and is_array($data["aliases"])){
$aliasList = array();
$aliasList = [];
foreach($data["aliases"] as $alias){
if(strpos($alias, ":") !== false){
console("[SEVERE] Could not load alias " . $alias . " for plugin " . $plugin->getDescription()->getName());
@@ -579,11 +579,11 @@ class PluginManager{
public function clearPlugins(){
$this->disablePlugins();
$this->plugins = array();
$this->fileAssociations = array();
$this->permissions = array();
$this->defaultPerms = array();
$this->defaultPermsOp = array();
$this->plugins = [];
$this->fileAssociations = [];
$this->permissions = [];
$this->defaultPerms = [];
$this->defaultPermsOp = [];
}
/**