API
SimpleGUI Creator API
You need to [soft]depend on "SimpleGUI Creator"
GuiAPI
GuiAPI api = ((SimpleGUI) Bukkit.getPluginManager().getPlugin("SimpleGUI Creator")).getAPI(Your Plugin Here); guiAPI.getGUIs(); guiAPI.getGUI(guiTitle); guiAPI.openGUI(guiTitle, player); guiAPI.createGUI(guiTitle, rows, Items[], Actions[]); guiAPI.editGUI(guiTitle, position, itemName, item, action); guiAPI.tempGUI(guiTitle, rows, Items[], Actions[]);
getGUIs(); - Set<String>
- Returns a list of all GUI Titles/Names
getGUI(guiTitle); - InventoryMenu
- guiTitle - Gets the GUI with the specified name, null if GUI Title does not exist
- Color Codes in here will make this always return null
openGUI(guiTitle, player); - boolean
- guiTitle - The GUI Name that is the "GUI.Name"
- player - The player with which to open the GUI from
createGUI(guiTitle, rows, Items[], Actions[]); - boolean
- This GUI will only be removed on plugin reload
- guiTitle - Creates a GUI with the specified name
- rows - How many rows should the GUI be
- Items[] - "ItemStack[] items = new ItemStack[] { new ItemStack(Material.STONE), new ItemStack(Material.DIRT) };
- Supports ItemMeta... This means add any lore, item name, amount, damage value you want and that GUI will have it
- First Item is slot 1, second item is slot 2, etc
- If you have a slot that you want to be nothing make the Item Type be Material.AIR
- Actions[] - A String[] of actions for this GUI.
- First String is slot 1, second string is slot 2, etc
- If you have a slot that you don't want to have an action just do ""
- The actions line up with the Items[]
editGUI(guiTitle, position, itemName, item, action); - boolean
- guiTitle - The GUI to edit
- position - the Slot you want to change
- Item - This is an ItemStack, also supports ItemMeta
- action - A String, Change the action to this.
tempGUI(guiTitle, rows, Items[], Actions[]); - InventoryMenu
- This GUI will be removed as soon as someone opens it. PS... If you create multiple tempGUIs with the same name then there will be problems
- guiTitle - Create a Temp GUI that will be removed after its used
- rows - How many rows should the GUI be
- Items[] - "ItemStack[] items = new ItemStack[] { new ItemStack(Material.STONE), new ItemStack(Material.DIRT) };
- Supports ItemMeta... This means add any lore, item name, amount, damage value you want and that GUI will have it
- First Item is slot 1, second item is slot 2, etc
- If you have a slot that you want to be nothing make the Item Type be Material.AIR
- Actions[] - A String[] of actions for this GUI.
- First String is slot 1, second string is slot 2, etc
- If you have a slot that you don't want to have an action just do ""
- The actions line up with the Items[]
GUI Events
public class GUIListener implements Listener { @EventHandler public void onGUIClick(GUIClickEvent event) { event.getPlayer(); event.getGUITitle(); event.getGUI(); event.getSlotClicked(); event.getClickedItem(); event.getAction(); } @EventHandler public void onGUIClose(GUICloseEvent event) { event.getPlayer(); event.getGUI(); event.getGUITitle(); } @EventHandler public void onGUICreate(GUICreateEvent event) { event.getGUITitle(); event.getGUI(); event.getFileName(); event.getFile(); //Not implemented... Commented out } @EventHandler public void onGUIOpen(GUIOpenEvent event) { event.getPlayer(); event.getGUITitle(); event.getGUI(); } }
Comments