mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Human: beware negative values in addXp()
This commit is contained in:
parent
1fe4fdc67c
commit
42171f6e06
@ -400,7 +400,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
* @param bool $playSound Whether to play level-up and XP gained sounds.
|
* @param bool $playSound Whether to play level-up and XP gained sounds.
|
||||||
*/
|
*/
|
||||||
public function addXp(int $amount, bool $playSound = true) : bool{
|
public function addXp(int $amount, bool $playSound = true) : bool{
|
||||||
$this->totalXp += $amount;
|
if($amount > 0){
|
||||||
|
$this->totalXp += $amount;
|
||||||
|
}
|
||||||
|
|
||||||
$oldLevel = $this->getXpLevel();
|
$oldLevel = $this->getXpLevel();
|
||||||
$oldTotal = $this->getCurrentTotalXp();
|
$oldTotal = $this->getCurrentTotalXp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user