vote plugin, possability to react on trigger events, now built in only for map ralated votes
This commit is contained in:
@ -158,6 +158,26 @@ class CallbackManager {
|
||||
return $this->removeCallbackListener($this->callbackListenings, $listener);
|
||||
}
|
||||
|
||||
//TODO better name (used only in customvotesPlugin)
|
||||
/**
|
||||
* Unregister a single Callback Listening from an Callback Listener
|
||||
*
|
||||
* @param String $callbackName
|
||||
* @param CallbackListener $listener
|
||||
* @return bool
|
||||
*/
|
||||
public function unregisterCallbackListening($callbackName, CallbackListener $listener){
|
||||
foreach($this->callbackListenings as &$listenings){
|
||||
foreach ($listenings as $key => &$listening) {
|
||||
if($key == $callbackName && $listening->listener === $listener){
|
||||
unset($listenings[$key]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the Callback Listener from the given Listeners Array
|
||||
*
|
||||
|
@ -622,10 +622,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
$message = $player->getEscapedNickname() . '$s started a vote to switch to ' . $map->getEscapedName() . '!';
|
||||
|
||||
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message);
|
||||
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message)->setStopCallback(Callbacks::ENDMAP);
|
||||
|
||||
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) {
|
||||
// TODO: $result isn't used -> bug? does it skip even if vote is not successful?
|
||||
$votesPlugin->undefineVote('switchmap');
|
||||
|
||||
//Don't queue on Map-Change
|
||||
|
Reference in New Issue
Block a user