Skip to content

Commit

Permalink
Should be fixed now
Browse files Browse the repository at this point in the history
  • Loading branch information
Shock95 committed Sep 26, 2020
1 parent ed1b60e commit 5b770c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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.3
version: 1.2.4
api: 3.0.0
author: Shock95x
softdepend: [EconomyAPI, InvCrashFix]
Expand Down
14 changes: 6 additions & 8 deletions src/shock95x/auctionhouse/menu/AHMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class AHMenu extends InvMenu {
protected $pagination = false;
protected $newMenu = false;

/** @var InvMenuInventory */
/** @var ?InvMenuInventory */
protected $inventory;

public function __construct(Player $player, bool $returnMain = false, bool $pagination = false) {
Expand All @@ -35,23 +35,21 @@ public function __construct(Player $player, bool $returnMain = false, bool $pagi
$this->returnMain = $returnMain;
$this->pagination = $pagination;

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

$this->player = $player;

$this->readonly();
Expand Down Expand Up @@ -123,7 +121,7 @@ public function getPlayer() {
return $this->player;
}

public function getInventory(): InvMenuInventory {
public function getInventory(): ?InvMenuInventory {
return $this->inventory;
}

Expand Down

1 comment on commit 5b770c6

@Shock95
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#56

Please sign in to comment.