Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Latest commit

 

History

History
80 lines (58 loc) · 2.31 KB

README.md

File metadata and controls

80 lines (58 loc) · 2.31 KB

BungeeInventories [Archived]

A simple API to send Inventories to Spigot Servers and let players open them.

Setup

Download the newest version of the API's and import them into you're plugins You don't have to make a Spigot Plugin with the Library, only if you want to change something described in the following spigot documentation Don't export the Libraries, just put them on your servers as plugins.

Development

Bungeecord

Creating an Inventory:
BungeeInventory chestInventory = new BungeeInventory("§7Server-GUI", 3*9);

BungeeInventory furnaceInventory = new BungeeInventory("§7Multi Server Furnace", InventoryType.FURNACE);

Filling an Inventory:
ItemStack lobbyItem = new ItemStack("CLOCK", "§6Lobby", "§7Click to be send to the Lobby");
ItemStack pvpItem = new ItemStack("DIAMOND_SWORD", "§bPvP");

inventory.addItem(pvpItem);
inventory.setItem(15, lobbyItem);

Sending an Inventory:

You can choose an OpenInventoryType to choose when the inventory should open or not. Default value is OpenInventoryType.ALWAYS

BungeeInventoryManager.getInstance().sendInventory(player, inventory);

BungeeInventoryManager.getInstance().sendInventory(player, inventory, OpenInventoryType.ONLY_WHEN_INVENTORY_CLOSED);

Overwrite maySendInventory

With overwriting this Factory you can block sending specified inventories when a condition is true or lots of other Things. This Factory returns a boolean.

BungeeInventoryManager.getInstance().setMaySendInventory((player, inventory) -> {
	if (...) {
		// Inventory will be sent to Spigot Server
		return true;
	}
	// Inventory will not be sent to Spigot Server
	return false;
 });

Spigot

Overwrite mayOpenInventory

With overwriting this Factory you can block sending specified inventories when a condition is true or lots of other Things like play Sounds. This Factory returns a boolean.

BungeeInventoryManager.getInstance().setMayOpenInventory((player, inventory) -> {
	if (...) {
		// Inventory will be opened
		return true;
	}
	// Inventory will not be opened
	return false;
 });