Skip to content

Commit

Permalink
Merge pull request #2 from DaPigGuy/pmmp-4.0.0
Browse files Browse the repository at this point in the history
PMMP 4.0 Support
  • Loading branch information
Aericio authored Feb 17, 2022
2 parents 1866475 + 9df4305 commit d358c84
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions .poggit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/DaPigGuy/libPiggyEconomy
branches:
- master
- pmmp-4.0.0
projects:
libPiggyEconomy:
model: virion
Expand Down
7 changes: 1 addition & 6 deletions src/DaPigGuy/libPiggyEconomy/providers/EconomyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

namespace DaPigGuy\libPiggyEconomy\providers;

use pocketmine\player\Player;

use pocketmine\Player;

/**
* Interface EconomyProvider
* @package DaPigGuy\libPiggyEconomy\providers
*/
abstract class EconomyProvider
{
public static function checkDependencies(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace DaPigGuy\libPiggyEconomy\providers;

use onebone\economyapi\EconomyAPI;
use pocketmine\Player;
use pocketmine\player\Player;
use pocketmine\Server;

class EconomySProvider extends EconomyProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace DaPigGuy\libPiggyEconomy\providers;

use DaPigGuy\libPiggyEconomy\exceptions\UnknownMultiEconomyCurrencyException;
use pocketmine\Player;
use pocketmine\player\Player;
use pocketmine\Server;
use Twisted\MultiEconomy\Currency;
use Twisted\MultiEconomy\MultiEconomy;
Expand Down
12 changes: 6 additions & 6 deletions src/DaPigGuy/libPiggyEconomy/providers/XPProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace DaPigGuy\libPiggyEconomy\providers;

use pocketmine\entity\utils\ExperienceUtils;
use pocketmine\Player;
use pocketmine\player\Player;

class XPProvider extends EconomyProvider
{
Expand All @@ -16,14 +16,14 @@ public function getMonetaryUnit(): string

public function getMoney(Player $player): float
{
return $player->getXpLevel() + $player->getXpProgress();
return $player->getXpManager()->getXpLevel() + $player->getXpManager()->getXpProgress();
}

public function giveMoney(Player $player, float $amount): void
{
$levels = (int)floor($amount);
$player->addXpLevels($levels);
$player->addXp((int)(ExperienceUtils::getXpToCompleteLevel($player->getXpLevel()) * ($amount - $levels)));
$player->getXpManager()->addXpLevels($levels);
$player->getXpManager()->addXp((int)(ExperienceUtils::getXpToCompleteLevel($player->getXpManager()->getXpLevel()) * ($amount - $levels)));
}

public function takeMoney(Player $player, float $amount): void
Expand All @@ -34,7 +34,7 @@ public function takeMoney(Player $player, float $amount): void
public function setMoney(Player $player, float $amount): void
{
$levels = (int)floor($amount);
$player->setXpLevel($levels);
$player->setXpProgress($amount - $levels);
$player->getXpManager()->setXpLevel($levels);
$player->getXpManager()->setXpProgress($amount - $levels);
}
}
2 changes: 1 addition & 1 deletion virion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: libPiggyEconomy
version: 2.0.0
antigen: DaPigGuy\libPiggyEconomy
api: 3.0.0
api: 4.0.0
author: DaPigGuy

0 comments on commit d358c84

Please sign in to comment.