mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Casting cleanup and removed some 32-bit string-int leftovers
This commit is contained in:
parent
77376d3e33
commit
5b4035253b
@ -440,7 +440,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @param bool $remove
|
||||
*/
|
||||
public function setRemoveFormat(bool $remove = true){
|
||||
$this->removeFormat = (bool) $remove;
|
||||
$this->removeFormat = $remove;
|
||||
}
|
||||
|
||||
public function getScreenLineHeight() : int{
|
||||
@ -3435,7 +3435,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
if($this->connected and !$this->closed){
|
||||
|
||||
try{
|
||||
if($notify and strlen((string) $reason) > 0){
|
||||
if($notify and strlen($reason) > 0){
|
||||
$pk = new DisconnectPacket();
|
||||
$pk->message = $reason;
|
||||
$this->directDataPacket($pk);
|
||||
|
@ -428,7 +428,7 @@ class Server{
|
||||
* @return string
|
||||
*/
|
||||
public static function getGamemodeString(int $mode) : string{
|
||||
switch((int) $mode){
|
||||
switch($mode){
|
||||
case Player::SURVIVAL:
|
||||
return "%gameMode.survival";
|
||||
case Player::CREATIVE:
|
||||
@ -1209,7 +1209,7 @@ class Server{
|
||||
return (int) $v[$variable];
|
||||
}
|
||||
|
||||
return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : (int) $defaultValue;
|
||||
return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1217,7 +1217,7 @@ class Server{
|
||||
* @param int $value
|
||||
*/
|
||||
public function setConfigInt(string $variable, int $value){
|
||||
$this->properties->set($variable, (int) $value);
|
||||
$this->properties->set($variable, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,6 +180,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
/** @var float[] */
|
||||
private $unloadQueue = [];
|
||||
|
||||
/** @var int */
|
||||
private $time;
|
||||
public $stopTime;
|
||||
|
||||
@ -334,7 +335,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
$this->neighbourBlockUpdateQueue = new \SplQueue();
|
||||
|
||||
$this->time = (int) $this->provider->getTime();
|
||||
$this->time = $this->provider->getTime();
|
||||
|
||||
$this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
|
||||
$this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
|
||||
@ -668,7 +669,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
*/
|
||||
public function sendTime(Player ...$targets){
|
||||
$pk = new SetTimePacket();
|
||||
$pk->time = (int) $this->time;
|
||||
$pk->time = $this->time;
|
||||
|
||||
$this->server->broadcastPacket(count($targets) > 0 ? $targets : $this->players, $pk);
|
||||
}
|
||||
@ -1010,7 +1011,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
$this->server->getPluginManager()->callEvent(new LevelSaveEvent($this));
|
||||
|
||||
$this->provider->setTime((int) $this->time);
|
||||
$this->provider->setTime($this->time);
|
||||
$this->saveChunks();
|
||||
if($this->provider instanceof BaseLevelProvider){
|
||||
$this->provider->saveLevelData();
|
||||
@ -1090,7 +1091,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
return;
|
||||
}
|
||||
$this->scheduledBlockUpdateQueueIndex[$index] = $delay;
|
||||
$this->scheduledBlockUpdateQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());
|
||||
$this->scheduledBlockUpdateQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), $delay + $this->server->getTick());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2729,7 +2730,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @return int
|
||||
*/
|
||||
public function getTime() : int{
|
||||
return (int) $this->time;
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,19 +84,19 @@ abstract class BaseLevelProvider implements LevelProvider{
|
||||
return (string) $this->levelData["LevelName"];
|
||||
}
|
||||
|
||||
public function getTime(){
|
||||
public function getTime() : int{
|
||||
return $this->levelData["Time"];
|
||||
}
|
||||
|
||||
public function setTime($value){
|
||||
public function setTime(int $value){
|
||||
$this->levelData->Time = new LongTag("Time", $value);
|
||||
}
|
||||
|
||||
public function getSeed(){
|
||||
public function getSeed() : int{
|
||||
return $this->levelData["RandomSeed"];
|
||||
}
|
||||
|
||||
public function setSeed($value){
|
||||
public function setSeed(int $value){
|
||||
$this->levelData->RandomSeed = new LongTag("RandomSeed", $value);
|
||||
}
|
||||
|
||||
|
@ -177,24 +177,24 @@ interface LevelProvider{
|
||||
public function getName() : string;
|
||||
|
||||
/**
|
||||
* @return int|string int, or the string numeric representation of a long in 32-bit systems
|
||||
* @return int
|
||||
*/
|
||||
public function getTime();
|
||||
public function getTime() : int;
|
||||
|
||||
/**
|
||||
* @param int|string $value int, or the string numeric representation of a long in 32-bit systems
|
||||
* @param int
|
||||
*/
|
||||
public function setTime($value);
|
||||
public function setTime(int $value);
|
||||
|
||||
/**
|
||||
* @return int|string int, or the string numeric representation of a long in 32-bit systems
|
||||
* @return int
|
||||
*/
|
||||
public function getSeed();
|
||||
public function getSeed() : int;
|
||||
|
||||
/**
|
||||
* @param int|string $value int, or the string numeric representation of a long in 32-bit systems
|
||||
* @param int
|
||||
*/
|
||||
public function setSeed($value);
|
||||
public function setSeed(int $value);
|
||||
|
||||
/**
|
||||
* @return Vector3
|
||||
|
@ -260,8 +260,8 @@ class PluginManager{
|
||||
|
||||
$plugins[$name] = $file;
|
||||
|
||||
$softDependencies[$name] = (array) $description->getSoftDepend();
|
||||
$dependencies[$name] = (array) $description->getDepend();
|
||||
$softDependencies[$name] = $description->getSoftDepend();
|
||||
$dependencies[$name] = $description->getDepend();
|
||||
|
||||
foreach($description->getLoadBefore() as $before){
|
||||
if(isset($softDependencies[$before])){
|
||||
|
Loading…
x
Reference in New Issue
Block a user