This commit is contained in:
Dylan K. Taylor
2021-11-01 17:36:34 +00:00

View File

@ -27,6 +27,7 @@ use pocketmine\entity\utils\ExperienceUtils;
use pocketmine\event\player\PlayerExperienceChangeEvent;
use pocketmine\item\Durable;
use pocketmine\item\enchantment\VanillaEnchantments;
use pocketmine\utils\Limits;
use pocketmine\world\sound\XpCollectSound;
use pocketmine\world\sound\XpLevelUpSound;
use function array_rand;
@ -223,8 +224,8 @@ class ExperienceManager{
* score when they die. (TODO: add this when MCPE supports it)
*/
public function setLifetimeTotalXp(int $amount) : void{
if($amount < 0){
throw new \InvalidArgumentException("XP must be greater than 0");
if($amount < 0 || $amount > Limits::INT32_MAX){
throw new \InvalidArgumentException("XP must be greater than 0 and less than " . Limits::INT32_MAX);
}
$this->totalXp = $amount;