Skip to content

Commit

Permalink
Attempt to fix crash (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shock95 committed Aug 30, 2020
1 parent c998927 commit 7c739b7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: AuctionHouse
main: shock95x\auctionhouse\AuctionHouse
version: 1.2.1
version: 1.2.2
api: 3.0.0
author: Shock95x
softdepend: [EconomyAPI, InvCrashFix]
Expand Down
2 changes: 1 addition & 1 deletion src/shock95x/auctionhouse/AuctionHouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AuctionHouse extends PluginBase {

/** @var EconomyProvider */
public $economyProvider;
/** @var AuctionHouse */
/** @var ?AuctionHouse */
public static $instance;
/** @var Database */
private $database;
Expand Down
20 changes: 11 additions & 9 deletions src/shock95x/auctionhouse/menu/AHMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ public function __construct(Player $player, bool $returnMain = false, bool $pagi
$this->pagination = $pagination;

// workaround for recursive menus
if(PlayerManager::get($player)->getCurrentMenu() != null && !$this->newMenu) {
if(PlayerManager::get($player) !== null) {
$menu = PlayerManager::get($player)->getCurrentMenu();
// workaround for inventory bug
if($menu->getInventory()->getSize() < $type->getSize()) {
$player->removeWindow($menu->getInventory());
$this->createNewInventory($type);
if($menu !== null) {
if($menu->getInventory()->getSize() < $type->getSize()) {
$player->removeWindow($menu->getInventory());
$this->createNewInventory($type);
} else {
$menu->getInventory()->clearAll();
$this->inventory = $menu->getInventory();
$menu->setListener([$this, "handle"]);
}
} else {
$menu->getInventory()->clearAll();
$this->inventory = $menu->getInventory();
$menu->setListener([$this, "handle"]);
$this->createNewInventory($type);
}
} else {
$this->createNewInventory($type);
}
$this->player = $player;

Expand Down
1 change: 0 additions & 1 deletion src/shock95x/auctionhouse/utils/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Locale {

public static function init(AuctionHouse $plugin) {
self::loadLanguages($plugin->getDataFolder());

if(empty(self::$translation)) {
$plugin->getLogger()->error("No language file has been found, disabling plugin...");
$plugin->disablePlugin();
Expand Down

0 comments on commit 7c739b7

Please sign in to comment.