removed obstacle plugin todo
This commit is contained in:
parent
87549fdf9b
commit
8afcc191a2
@ -27,7 +27,9 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
/** @var maniaControl $maniaControl */
|
/**
|
||||||
|
* @var maniaControl $maniaControl
|
||||||
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,8 +50,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
// Init settings
|
// Init settings
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JUMPTOAUTHLEVEL,
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JUMPTOAUTHLEVEL, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
|
||||||
|
|
||||||
// Register for commands
|
// Register for commands
|
||||||
$this->maniaControl->commandManager->registerCommandListener('jumpto', $this, 'command_JumpTo');
|
$this->maniaControl->commandManager->registerCommandListener('jumpto', $this, 'command_JumpTo');
|
||||||
@ -129,7 +130,8 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$param = $player->login . ";" . $params[1] . ";";
|
$param = $player->login . ";" . $params[1] . ";";
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->triggerModeScriptEvent(self::CB_JUMPTO, $param);
|
$this->maniaControl->client->triggerModeScriptEvent(self::CB_JUMPTO, $param);
|
||||||
} catch(Exception $e) {
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
if ($e->getMessage() == 'Not in script mode.') {
|
if ($e->getMessage() == 'Not in script mode.') {
|
||||||
trigger_error("Couldn't send jump callback for '{$player->login}'. " . $e->getMessage());
|
trigger_error("Couldn't send jump callback for '{$player->login}'. " . $e->getMessage());
|
||||||
return;
|
return;
|
||||||
@ -152,7 +154,8 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$time = $data->Run->Time;
|
$time = $data->Run->Time;
|
||||||
// Trigger trackmania player finish callback
|
// Trigger trackmania player finish callback
|
||||||
$finishCallback = array($player->pid, $player->login, $time);
|
$finishCallback = array($player->pid, $player->login, $time);
|
||||||
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERFINISH, array(CallbackManager::CB_TM_PLAYERFINISH, $finishCallback));
|
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERFINISH,
|
||||||
|
array(CallbackManager::CB_TM_PLAYERFINISH, $finishCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,13 +166,13 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
public function callback_OnCheckpoint(array $callback) {
|
public function callback_OnCheckpoint(array $callback) {
|
||||||
$data = json_decode($callback[1]);
|
$data = json_decode($callback[1]);
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($data->Player->Login);
|
$player = $this->maniaControl->playerManager->getPlayer($data->Player->Login);
|
||||||
if (!$player) {
|
$time = $data->Run->Time;
|
||||||
|
if (!$player || $time <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$time = $data->Run->Time;
|
|
||||||
// Trigger Trackmania player checkpoint callback
|
// Trigger Trackmania player checkpoint callback
|
||||||
// TODO: Checkpoint index (5th element)
|
|
||||||
$checkpointCallback = array($player->pid, $player->login, $time, 0, 0);
|
$checkpointCallback = array($player->pid, $player->login, $time, 0, 0);
|
||||||
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback));
|
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT,
|
||||||
|
array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user