plugin reopened
This commit is contained in:
parent
8294ff5922
commit
a9ed2ad878
@ -76,8 +76,6 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
|
||||||
//$this->maniaControl->callbackManager->registerCallbackListener(ScriptSettings::CB_SCRIPTSETTINGS_CHANGED, $this, 'reopenMenu');
|
|
||||||
//$this->maniaControl->callbackManager->registerCallbackListener(ServerSettings::CB_SERVERSETTINGS_CHANGED, $this, 'reopenMenu');
|
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
|
|
||||||
// Create server settings
|
// Create server settings
|
||||||
|
@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Plugins;
|
namespace ManiaControl\Plugins;
|
||||||
|
|
||||||
use FML\Script\Script;
|
use FML\Controls\Control;
|
||||||
use ManiaControl\ManiaControl;
|
|
||||||
use ManiaControl\Players\Player;
|
|
||||||
use ManiaControl\Configurators\ConfiguratorMenu;
|
|
||||||
use FML\Script\Pages;
|
|
||||||
use FML\Script\Tooltips;
|
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Labels\Label_Text;
|
|
||||||
use FML\Controls\Control;
|
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
|
||||||
use FML\Controls\Labels\Label_Button;
|
use FML\Controls\Labels\Label_Button;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use FML\Controls\Labels\Label_Text;
|
||||||
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
|
use FML\Script\Pages;
|
||||||
|
use FML\Script\Script;
|
||||||
|
use FML\Script\Tooltips;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
|
use ManiaControl\Configurators\ConfiguratorMenu;
|
||||||
use ManiaControl\Formatter;
|
use ManiaControl\Formatter;
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurator for enabling and disabling plugins
|
* Configurator for enabling and disabling plugins
|
||||||
@ -43,8 +43,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
|
|||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
'handleManialinkPageAnswer');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,8 +122,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
|
|||||||
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
|
$activeQuad->setSize($entryHeight * 0.9, $entryHeight * 0.9);
|
||||||
if($active) {
|
if($active) {
|
||||||
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
|
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlGreen);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlRed);
|
$activeQuad->setSubStyle($activeQuad::SUBSTYLE_LvlRed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +158,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
|
|||||||
$statusChangeButton->setTextPrefix('$f00');
|
$statusChangeButton->setTextPrefix('$f00');
|
||||||
$statusChangeButton->setText('Deactivate');
|
$statusChangeButton->setText('Deactivate');
|
||||||
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
|
$statusChangeButton->setAction(self::ACTION_PREFIX_DISABLEPLUGIN . $pluginClass);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$statusChangeButton->setTextPrefix('a');
|
$statusChangeButton->setTextPrefix('a');
|
||||||
$statusChangeButton->setText('Activate');
|
$statusChangeButton->setText('Activate');
|
||||||
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
|
$statusChangeButton->setAction(self::ACTION_PREFIX_ENABLEPLUGIN . $pluginClass);
|
||||||
@ -207,22 +204,23 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
|
|||||||
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' activated!', $player->login);
|
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' activated!', $player->login);
|
||||||
$this->maniaControl->configurator->showMenu($player);
|
$this->maniaControl->configurator->showMenu($player);
|
||||||
$this->maniaControl->log(Formatter::stripCodes("{$player->login} activated '{$pluginClass}'!"));
|
$this->maniaControl->log(Formatter::stripCodes("{$player->login} activated '{$pluginClass}'!"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->maniaControl->chat->sendError('Error activating ' . $pluginClass::getName() . '!', $player->login);
|
$this->maniaControl->chat->sendError('Error activating ' . $pluginClass::getName() . '!', $player->login);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN));
|
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN));
|
||||||
$deactivated = $this->maniaControl->pluginManager->deactivatePlugin($pluginClass);
|
$deactivated = $this->maniaControl->pluginManager->deactivatePlugin($pluginClass);
|
||||||
if($deactivated) {
|
if($deactivated) {
|
||||||
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' deactivated!', $player->login);
|
$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' deactivated!', $player->login);
|
||||||
$this->maniaControl->configurator->showMenu($player);
|
$this->maniaControl->configurator->showMenu($player);
|
||||||
$this->maniaControl->log(Formatter::stripCodes("{$player->login} deactivated '{$pluginClass}'!"));
|
$this->maniaControl->log(Formatter::stripCodes("{$player->login} deactivated '{$pluginClass}'!"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->maniaControl->chat->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player->login);
|
$this->maniaControl->chat->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player->login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Reopen the Menu
|
||||||
|
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||||
|
$this->maniaControl->configurator->reopenMenu($menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user