fix many PHP 8.4 compatibility issues
This commit is contained in:
parent
03a991cd50
commit
7a8d9f2b0b
@ -15,7 +15,7 @@ abstract class AutoLoader {
|
||||
* Register the Auto Loader
|
||||
*/
|
||||
public static function register() {
|
||||
spl_autoload_register(array(get_class(), 'autoload'));
|
||||
spl_autoload_register(array(get_called_class(), 'autoload'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,7 +161,7 @@ class HelpManager implements CommandListener, CallbackListener, ManialinkPageAns
|
||||
* @param Player $player
|
||||
* @return string
|
||||
*/
|
||||
private function parseHelpList(array $commands, $isHelpAll = false, Player $player = null) {
|
||||
private function parseHelpList(array $commands, $isHelpAll = false, ?Player $player = null) {
|
||||
$showCommands = array();
|
||||
$registeredMethods = array();
|
||||
$message = '';
|
||||
|
@ -188,7 +188,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
||||
* @param Player $player
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
private function buildManialink($menuIdShown = 0, Player $player = null) {
|
||||
private function buildManialink($menuIdShown = 0, ?Player $player = null) {
|
||||
$menuPosX = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSX);
|
||||
$menuPosY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY);
|
||||
$menuWidth = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_WIDTH);
|
||||
|
@ -223,7 +223,7 @@ class Database implements TimerListener {
|
||||
* Check whether the Database Connection is still open
|
||||
*/
|
||||
public function checkConnection() {
|
||||
if (!$this->getMysqli() || !@$this->getMysqli()->ping()) {
|
||||
if (!$this->getMysqli() || !$this->getMysqli()->query('DO 1')) {
|
||||
$this->maniaControl->quit('The MySQL Server has gone away!', true);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class CustomUIManager implements CallbackListener, TimerListener, UsageInformati
|
||||
*
|
||||
* @param Player $player
|
||||
*/
|
||||
public function updateManialink(Player $player = null) {
|
||||
public function updateManialink(?Player $player = null) {
|
||||
$this->maniaControl->getManialinkManager()->sendManialink($this->customUI, $player);
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
|
||||
*
|
||||
* @param ?Setting $setting
|
||||
*/
|
||||
public function updateSettings(Setting $setting = null) {
|
||||
public function updateSettings(?Setting $setting = null) {
|
||||
if (!isset($setting) || !$setting->belongsToClass($this)) return;
|
||||
|
||||
if ($setting->setting === self::SETTING_ENABLE_MX) {
|
||||
@ -378,7 +378,7 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
|
||||
public function addMapFromMx($mapId, $login, $update = false) {
|
||||
if (is_numeric($mapId)) {
|
||||
// Check if map exists
|
||||
$this->maniaControl->getMapManager()->getMXManager()->fetchMapInfo($mapId, function (MXMapInfo $mapInfo = null) use (
|
||||
$this->maniaControl->getMapManager()->getMXManager()->fetchMapInfo($mapId, function (?MXMapInfo $mapInfo = null) use (
|
||||
&$login, &$update
|
||||
) {
|
||||
if (!$mapInfo || !isset($mapInfo->uploaded)) {
|
||||
|
@ -115,7 +115,7 @@ class MapQueue implements CallbackListener, CommandListener, UsageInformationAbl
|
||||
*
|
||||
* @param Player $admin |null
|
||||
*/
|
||||
public function clearMapQueue(Player $admin = null) {
|
||||
public function clearMapQueue(?Player $admin = null) {
|
||||
if ($admin && !$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) {
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||
return;
|
||||
|
@ -68,7 +68,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
|
||||
*
|
||||
* @param Player $player
|
||||
*/
|
||||
public function checkPluginsUpdate(Player $player = null) {
|
||||
public function checkPluginsUpdate(?Player $player = null) {
|
||||
$message = 'Checking Plugins for newer Versions...';
|
||||
if ($player) {
|
||||
$this->maniaControl->getChat()->sendInformation($message, $player);
|
||||
@ -165,7 +165,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
|
||||
*
|
||||
* @param Player $player
|
||||
*/
|
||||
public function performPluginsUpdate(Player $player = null) {
|
||||
public function performPluginsUpdate(?Player $player = null) {
|
||||
$pluginsUpdates = $this->getPluginsUpdates();
|
||||
if (empty($pluginsUpdates)) {
|
||||
$message = 'There are no Plugin Updates available!';
|
||||
@ -241,7 +241,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
|
||||
* @param Player $player
|
||||
* @param bool $update
|
||||
*/
|
||||
private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) {
|
||||
private function installPlugin(PluginUpdateData $pluginUpdateData, ?Player $player = null, $update = false) {
|
||||
if ($player && !$this->maniaControl->getAuthenticationManager()->checkPermission($player, InstallMenu::SETTING_PERMISSION_INSTALL_PLUGINS))
|
||||
{
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
|
@ -130,7 +130,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
*
|
||||
* @param UpdateData $coreUpdateData
|
||||
*/
|
||||
public function setCoreUpdateData(UpdateData $coreUpdateData = null) {
|
||||
public function setCoreUpdateData(?UpdateData $coreUpdateData = null) {
|
||||
$this->coreUpdateData = $coreUpdateData;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
*
|
||||
* @param UpdateData $updateData
|
||||
*/
|
||||
public function handleUpdateCheck(UpdateData $updateData = null) {
|
||||
public function handleUpdateCheck(?UpdateData $updateData = null) {
|
||||
if (!$this->checkUpdateData($updateData)) {
|
||||
// No new update available
|
||||
return;
|
||||
@ -218,7 +218,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
* @param UpdateData $updateData
|
||||
* @return bool
|
||||
*/
|
||||
public function checkUpdateData(UpdateData $updateData = null) {
|
||||
public function checkUpdateData(?UpdateData $updateData = null) {
|
||||
if (!$updateData || !$updateData->url) {
|
||||
// Data corrupted
|
||||
return false;
|
||||
@ -268,7 +268,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
* @param UpdateData $updateData
|
||||
* @return bool
|
||||
*/
|
||||
public function checkUpdateDataBuildVersion(UpdateData $updateData = null) {
|
||||
public function checkUpdateDataBuildVersion(?UpdateData $updateData = null) {
|
||||
if (!$updateData) {
|
||||
// Data corrupted
|
||||
return false;
|
||||
@ -310,7 +310,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
* @param Player $player
|
||||
* @return bool
|
||||
*/
|
||||
public function performCoreUpdate(Player $player = null) {
|
||||
public function performCoreUpdate(?Player $player = null) {
|
||||
if (!$this->coreUpdateData) {
|
||||
$message = 'Update failed: No update Data available!';
|
||||
if ($player) {
|
||||
@ -490,7 +490,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
return;
|
||||
}
|
||||
|
||||
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) {
|
||||
$this->checkCoreUpdateAsync(function (?UpdateData $updateData = null) use (&$player) {
|
||||
if (!$this->checkUpdateData($updateData)) {
|
||||
$this->maniaControl->getChat()->sendInformation('No Update available!', $player);
|
||||
return;
|
||||
@ -563,7 +563,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
* @param null $player
|
||||
*/
|
||||
private function checkAndHandleCoreUpdate($player = null) {
|
||||
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) {
|
||||
$this->checkCoreUpdateAsync(function (?UpdateData $updateData = null) use (&$player) {
|
||||
if (!$updateData) {
|
||||
if ($player) {
|
||||
$this->maniaControl->getChat()->sendError('Update is currently not possible!', $player);
|
||||
|
@ -107,6 +107,16 @@ class SystemUtil {
|
||||
Logger::log($message . 'FOUND!');
|
||||
}
|
||||
|
||||
// Check for Xml
|
||||
$message = 'Checking for installed xml ... ';
|
||||
if (!extension_loaded('SimpleXML')) {
|
||||
Logger::log($message . 'NOT FOUND!');
|
||||
Logger::log(" -- You don't have xml installed! Check: https://www.php.net/manual/en/xml.setup.php");
|
||||
$success = false;
|
||||
} else {
|
||||
Logger::log($message . 'FOUND!');
|
||||
}
|
||||
|
||||
if (!$success) {
|
||||
// Missing requirements
|
||||
self::quit();
|
||||
|
@ -22,7 +22,7 @@ abstract class WebReader {
|
||||
* @param callable $function
|
||||
* @return Response
|
||||
*/
|
||||
public static function getUrl($url, callable $function = null) {
|
||||
public static function getUrl($url, ?callable $function = null) {
|
||||
$request = static::newRequest($url);
|
||||
$response = $request->send();
|
||||
if ($function) {
|
||||
@ -73,7 +73,7 @@ abstract class WebReader {
|
||||
* @param callable $function
|
||||
* @return Response
|
||||
*/
|
||||
public static function postUrl($url, $content = null, callable $function = null) {
|
||||
public static function postUrl($url, $content = null, ?callable $function = null) {
|
||||
$request = static::newRequest($url);
|
||||
$request->getOptions()->set(CURLOPT_POST, true); // post method
|
||||
if ($content) {
|
||||
|
@ -38,7 +38,7 @@ class CheckBox implements Renderable, ScriptFeatureable
|
||||
* @param bool $default (optional) Default value
|
||||
* @param Quad $quad (optional) CheckBox quad
|
||||
*/
|
||||
public function __construct($name = null, $default = null, Quad $quad = null)
|
||||
public function __construct($name = null, $default = null, ?Quad $quad = null)
|
||||
{
|
||||
$this->feature = new CheckBoxFeature();
|
||||
if ($name) {
|
||||
|
@ -39,7 +39,7 @@ class ValuePicker implements Renderable, ScriptFeatureable
|
||||
* @param string $default (optional) Default value
|
||||
* @param Label $label (optional) ValuePicker label
|
||||
*/
|
||||
public function __construct($name = null, array $values = null, $default = null, Label $label = null)
|
||||
public function __construct($name = null, ?array $values = null, $default = null, ?Label $label = null)
|
||||
{
|
||||
$this->feature = new ValuePickerFeature();
|
||||
if ($name) {
|
||||
|
@ -191,7 +191,7 @@ class Audio extends Control implements Playable, Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -209,7 +209,7 @@ class Audio extends Control implements Playable, Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -273,7 +273,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -291,7 +291,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -103,7 +103,7 @@ class Frame extends Control implements Container
|
||||
* @deprecated Use Style
|
||||
* @see Style
|
||||
*/
|
||||
public function setFormat(Format $format = null)
|
||||
public function setFormat(?Format $format = null)
|
||||
{
|
||||
$this->format = $format;
|
||||
return $this;
|
||||
|
@ -138,7 +138,7 @@ class Frame3d extends Frame implements Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -156,7 +156,7 @@ class Frame3d extends Frame implements Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -467,7 +467,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -485,7 +485,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -579,7 +579,7 @@ class Quad extends Control implements Actionable, BackgroundColorable, BgColorab
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -597,7 +597,7 @@ class Quad extends Control implements Actionable, BackgroundColorable, BgColorab
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -281,7 +281,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable,
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -299,7 +299,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable,
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -191,7 +191,7 @@ class Video extends Control implements Playable, Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptAction()
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptAction = (string)$scriptAction;
|
||||
$this->setScriptActionParameters($scriptActionParameters);
|
||||
@ -209,7 +209,7 @@ class Video extends Control implements Playable, Scriptable
|
||||
/**
|
||||
* @see Scriptable::setScriptActionParameters()
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null)
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null)
|
||||
{
|
||||
$this->scriptActionParameters = $scriptActionParameters;
|
||||
return $this;
|
||||
|
@ -41,7 +41,7 @@ class FrameModel implements Container, Identifiable, Renderable
|
||||
* @param Renderable[] $children Children
|
||||
* @return static
|
||||
*/
|
||||
public static function create($modelId = null, array $children = null)
|
||||
public static function create($modelId = null, ?array $children = null)
|
||||
{
|
||||
return new static($modelId, $children);
|
||||
}
|
||||
@ -53,7 +53,7 @@ class FrameModel implements Container, Identifiable, Renderable
|
||||
* @param string $modelId Model id
|
||||
* @param Renderable[] $children Children
|
||||
*/
|
||||
public function __construct($modelId = null, array $children = null)
|
||||
public function __construct($modelId = null, ?array $children = null)
|
||||
{
|
||||
if ($modelId) {
|
||||
$this->setId($modelId);
|
||||
@ -176,7 +176,7 @@ class FrameModel implements Container, Identifiable, Renderable
|
||||
* @deprecated Use Style
|
||||
* @see Style
|
||||
*/
|
||||
public function setFormat(Format $format = null)
|
||||
public function setFormat(?Format $format = null)
|
||||
{
|
||||
$this->format = $format;
|
||||
return $this;
|
||||
|
@ -96,7 +96,7 @@ class ManiaLink
|
||||
* @param Renderable[] $children (optional) Children
|
||||
* @return static
|
||||
*/
|
||||
public static function create($maniaLinkId = null, $version = null, $name = null, array $children = null)
|
||||
public static function create($maniaLinkId = null, $version = null, $name = null, ?array $children = null)
|
||||
{
|
||||
return new static($maniaLinkId, $version, $name, $children);
|
||||
}
|
||||
@ -110,7 +110,7 @@ class ManiaLink
|
||||
* @param string $name (optional) Name
|
||||
* @param Renderable[] $children (optional) Children
|
||||
*/
|
||||
public function __construct($maniaLinkId = null, $version = null, $name = null, array $children = null)
|
||||
public function __construct($maniaLinkId = null, $version = null, $name = null, ?array $children = null)
|
||||
{
|
||||
if (is_string($version) && (!$name || is_array($name)) && !$children) {
|
||||
// backwards-compatibility (version has been introduced later, if it's a string it's supposed to be the name)
|
||||
@ -418,7 +418,7 @@ class ManiaLink
|
||||
* @param Dico $dico Dictionary
|
||||
* @return static
|
||||
*/
|
||||
public function setDico(Dico $dico = null)
|
||||
public function setDico(?Dico $dico = null)
|
||||
{
|
||||
$this->dico = $dico;
|
||||
return $this;
|
||||
@ -445,7 +445,7 @@ class ManiaLink
|
||||
* @param Stylesheet $stylesheet Stylesheet
|
||||
* @return static
|
||||
*/
|
||||
public function setStylesheet(Stylesheet $stylesheet = null)
|
||||
public function setStylesheet(?Stylesheet $stylesheet = null)
|
||||
{
|
||||
$this->stylesheet = $stylesheet;
|
||||
return $this;
|
||||
@ -489,7 +489,7 @@ class ManiaLink
|
||||
* @param Script $script Script
|
||||
* @return static
|
||||
*/
|
||||
public function setScript(Script $script = null)
|
||||
public function setScript(?Script $script = null)
|
||||
{
|
||||
$this->script = $script;
|
||||
return $this;
|
||||
|
@ -29,7 +29,7 @@ class ManiaLinks
|
||||
* @param ManiaLink[] $children ManiaLink children
|
||||
* @return static
|
||||
*/
|
||||
public static function create(array $children = null)
|
||||
public static function create(?array $children = null)
|
||||
{
|
||||
return new static($children);
|
||||
}
|
||||
@ -40,7 +40,7 @@ class ManiaLinks
|
||||
* @api
|
||||
* @param ManiaLink[] $children ManiaLink children
|
||||
*/
|
||||
public function __construct(array $children = null)
|
||||
public function __construct(?array $children = null)
|
||||
{
|
||||
if ($children) {
|
||||
$this->setChildren($children);
|
||||
@ -162,7 +162,7 @@ class ManiaLinks
|
||||
* @param CustomUI $customUI CustomUI object
|
||||
* @return static
|
||||
*/
|
||||
public function setCustomUI(CustomUI $customUI = null)
|
||||
public function setCustomUI(?CustomUI $customUI = null)
|
||||
{
|
||||
$this->customUI = $customUI;
|
||||
return $this;
|
||||
|
@ -41,7 +41,7 @@ class ActionTrigger extends ScriptFeature
|
||||
* @param Control $control (optional) Action Control
|
||||
* @param string $labelName (optional) Script label name
|
||||
*/
|
||||
public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
public function __construct($actionName = null, ?Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
{
|
||||
if ($actionName) {
|
||||
$this->setActionName($actionName);
|
||||
@ -96,7 +96,7 @@ class ActionTrigger extends ScriptFeature
|
||||
* @param Control $control Action Control
|
||||
* @return static
|
||||
*/
|
||||
public function setControl(Control $control = null)
|
||||
public function setControl(?Control $control = null)
|
||||
{
|
||||
if ($control) {
|
||||
$control->checkId();
|
||||
|
@ -66,7 +66,7 @@ class CheckBoxFeature extends ScriptFeature
|
||||
* @param Entry $entry (optional) Hidden Entry
|
||||
* @param bool $default (optional) Default value
|
||||
*/
|
||||
public function __construct(Quad $quad = null, Entry $entry = null, $default = null)
|
||||
public function __construct(?Quad $quad = null, ?Entry $entry = null, $default = null)
|
||||
{
|
||||
if ($quad) {
|
||||
$this->setQuad($quad);
|
||||
|
@ -41,7 +41,7 @@ class Clock extends ScriptFeature
|
||||
* @param bool $showSeconds (optional) Show the seconds
|
||||
* @param bool $showFullDate (optional) Show the date
|
||||
*/
|
||||
public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false)
|
||||
public function __construct(?Label $label = null, $showSeconds = true, $showFullDate = false)
|
||||
{
|
||||
if ($label) {
|
||||
$this->setLabel($label);
|
||||
|
@ -41,7 +41,7 @@ class ControlScript extends ScriptFeature
|
||||
* @param string $scriptText (optional) Script text
|
||||
* @param string $labelName (optional) Script Label name
|
||||
*/
|
||||
public function __construct(Control $control = null, $scriptText = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
public function __construct(?Control $control = null, $scriptText = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
{
|
||||
if ($control) {
|
||||
$this->setControl($control);
|
||||
|
@ -35,7 +35,7 @@ class EntrySubmit extends ScriptFeature
|
||||
* @param Entry $entry (optional) Entry Control
|
||||
* @param string $url (optional) Submit url
|
||||
*/
|
||||
public function __construct(Entry $entry = null, $url = null)
|
||||
public function __construct(?Entry $entry = null, $url = null)
|
||||
{
|
||||
if ($entry) {
|
||||
$this->setEntry($entry);
|
||||
|
@ -54,7 +54,7 @@ class GraphCurve extends ScriptFeature
|
||||
* @param Graph $graph (optional) Graph
|
||||
* @param array[] $points (optional) Points
|
||||
*/
|
||||
public function __construct(Graph $graph = null, array $points = null)
|
||||
public function __construct(?Graph $graph = null, ?array $points = null)
|
||||
{
|
||||
if ($graph) {
|
||||
$this->setGraph($graph);
|
||||
@ -200,7 +200,7 @@ class GraphCurve extends ScriptFeature
|
||||
* @param float[] $color (optional) Color
|
||||
* @return static
|
||||
*/
|
||||
public function setColor(array $color = null)
|
||||
public function setColor(?array $color = null)
|
||||
{
|
||||
$this->color = $color;
|
||||
return $this;
|
||||
|
@ -38,7 +38,7 @@ class GraphSettings extends ScriptFeature
|
||||
* @api
|
||||
* @param Graph $graph (optional) Graph
|
||||
*/
|
||||
public function __construct(Graph $graph = null)
|
||||
public function __construct(?Graph $graph = null)
|
||||
{
|
||||
if ($graph) {
|
||||
$this->setGraph($graph);
|
||||
|
@ -35,7 +35,7 @@ class MapInfo extends ScriptFeature
|
||||
* @param Control $control (optional) Map Info Control
|
||||
* @param string $labelName (optional) Script Label name
|
||||
*/
|
||||
public function __construct(Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
public function __construct(?Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||
{
|
||||
if ($control) {
|
||||
$this->setControl($control);
|
||||
|
@ -40,7 +40,7 @@ class Menu extends ScriptFeature
|
||||
* @param Control $control (optional) Toggled Menu Control
|
||||
* @param bool $isStartElement (optional) Whether the Menu should start with the given Element
|
||||
*/
|
||||
public function __construct(Control $item = null, Control $control = null, $isStartElement = true)
|
||||
public function __construct(?Control $item = null, ?Control $control = null, $isStartElement = true)
|
||||
{
|
||||
if ($item && $control) {
|
||||
$this->addItem($item, $control, $isStartElement);
|
||||
@ -116,7 +116,7 @@ class Menu extends ScriptFeature
|
||||
* @param MenuElement $startElement Start Element
|
||||
* @return static
|
||||
*/
|
||||
public function setStartElement(MenuElement $startElement = null)
|
||||
public function setStartElement(?MenuElement $startElement = null)
|
||||
{
|
||||
$this->startElement = $startElement;
|
||||
if ($startElement && !in_array($startElement, $this->elements, true)) {
|
||||
|
@ -32,7 +32,7 @@ class MenuElement
|
||||
* @param Control $item (optional) Item Control in the Menu bar
|
||||
* @param Control $control (optional) Toggled Menu Control
|
||||
*/
|
||||
public function __construct(Control $item = null, Control $control = null)
|
||||
public function __construct(?Control $item = null, ?Control $control = null)
|
||||
{
|
||||
if ($item) {
|
||||
$this->setItem($item);
|
||||
|
@ -73,7 +73,7 @@ class Paging extends ScriptFeature
|
||||
* @param PagingPage[] $pages (optional) Pages
|
||||
* @param PagingButton[] $buttons (optional) Pageing Buttons
|
||||
*/
|
||||
public function __construct(Label $label = null, array $pages = null, array $buttons = null)
|
||||
public function __construct(?Label $label = null, ?array $pages = null, ?array $buttons = null)
|
||||
{
|
||||
if ($label) {
|
||||
$this->setLabel($label);
|
||||
|
@ -32,7 +32,7 @@ class PagingButton
|
||||
* @param Control $control (optional) Paging Control
|
||||
* @param int $pagingCount (optional) Number of browsed pages per click
|
||||
*/
|
||||
public function __construct(Control $control = null, $pagingCount = 1)
|
||||
public function __construct(?Control $control = null, $pagingCount = 1)
|
||||
{
|
||||
if ($control) {
|
||||
$this->setControl($control);
|
||||
|
@ -31,7 +31,7 @@ class PagingPage
|
||||
* @param Control $control (optional) Page Control
|
||||
* @param int $pageNumber (optional) Number of the Page
|
||||
*/
|
||||
public function __construct(Control $control = null, $pageNumber = null)
|
||||
public function __construct(?Control $control = null, $pageNumber = null)
|
||||
{
|
||||
if ($control) {
|
||||
$this->setControl($control);
|
||||
|
@ -46,7 +46,7 @@ class PlayerProfile extends ScriptFeature
|
||||
* @param Control $control (optional) Profile Control
|
||||
* @param string $labelName (optional) Script Label name
|
||||
*/
|
||||
public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK, $titleId = "Trackmania")
|
||||
public function __construct($login = null, ?Control $control = null, $labelName = ScriptLabel::MOUSECLICK, $titleId = "Trackmania")
|
||||
{
|
||||
if ($login) {
|
||||
$this->setLogin($login);
|
||||
|
@ -27,7 +27,7 @@ class Preload extends ScriptFeature
|
||||
* @api
|
||||
* @param string[] $imageUrls (optional) Image urls
|
||||
*/
|
||||
public function __construct(array $imageUrls = null)
|
||||
public function __construct(?array $imageUrls = null)
|
||||
{
|
||||
if ($imageUrls) {
|
||||
$this->setImageUrls($imageUrls);
|
||||
|
@ -40,7 +40,7 @@ class RadioButtonGroupFeature extends ScriptFeature
|
||||
* @api
|
||||
* @param Entry $entry (optional) Hidden Entry
|
||||
*/
|
||||
public function __construct(Entry $entry = null)
|
||||
public function __construct(?Entry $entry = null)
|
||||
{
|
||||
if ($entry) {
|
||||
$this->setEntry($entry);
|
||||
|
@ -54,8 +54,8 @@ class Toggle extends ScriptFeature
|
||||
* @param bool $onlyHide (optional) If it should only hide the Control but not toggle
|
||||
*/
|
||||
public function __construct(
|
||||
Control $togglingControl = null,
|
||||
Control $toggledControl = null,
|
||||
?Control $togglingControl = null,
|
||||
?Control $toggledControl = null,
|
||||
$labelName = ScriptLabel::MOUSECLICK,
|
||||
$onlyShow = false,
|
||||
$onlyHide = false
|
||||
|
@ -54,7 +54,7 @@ class Tooltip extends ScriptFeature
|
||||
* @param bool $invert (optional) If the visibility toggling should be inverted
|
||||
* @param string $text (optional) Text to display if the TooltipControl is a Label
|
||||
*/
|
||||
public function __construct(Control $hoverControl = null, Control $tooltipControl = null, $stayOnClick = null, $invert = null, $text = null)
|
||||
public function __construct(?Control $hoverControl = null, ?Control $tooltipControl = null, $stayOnClick = null, $invert = null, $text = null)
|
||||
{
|
||||
if ($hoverControl) {
|
||||
$this->setHoverControl($hoverControl);
|
||||
|
@ -85,7 +85,7 @@ class UISound extends ScriptFeature
|
||||
* @param int $variant (optional) Sound variant
|
||||
* @param string $labelName (optional) Script Label name
|
||||
*/
|
||||
public function __construct($soundName = null, Control $control = null, $variant = 0, $labelName = ScriptLabel::MOUSECLICK)
|
||||
public function __construct($soundName = null, ?Control $control = null, $variant = 0, $labelName = ScriptLabel::MOUSECLICK)
|
||||
{
|
||||
if ($soundName) {
|
||||
$this->setSoundName($soundName);
|
||||
@ -143,7 +143,7 @@ class UISound extends ScriptFeature
|
||||
* @param Control $control (optional) Sound Control
|
||||
* @return static
|
||||
*/
|
||||
public function setControl(Control $control = null)
|
||||
public function setControl(?Control $control = null)
|
||||
{
|
||||
if ($control) {
|
||||
$control->checkId();
|
||||
|
@ -56,7 +56,7 @@ class ValuePickerFeature extends ScriptFeature
|
||||
* @param string[] $values (optional) Possible values
|
||||
* @param string $default (optional) Default value
|
||||
*/
|
||||
public function __construct(Label $label = null, Entry $entry = null, array $values = null, $default = null)
|
||||
public function __construct(?Label $label = null, ?Entry $entry = null, ?array $values = null, $default = null)
|
||||
{
|
||||
if ($label) {
|
||||
$this->setLabel($label);
|
||||
|
@ -150,7 +150,7 @@ class Stylesheet
|
||||
* @param Mood $mood Mood
|
||||
* @return static
|
||||
*/
|
||||
public function setMood(Mood $mood = null)
|
||||
public function setMood(?Mood $mood = null)
|
||||
{
|
||||
$this->mood = $mood;
|
||||
return $this;
|
||||
|
@ -90,6 +90,6 @@ interface Container
|
||||
* @deprecated Use Style
|
||||
* @see Style
|
||||
*/
|
||||
public function setFormat(Format $format = null);
|
||||
public function setFormat(?Format $format = null);
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ interface Scriptable
|
||||
* @param string[] $scriptActionParameters (optional) Script action parameters
|
||||
* @return static
|
||||
*/
|
||||
public function setScriptAction($scriptAction, array $scriptActionParameters = null);
|
||||
public function setScriptAction($scriptAction, ?array $scriptActionParameters = null);
|
||||
|
||||
/**
|
||||
* Get script action parameters
|
||||
@ -62,6 +62,6 @@ interface Scriptable
|
||||
* @param string[] $scriptActionParameters (optional) Script action parameters
|
||||
* @return static
|
||||
*/
|
||||
public function setScriptActionParameters(array $scriptActionParameters = null);
|
||||
public function setScriptActionParameters(?array $scriptActionParameters = null);
|
||||
|
||||
}
|
||||
|
28
libs/Maniaplanet/DedicatedServer/Structures/ServerPlugin.php
Executable file
28
libs/Maniaplanet/DedicatedServer/Structures/ServerPlugin.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* ManiaPlanet dedicated server Xml-RPC client
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
|
||||
*/
|
||||
|
||||
namespace Maniaplanet\DedicatedServer\Structures;
|
||||
|
||||
class ServerPlugin extends AbstractStructure
|
||||
{
|
||||
/** @var string */
|
||||
public $name;
|
||||
/** @var string[] */
|
||||
public $settingsValues;
|
||||
/** @var ScriptSettings[] */
|
||||
public $settingsDesc = array();
|
||||
|
||||
/**
|
||||
* @return ScriptInfo
|
||||
*/
|
||||
public static function fromArray($array)
|
||||
{
|
||||
$object = parent::fromArray($array);
|
||||
$object->settingsDesc = ScriptSettings::fromArrayOfArray($object->paramDescs);
|
||||
return $object;
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ class ExtEventLoop implements LoopInterface
|
||||
private $writeListeners = [];
|
||||
private $running;
|
||||
|
||||
public function __construct(EventBaseConfig $config = null)
|
||||
public function __construct(?EventBaseConfig $config = null)
|
||||
{
|
||||
$this->eventBase = new EventBase($config);
|
||||
$this->nextTickQueue = new NextTickQueue($this);
|
||||
|
@ -160,7 +160,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
||||
*
|
||||
* @throws \InvalidArgumentException if the service is not defined
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null)
|
||||
public function dispatch($eventName, ?Event $event = null)
|
||||
{
|
||||
$this->lazyLoad($eventName);
|
||||
|
||||
|
@ -40,7 +40,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
* @param Stopwatch $stopwatch A Stopwatch instance
|
||||
* @param LoggerInterface $logger A LoggerInterface instance
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null)
|
||||
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, ?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->stopwatch = $stopwatch;
|
||||
@ -110,7 +110,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null)
|
||||
public function dispatch($eventName, ?Event $event = null)
|
||||
{
|
||||
if (null === $event) {
|
||||
$event = new Event();
|
||||
|
@ -27,7 +27,7 @@ class WrappedListener
|
||||
private $stopwatch;
|
||||
private $dispatcher;
|
||||
|
||||
public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
|
||||
public function __construct($listener, $name, Stopwatch $stopwatch, ?EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
$this->listener = $listener;
|
||||
$this->name = $name;
|
||||
|
@ -37,7 +37,7 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null)
|
||||
public function dispatch($eventName, ?Event $event = null)
|
||||
{
|
||||
if (null === $event) {
|
||||
$event = new Event();
|
||||
|
@ -35,7 +35,7 @@ interface EventDispatcherInterface
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null);
|
||||
public function dispatch($eventName, ?Event $event = null);
|
||||
|
||||
/**
|
||||
* Adds an event listener that listens on the specified events.
|
||||
|
@ -38,7 +38,7 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null)
|
||||
public function dispatch($eventName, ?Event $event = null)
|
||||
{
|
||||
return $this->dispatcher->dispatch($eventName, $event);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class RecordWidget {
|
||||
* @param \ManiaControl\Players\Player|null $player
|
||||
* @return \FML\Controls\Frame
|
||||
*/
|
||||
public function generateRecordLineFrame($record, Player $player = null) {
|
||||
public function generateRecordLineFrame($record, ?Player $player = null) {
|
||||
$width = $this->width;
|
||||
$lineHeight = $this->lineHeight;
|
||||
$largeNumberDiff = 0;
|
||||
@ -92,6 +92,7 @@ class RecordWidget {
|
||||
$recordFrame->addChild($quad);
|
||||
$quad->setStyles(Quad_Bgs1InRace::STYLE, Quad_Bgs1InRace::SUBSTYLE_BgCardList);
|
||||
$quad->setSize($width, $lineHeight);
|
||||
$quad->setZ(-1);
|
||||
}
|
||||
|
||||
return $recordFrame;
|
||||
@ -105,7 +106,7 @@ class RecordWidget {
|
||||
* @param \ManiaControl\Players\Player|null $player
|
||||
* @return \FML\Controls\Frame
|
||||
*/
|
||||
public function generateRecordsFrame($records, $limit, Player $player = null) {
|
||||
public function generateRecordsFrame($records, $limit, ?Player $player = null) {
|
||||
$lineHeight = $this->lineHeight;
|
||||
|
||||
$frame = new Frame();
|
||||
|
@ -83,7 +83,7 @@ class DedimaniaPlugin implements CallbackListener, CallQueueListener, CommandLis
|
||||
public static function prepare(ManiaControl $maniaControl) {
|
||||
$servers = $maniaControl->getServer()->getAllServers();
|
||||
foreach ($servers as $server) {
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_DEDIMANIA_CODE . $server->login . '$l', '');
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_DEDIMANIA_CODE . $server->login . '$l', '');
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ class DedimaniaPlugin implements CallbackListener, CallQueueListener, CommandLis
|
||||
|
||||
$this->recordWidget = new RecordWidget($this->maniaControl);
|
||||
|
||||
if ($this->maniaControl->getServer()->getGameMode() == 0) {
|
||||
if (true/*$this->maniaControl->getServer()->getGameMode() == 0*/) {
|
||||
$gameMode = $this->maniaControl->getClient()->getScriptName()['CurrentValue'];
|
||||
$this->isMultilap = ($gameMode == 'Laps.Script.txt' || $this->maniaControl->getMapManager()->getCurrentMap()->nbLaps > 0);
|
||||
$this->isRounds = ($gameMode == 'Rounds.Script.txt');
|
||||
|
@ -52,11 +52,11 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug
|
||||
* @see \ManiaControl\Plugins\Plugin::prepare()
|
||||
*/
|
||||
public static function prepare(ManiaControl $maniaControl) {
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_POINT_LIMIT_MULTIPLIER, 10);
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_POINT_LIMIT_OFFSET, 0);
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_MIN_POINT_LIMIT, 30);
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_MAX_POINT_LIMIT, 200);
|
||||
$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_ACCEPT_OTHER_MODES, false);
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_POINT_LIMIT_MULTIPLIER, 10);
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_POINT_LIMIT_OFFSET, 0);
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_MIN_POINT_LIMIT, 30);
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_MAX_POINT_LIMIT, 200);
|
||||
$maniaControl->getSettingManager()->initSetting(get_called_class(), self::SETTING_ACCEPT_OTHER_MODES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* @see \ManiaControl\Plugins\Plugin::prepare()
|
||||
*/
|
||||
public static function prepare(ManiaControl $maniaControl) {
|
||||
$thisClass = get_class();
|
||||
$thisClass = get_called_class();
|
||||
$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_MX_KARMA_ACTIVATED, true);
|
||||
$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_MX_KARMA_IMPORTING, true);
|
||||
$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_WIDGET_DISPLAY_MX, true);
|
||||
@ -343,7 +343,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
/**
|
||||
* Fetch the mxKarmaVotes for the current map
|
||||
*/
|
||||
public function getMxKarmaVotes(Player $player = null) {
|
||||
public function getMxKarmaVotes(?Player $player = null) {
|
||||
if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) {
|
||||
return;
|
||||
}
|
||||
@ -901,7 +901,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
* @param Map $map
|
||||
* @param bool $forceBuild
|
||||
*/
|
||||
private function buildManialink(Map $map = null, $forceBuild = false) {
|
||||
private function buildManialink(?Map $map = null, $forceBuild = false) {
|
||||
if (!$forceBuild) {
|
||||
return;
|
||||
}
|
||||
@ -915,7 +915,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
|
||||
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
|
||||
|
||||
$manialink = new ManiaLink(self::MLID_KARMA);
|
||||
$manialink = new ManiaLink(self::MLID_KARMA, 3);
|
||||
|
||||
$frame = new Frame();
|
||||
$manialink->addChild($frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user