Remember fixed pointlimit after new map

Added callback for when new map start and if pointlimit is linear then set it again.
This commit is contained in:
Designburo 2014-05-29 16:36:49 +02:00
parent 433a088325
commit 59fe5dd844

View File

@ -26,7 +26,7 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
* Constants * Constants
*/ */
const ID = 21; const ID = 21;
const VERSION = 0.2; const VERSION = 0.3;
const NAME = 'Dynamic Point Limit Plugin'; const NAME = 'Dynamic Point Limit Plugin';
const AUTHOR = 'MCTeam'; const AUTHOR = 'MCTeam';
@ -109,6 +109,7 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'handlePlayerInfoChangedCallback'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'handlePlayerInfoChangedCallback');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINROUND, $this, 'updatePointLimit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINROUND, $this, 'updatePointLimit');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChangedCallback'); $this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChangedCallback');
$this->maniaControl->commandManager->registerCommandListener('setpointlimit', $this, 'commandSetPointlimit', true, 'Setpointlimit XXX or auto'); $this->maniaControl->commandManager->registerCommandListener('setpointlimit', $this, 'commandSetPointlimit', true, 'Setpointlimit XXX or auto');
@ -209,6 +210,24 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
$this->updatePointLimit(); $this->updatePointLimit();
} }
/**
* Handle BeginMap Callback
*
* @param Setting $setting
*/
public function handleBeginMap() {
if ($this->staticMode)
{
$this->maniaControl->chat->sendChat('$fffPointlimit fixed at '.$this->lastPointLimit.'.');
try{
$this->maniaControl->client->setModeScriptSettings(array('S_MapPointsLimit' => (int)($this->lastPointLimit)));
}catch(FaultException $e){
}
}
}
/** /**
* Handle Player Info Changed Callback * Handle Player Info Changed Callback
* *
@ -224,3 +243,4 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
$this->updatePointLimit(); $this->updatePointLimit();
} }
} }
?>