diff --git a/README.md b/README.md index fd612b5..032041c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ AuctionHouse allows players to list their items for sale and purchase items that - And more coming soon! --- ## Download -Check the [releases tab](https://github.com/Shock95x/AuctionHouse/releases) or [PoggitCI](https://poggit.pmmp.io/ci/Shock95x/AuctionHouse/AuctionHouse/) +Download the plugin from [Poggit](https://poggit.pmmp.io/p/AuctionHouse) or [GitHub releases](https://github.com/Shock95x/AuctionHouse/releases) --- ## Config diff --git a/src/shock95x/auctionhouse/database/utils/BinaryStringParser.php b/src/shock95x/auctionhouse/database/utils/BinaryStringParser.php index 392007a..7290ba6 100644 --- a/src/shock95x/auctionhouse/database/utils/BinaryStringParser.php +++ b/src/shock95x/auctionhouse/database/utils/BinaryStringParser.php @@ -6,12 +6,14 @@ final class BinaryStringParser{ - public static function fromDatabase(string $type) : BinaryStringParserInstance{ + public static function fromDatabase(string $type) : ?BinaryStringParserInstance { switch($type){ case "mysql": return new MySQLBinaryStringParser(); case "sqlite": return new SQLiteBinaryStringParser(); + default: + return null; } } } \ No newline at end of file diff --git a/src/shock95x/auctionhouse/economy/EconomyProvider.php b/src/shock95x/auctionhouse/economy/EconomyProvider.php index 0461ce5..5d34a41 100644 --- a/src/shock95x/auctionhouse/economy/EconomyProvider.php +++ b/src/shock95x/auctionhouse/economy/EconomyProvider.php @@ -2,24 +2,26 @@ namespace shock95x\auctionhouse\economy; +use pocketmine\Player; + interface EconomyProvider { /** - * @param $player - * @param int $amount + * @param string|Player $player + * @param int|float $amount */ public function addMoney($player, int $amount): void; /** - * @param $player - * @param int $amount + * @param string|Player $player + * @param int|float $amount */ public function subtractMoney($player, int $amount): void; /** - * @param $player + * @param string|Player $player * - * @return int + * @return int|float */ public function getMoney($player): int; diff --git a/src/shock95x/auctionhouse/economy/EconomySProvider.php b/src/shock95x/auctionhouse/economy/EconomySProvider.php index 9e57c1e..3d43a74 100644 --- a/src/shock95x/auctionhouse/economy/EconomySProvider.php +++ b/src/shock95x/auctionhouse/economy/EconomySProvider.php @@ -2,6 +2,7 @@ namespace shock95x\auctionhouse\economy; use onebone\economyapi\EconomyAPI; +use pocketmine\Player; use ReflectionException; class EconomySProvider implements EconomyProvider { @@ -17,18 +18,16 @@ public function __construct() { } /** - * @param $player - * @param int $amount - * - * @throws ReflectionException + * @param string|Player $player + * @param int|float $amount */ public function addMoney($player, int $amount): void { $this->economyAPI->addMoney($player, $amount); } /** - * @param $player - * @param int $amount + * @param string|Player $player + * @param int|float $amount * * @throws ReflectionException */ @@ -37,9 +36,9 @@ public function subtractMoney($player, int $amount): void { } /** - * @param $player + * @param string|Player $player * - * @return int + * @return int|float */ public function getMoney($player): int { return $this->economyAPI->myMoney($player); diff --git a/src/shock95x/auctionhouse/menu/AHMenu.php b/src/shock95x/auctionhouse/menu/AHMenu.php index 613b0e9..bd30f47 100644 --- a/src/shock95x/auctionhouse/menu/AHMenu.php +++ b/src/shock95x/auctionhouse/menu/AHMenu.php @@ -39,7 +39,7 @@ public function __construct(Player $player, bool $returnMain = false, bool $pagi if(PlayerManager::get($player) !== null) { $menu = PlayerManager::get($player)->getCurrentMenu(); // workaround for inventory bug - if($menu !== null) { + if($menu !== null && $menu instanceof AHMenu) { if($menu->getInventory()->getSize() < $type->getSize()) { $player->removeWindow($menu->getInventory()); $this->createNewInventory($type); diff --git a/src/shock95x/auctionhouse/utils/Locale.php b/src/shock95x/auctionhouse/utils/Locale.php index 60e8cec..4c38a36 100644 --- a/src/shock95x/auctionhouse/utils/Locale.php +++ b/src/shock95x/auctionhouse/utils/Locale.php @@ -41,12 +41,13 @@ public static function loadLanguages(String $dataFolder) { * Gets messages from lang files * * @param Player|null $sender - * @param $key + * @param string $key * @param bool $return * @param bool $prefix - * @return mixed|string + * + * @return string|string[]|bool */ - public static function getMessage(?Player $sender, $key, bool $return = false, $prefix = true) { + public static function getMessage(?Player $sender, string $key, bool $return = false, $prefix = true) { $locale = Settings::getDefaultLang(); if(isset(self::$translation[strtolower($sender->getLocale())])) { $locale = $sender->getLocale();