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->raceTime = (int) $jsonObj->racetime;
$this->lapTime = (int) $jsonObj->laptime;
$this->stuntsScore = $jsonObj->stuntsscore;
if (isset($jsonObj->stuntsscore)) $this->stuntsScore = $jsonObj->stuntsscore;
$this->checkPointInRace = (int) $jsonObj->checkpointinrace;
$this->checkPointInLap = (int) $jsonObj->checkpointinlap;
$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
*/
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
/** @var array $actions */
private $actions = array();
/** @var array $columns */
@ -173,6 +175,7 @@ class ElementBuilder {
* @param float $textSize
*/
public function buildKarmaGauge($map, $width, $height, $textSize = 0.9) {
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_KARMA_PLUGIN);
if (!$karmaPlugin) {
return null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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