Workaround for plugin versions being read as strings from plugin.yml

Config is a real pain in the ass to work with... need to split it up so this can be handled properly
This commit is contained in:
Dylan K. Taylor 2017-07-16 11:31:21 +01:00
parent 7c00982fff
commit cca9cf2c86

View File

@ -69,9 +69,9 @@ class PluginDescription{
throw new PluginException("Invalid PluginDescription name"); throw new PluginException("Invalid PluginDescription name");
} }
$this->name = str_replace(" ", "_", $this->name); $this->name = str_replace(" ", "_", $this->name);
$this->version = $plugin["version"]; $this->version = (string) $plugin["version"];
$this->main = $plugin["main"]; $this->main = $plugin["main"];
$this->api = !is_array($plugin["api"]) ? [$plugin["api"]] : $plugin["api"]; $this->api = array_map(function($v){ return (string) $v; }, !is_array($plugin["api"]) ? [$plugin["api"]] : $plugin["api"]);
if(stripos($this->main, "pocketmine\\") === 0){ if(stripos($this->main, "pocketmine\\") === 0){
throw new PluginException("Invalid PluginDescription main, cannot start within the PocketMine namespace"); throw new PluginException("Invalid PluginDescription main, cannot start within the PocketMine namespace");
} }