/** * @param PluginBase $owner - plugin that owns this session * @param bool $hard - hard freeze option */ public function __construct(PluginBase $owner, $hard = true) { $bag = $owner->getServer()->getPluginManager()->getPlugin("GrabBag"); if ($bag && $bag->isEnabled() && MPMU::apiCheck($bag->getDescription()->getVersion(), "2.3") && $bag->api->getFeature("shield")) { $this->api = $bag->api; return; } parent::__construct($owner); $this->api = null; }
/** * @param PluginBase $owner - plugin that owns this session * @param bool $hard - hard freeze option */ public function __construct(PluginBase $owner, $hard = true) { $bag = $owner->getServer()->getPluginManager()->getPlugin("GrabBag"); if ($bag && $bag->isEnabled() && MPMU::apiCheck($bag->getDescription()->getVersion(), "2.3") && $bag->api->getFeature("freeze-thaw")) { $this->api = $bag->api; return; } parent::__construct($owner); // We do it here so to prevent the registration of listeners $this->api = null; $this->hard = $hard; }
/** * @param PluginBase $owner - plugin that owns this session */ public function __construct(PluginBase $owner) { $bag = $owner->getServer()->getPluginManager()->getPlugin("GrabBag"); $this->apis = [null, null]; if ($bag && $bag->isEnabled() && MPMU::apiCheck($bag->getDescription()->getVersion(), "2.3")) { if ($bag->api->getFeature("chat-utils")) { $this->apis[0] = $bag->api; } if ($bag->api->getFeature("mute-unmute")) { $this->apis[1] = $bag->api; } return; } parent::__construct($owner); $this->chat = true; }
/** * Used to initialize the player specific variables table */ protected function initPlayerVars() { if ($this->{$playerExtensions} !== null) { return; } $this->playerExtensions = $this->autoloadExtensions(self::getPlayerVarsFn); $this->playerExtensions[] = [$this, "stdPlayerVars"]; $this->playerExtensions[] = [$this, "invPlayerVars"]; $pm = $this->getServer()->getPluginManager(); if (($kr = $pm->getPlugin("KillRate")) !== null) { if (MPMU::apiCheck($kr->getDescription()->getVersion(), "1.1")) { $this->registerApi("KillRate-1.1", $kr); $this->playerExtensions[] = [$this, "kr1PlayerVars"]; } } if (($pp = $pm->getPlugin("PurePerms")) !== null) { $this->registerApi("PurePerms", $pp); $this->playerExtensions[] = [$this, "purePermsPlayerVars"]; } if (($ru = $pm->getPlugin("RankUp")) !== null) { $this->registerApi("RankUp", $ru); $this->playerExtensions[] = [$this, "rankUpPlayerVars"]; } if (($mm = $pm->getPlugin("GoldStd")) !== null) { $this->registerApi("money", $mm); $this->playerExtensions[] = [$this, "moneyPlayerVarsGoldStd"]; } elseif (($mm = $pm->getPlugin("PocketMoney")) !== null) { $this->registerApi("money", $mm); $this->playerExtensions[] = [$this, "moneyPlayerVarsPocketMoney"]; } elseif (($mm = $pm->getPlugin("MassiveEconomy")) !== null) { $this->registerApi("money", $mm); $this->playerExtensions[] = [$this, "moneyPlayerVarsMassiveEconomy"]; } elseif (($mm = $pm->getPlugin("EconomyAPI")) !== null) { $this->registerApi("money", $mm); $this->playerExtensions[] = [$this, "moneyPlayerVarsEconomysApi"]; } }
/** * If GrabBag is available, try to get a single shared instance of * PMScript */ public static function getCommonInterp(Plugin $owner) { $pm = $owner->getServer()->getPluginManager(); if (($gb = $pm->getPlugin("GrabBag")) !== null) { if ($gb->isEnabled() && MPMU::apiCheck($gb->getDescription()->getVersion(), "2.3")) { $vars = $gb->api->getInterp(); if ($vars instanceof PMScript) { return $vars; } } } return new PMScript($owner, ExpandVars::getCommonVars($owner)); }