Merge pull request #149

AdvancedChests hook bug fixed!
This commit is contained in:
mfnalex 2022-03-07 22:55:45 +01:00 committed by GitHub
commit 5b24c5f333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -255,7 +255,7 @@
<dependency>
<groupId>com.github.DeadSilenceIV</groupId>
<artifactId>AdvancedChestsAPI</artifactId>
<version>2.2</version>
<version>2.4</version>
<scope>provided</scope>
</dependency>

View File

@ -6,6 +6,7 @@ import org.bukkit.inventory.Inventory;
import us.lynuxcraft.deadsilenceiv.advancedchests.AdvancedChestsAPI;
import us.lynuxcraft.deadsilenceiv.advancedchests.chest.AdvancedChest;
import us.lynuxcraft.deadsilenceiv.advancedchests.chest.gui.page.ChestPage;
import us.lynuxcraft.deadsilenceiv.advancedchests.utils.inventory.InteractiveInventory;
public class AdvancedChestsHook {
@ -31,12 +32,13 @@ public class AdvancedChestsHook {
public boolean handleAChestSortingIfPresent(Inventory inventory){
if(!plugin.isHookAdvancedChests())return false;
AdvancedChest chest = AdvancedChestsAPI.getInventoryManager().getAdvancedChest(inventory);
if(chest != null){
plugin.getOrganizer().sortInventory(inventory,0,inventory.getSize()-10);
InteractiveInventory interactiveInventory = AdvancedChestsAPI.getInventoryManager().getInteractiveByBukkit(inventory);
if(interactiveInventory != null) {
if (interactiveInventory instanceof ChestPage) {
plugin.getOrganizer().sortInventory(inventory, 0, inventory.getSize() - 10);
}
return true;
}
return false;
}else return false;
}
public boolean handleAChestSortingIfPresent(Location location){