Remove INT32_MIN and INT32_MAX global constants

This commit is contained in:
Dylan K. Taylor
2019-08-25 16:09:51 +01:00
parent 95a4081d24
commit 39d5903c3e
8 changed files with 17 additions and 25 deletions

View File

@@ -49,6 +49,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
use pocketmine\network\mcpe\protocol\types\entity\StringMetadataProperty;
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
use pocketmine\player\Player;
use pocketmine\utils\Limits;
use pocketmine\utils\UUID;
use pocketmine\world\sound\TotemUseSound;
use pocketmine\world\World;
@@ -59,8 +60,6 @@ use function in_array;
use function min;
use function random_int;
use function strlen;
use const INT32_MAX;
use const INT32_MIN;
class Human extends Living implements ProjectileSource, InventoryHolder{
@@ -274,7 +273,7 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
if($nbt->hasTag("XpSeed", IntTag::class)){
$this->xpSeed = $nbt->getInt("XpSeed");
}else{
$this->xpSeed = random_int(INT32_MIN, INT32_MAX);
$this->xpSeed = random_int(Limits::INT32_MIN, Limits::INT32_MAX);
}
}

View File

@@ -24,8 +24,8 @@ declare(strict_types=1);
namespace pocketmine\entity\effect;
use pocketmine\utils\Color;
use pocketmine\utils\Limits;
use function max;
use const INT32_MAX;
class EffectInstance{
/** @var Effect */
@@ -89,8 +89,8 @@ class EffectInstance{
* @return $this
*/
public function setDuration(int $duration) : EffectInstance{
if($duration < 0 or $duration > INT32_MAX){
throw new \InvalidArgumentException("Effect duration must be in range 0 - " . INT32_MAX . ", got $duration");
if($duration < 0 or $duration > Limits::INT32_MAX){
throw new \InvalidArgumentException("Effect duration must be in range 0 - " . Limits::INT32_MAX . ", got $duration");
}
$this->duration = $duration;