Add compatibility with php 8.2

This commit is contained in:
Beu 2023-01-17 10:06:56 +01:00
parent 16889f1a6a
commit 9e8432999b
8 changed files with 25 additions and 4 deletions

View File

@ -40,11 +40,11 @@ class OnRespawnStructure extends BasePlayerTimeStructure {
$this->numberOfRespawns = (int) $jsonObj->nbrespawns; $this->numberOfRespawns = (int) $jsonObj->nbrespawns;
$this->raceTime = (int) $jsonObj->racetime; $this->raceTime = (int) $jsonObj->racetime;
$this->lapTime = (int) $jsonObj->laptime; $this->lapTime = (int) $jsonObj->laptime;
$this->stuntsScore = $jsonObj->stuntsscore; if (isset($jsonObj->stuntsscore)) $this->stuntsScore = $jsonObj->stuntsscore;
$this->checkPointInRace = (int) $jsonObj->checkpointinrace; $this->checkPointInRace = (int) $jsonObj->checkpointinrace;
$this->checkPointInLap = (int) $jsonObj->checkpointinlap; $this->checkPointInLap = (int) $jsonObj->checkpointinlap;
$this->speed = $jsonObj->speed; $this->speed = $jsonObj->speed;
$this->distance = $jsonObj->distance; if (isset($jsonObj->distance)) $this->distance = $jsonObj->distance;
} }
/** /**

View File

@ -48,6 +48,8 @@ class ElementBuilder {
/** /**
* Private Properties * Private Properties
*/ */
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
/** @var array $actions */ /** @var array $actions */
private $actions = array(); private $actions = array();
/** @var array $columns */ /** @var array $columns */
@ -173,6 +175,7 @@ class ElementBuilder {
* @param float $textSize * @param float $textSize
*/ */
public function buildKarmaGauge($map, $width, $height, $textSize = 0.9) { public function buildKarmaGauge($map, $width, $height, $textSize = 0.9) {
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_KARMA_PLUGIN); $karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_KARMA_PLUGIN);
if (!$karmaPlugin) { if (!$karmaPlugin) {
return null; return null;

View File

@ -88,9 +88,13 @@ class Map implements Dumpable, UsageInformationAble {
$this->nbCheckpoints = $mpMap->nbCheckpoints; $this->nbCheckpoints = $mpMap->nbCheckpoints;
$this->nbLaps = $mpMap->nbLaps; $this->nbLaps = $mpMap->nbLaps;
$this->authorNick = $mpMap->authorNickname;
$player = $this->maniaControl->getPlayerManager()->getPlayer($this->authorLogin); $player = $this->maniaControl->getPlayerManager()->getPlayer($this->authorLogin);
if ($player) { if ($player) {
$this->authorNick = $player->nickname; $this->authorNick = $player->nickname;
} else if ($mpMap->authorNickname !== "") {
$this->authorNick = $mpMap->authorNickname;
} else { } else {
$this->authorNick = $this->authorLogin; $this->authorNick = $this->authorLogin;
} }

View File

@ -32,6 +32,14 @@ class PlayerDetailed {
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl = null; private $maniaControl = null;
private $width;
private $height;
private $contentY;
private $infoColWidth;
private $margin;
private $padding;
/** /**
* Create a new Player Detailed Instance * Create a new Player Detailed Instance
* *
@ -43,8 +51,6 @@ class PlayerDetailed {
// Settings // Settings
$this->width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); $this->width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth();
$this->height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); $this->height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
$this->quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle();
$this->quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle();
//Class variables //Class variables
$this->contentY = $this->height / 2 - 15; $this->contentY = $this->height / 2 - 15;

View File

@ -42,6 +42,7 @@ class Setting implements UsageInformationAble {
public $fetchTime = null; public $fetchTime = null;
public $description = null; public $description = null;
public $priority = null; public $priority = null;
public $changed = null;
/** /**
* Construct a new setting instance * Construct a new setting instance

View File

@ -18,6 +18,8 @@ class Map extends AbstractStructure
/** var string */ /** var string */
public $author; public $author;
/** var string */ /** var string */
public $authorNickname;
/** var string */
public $environnement; public $environnement;
/** var string */ /** var string */
public $mood; public $mood;

View File

@ -20,6 +20,8 @@ class PlayerInfo extends Player
/** @var bool */ /** @var bool */
public $isInOfficialMode; public $isInOfficialMode;
/** @var int */ /** @var int */
public $ladderScore;
/** @var int */
public $ladderRanking; public $ladderRanking;
/** @var int */ /** @var int */
public $spectatorStatus; public $spectatorStatus;

View File

@ -7,6 +7,7 @@
namespace Maniaplanet\DedicatedServer\Structures; namespace Maniaplanet\DedicatedServer\Structures;
#[\AllowDynamicProperties] // Allow Dynamic Properties for php 8.2 and above
class ServerOptions extends AbstractStructure class ServerOptions extends AbstractStructure
{ {
/** @var string */ /** @var string */
@ -17,6 +18,8 @@ class ServerOptions extends AbstractStructure
public $password; public $password;
/** @var string */ /** @var string */
public $passwordForSpectator; public $passwordForSpectator;
/** @var string */
public $nextCallVoteTimeOut;
/** @var float */ /** @var float */
public $callVoteRatio; public $callVoteRatio;