diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index c305d3f2..fc09dc5c 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -190,7 +190,7 @@ class MapQueue implements CallbackListener, CommandListener { /** * Returns the current queue buffer * - * @return array + * @return string[] */ public function getQueueBuffer() { return $this->buffer; diff --git a/application/core/Plugins/PluginManager.php b/application/core/Plugins/PluginManager.php index 6687b01f..079e991a 100644 --- a/application/core/Plugins/PluginManager.php +++ b/application/core/Plugins/PluginManager.php @@ -230,7 +230,7 @@ class PluginManager { /** * Load complete Plugins Directory and start all configured Plugins * - * @return array + * @return string[] */ public function loadPlugins() { $pluginsDirectory = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR; @@ -402,16 +402,32 @@ class PluginManager { /** * Get all declared plugin class names * - * @return array + * @return string[] */ public function getPluginClasses() { return $this->pluginClasses; } /** - * Get all active plugins + * Get the Ids of all active Plugins * - * @return array + * @return string[] + */ + public function getActivePluginsIds() { + $pluginsIds = array(); + foreach ($this->getActivePlugins() as $plugin) { + $pluginId = $plugin::getId(); + if (is_numeric($pluginId)) { + array_push($pluginsIds, $pluginId); + } + } + return $pluginsIds; + } + + /** + * Get all active Plugins + * + * @return Plugin[] */ public function getActivePlugins() { return $this->activePlugins; diff --git a/application/core/Server/UsageReporter.php b/application/core/Server/UsageReporter.php index b017858e..e14bb103 100644 --- a/application/core/Server/UsageReporter.php +++ b/application/core/Server/UsageReporter.php @@ -4,7 +4,6 @@ namespace ManiaControl\Server; use ManiaControl\Callbacks\TimerListener; use ManiaControl\ManiaControl; -use ManiaControl\Plugins\Plugin; use ManiaControl\Utils\Formatter; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; @@ -73,18 +72,7 @@ class UsageReporter implements TimerListener { $properties['ScriptName'] = ''; } - $activePlugins = array(); - - if (is_array($this->maniaControl->pluginManager->getActivePlugins())) { - foreach ($this->maniaControl->pluginManager->getActivePlugins() as $plugin) { - /** @var Plugin $plugin */ - if (!is_null($plugin::getId()) && is_numeric($plugin::getId())) { - $activePlugins[] = $plugin::getId(); - } - } - } - - $properties['ActivePlugins'] = $activePlugins; + $properties['ActivePlugins'] = $this->maniaControl->pluginManager->getActivePluginsIds(); $json = json_encode($properties); $info = base64_encode($json);