- fixed core instances creation order

- minor fixes/improvements
This commit is contained in:
Steffen Schröder 2013-11-26 13:49:36 +01:00
parent 7f1646f25d
commit fc66d2d34b
3 changed files with 16 additions and 2 deletions

View File

@ -84,8 +84,8 @@ class ManiaControl implements CommandListener {
$this->chat = new Chat($this); $this->chat = new Chat($this);
$this->commandManager = new CommandManager($this); $this->commandManager = new CommandManager($this);
$this->server = new Server($this); $this->server = new Server($this);
$this->authenticationManager = new AuthenticationManager($this);
$this->playerManager = new PlayerManager($this); $this->playerManager = new PlayerManager($this);
$this->authenticationManager = new AuthenticationManager($this);
$this->mapManager = new MapManager($this); $this->mapManager = new MapManager($this);
$this->pluginManager = new PluginManager($this); $this->pluginManager = new PluginManager($this);

View File

@ -44,6 +44,7 @@ class MapManager implements CallbackListener {
$this->mapCommands = new MapCommands($maniaControl); $this->mapCommands = new MapCommands($maniaControl);
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap');
} }
@ -138,6 +139,19 @@ class MapManager implements CallbackListener {
return $map; return $map;
} }
/**
* Handle OnInit callback
*
* @param array $callback
*/
public function handleOnInit(array $callback) {
$map = $this->getCurrentMap();
if (!$map) {
return;
}
$this->addMap($map);
}
/** /**
* Handle BeginMap callback * Handle BeginMap callback
* *

View File

@ -9,7 +9,7 @@ use ManiaControl\Plugins\Plugin;
* *
* @author steeffeen * @author steeffeen
*/ */
class Endurance_Plugin extends Plugin implements CallbackListener { class EndurancePlugin extends Plugin implements CallbackListener {
/** /**
* Constants * Constants
*/ */