use of com.palmergames.bukkit.towny.object.TownyInventory in project Towny by TownyAdvanced.
the class ResidentUtil method createTownyGUI.
/*
* Big credit goes to Hex_27 for the guidance following his ScrollerInventory
* https://www.spigotmc.org/threads/infinite-inventory-with-pages.178964/
*
* Nice and simple.
*/
private static void createTownyGUI(Resident resident, ArrayList<ItemStack> items, String name) {
Inventory page = getBlankPage(name);
ArrayList<Inventory> pages = new ArrayList<>();
for (ItemStack item : items) {
if (page.firstEmpty() == 46) {
pages.add(page);
page = getBlankPage(name);
}
page.addItem(item);
}
pages.add(page);
resident.setGUIPages(pages);
resident.setGUIPageNum(0);
new TownyInventory(resident, pages.get(0), name);
}
Aggregations