com.quartercode.quarterbukkit.api
Class SelectInventory

java.lang.Object
  extended by com.quartercode.quarterbukkit.api.SelectInventory
All Implemented Interfaces:
org.bukkit.event.Listener

public abstract class SelectInventory
extends java.lang.Object
implements org.bukkit.event.Listener


Nested Class Summary
static class SelectInventory.ClickType
          This enum defines four different click types.
 
Constructor Summary
SelectInventory(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, java.lang.String title, int slots)
          Creates an empty inventory for the final Player `player`, the final title `"Title"` and `9` slots.
 
Method Summary
 SelectInventory add(java.lang.Object value, org.bukkit.inventory.ItemStack itemStack)
          Adds a new item option to the inventory and sets the ItemStack directly.
 SelectInventory add(java.lang.Object value, org.bukkit.inventory.ItemStack itemStack, java.lang.String name, java.util.List<java.lang.String> descriptions)
          Adds a new item option to the inventory and sets the ItemStack directly.
 SelectInventory add(java.lang.Object value, org.bukkit.inventory.ItemStack itemStack, java.lang.String name, java.lang.String... descriptions)
          Adds a new item option to the inventory and sets the ItemStack directly.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material)
          Adds a new item option to the inventory and sets the Material.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount)
          Adds a new item option to the inventory and sets the Material and the amount.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount, short data)
          Adds a new item option to the inventory and sets the Material, the amount and the data/damage.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount, short data, java.lang.String name, java.util.List<java.lang.String> descriptions)
          Adds a new item option to the inventory and sets the Material, the amount, the data/damage, the name and the descriptions as String-List.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount, short data, java.lang.String name, java.lang.String... descriptions)
          Adds a new item option to the inventory and sets the Material, the amount, the data/damage, the name and the descriptions as String-array.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount, java.lang.String name, java.util.List<java.lang.String> descriptions)
          Adds a new item option to the inventory and sets the Material, the amount, the name and the descriptions as String-List.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, int amount, java.lang.String name, java.lang.String... descriptions)
          Adds a new item option to the inventory and sets the Material, the amount, the name and the descriptions as String-array.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, short data)
          Adds a new item option to the inventory and sets the Material and the data/damage.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, short data, java.lang.String name, java.util.List<java.lang.String> descriptions)
          Adds a new item option to the inventory and sets the Material, the data/damage, the name and the descriptions as String-List.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, short data, java.lang.String name, java.lang.String... descriptions)
          Adds a new item option to the inventory and sets the Material, the data/damage, the name and the descriptions as String-array.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, java.lang.String name, java.util.List<java.lang.String> descriptions)
          Adds a new item option to the inventory and sets the Material, the name and the descriptions as String-List.
 SelectInventory add(java.lang.Object value, org.bukkit.Material material, java.lang.String name, java.lang.String... descriptions)
          Adds a new item option to the inventory and sets the Material, the name and the descriptions as String-array.
 SelectInventory closeInventoryView()
          Closes the inventory for the holder.
 org.bukkit.inventory.Inventory getInventory()
          Returns the Inventory (don't modify the slots, it will break this class).
 org.bukkit.inventory.InventoryView getInventoryView()
          Returns the InventoryView if the inventory is open, else it is null.
 org.bukkit.entity.Player getPlayer()
          Returns the holder of the inventory as a Player.
 int getSlots()
          Returns the amount of slots of the inventory.
 java.lang.String getTitle()
          Returns the title of the inventory.
protected abstract  void onClick(java.lang.Object value, SelectInventory.ClickType clickType)
          Gets called if the holder clicks on a registered option.
 void onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)
           
 void onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent event)
           
 void onPluginDisable(org.bukkit.event.server.PluginDisableEvent event)
           
 SelectInventory openInventoryView()
          Opens the inventory for the holder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectInventory

public SelectInventory(org.bukkit.plugin.Plugin plugin,
                       org.bukkit.entity.Player player,
                       java.lang.String title,
                       int slots)
Creates an empty inventory for the final Player `player`, the final title `"Title"` and `9` slots. Of course you can define your own values, e.g. you can read the title from a language or message-config system. You can also colorize the title with ChatColors. Keep in mind the you can only define multiples of 9 as slots.

Parameters:
plugin - The binding plugin.
player - The holding player.
title - The visible title, maybe colored with ChatColors.
slots - The amount of slots.
Method Detail

openInventoryView

public SelectInventory openInventoryView()
Opens the inventory for the holder.

Returns:
This instance of SelectInventory.

closeInventoryView

public SelectInventory closeInventoryView()
Closes the inventory for the holder.

Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material)
Adds a new item option to the inventory and sets the Material.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount)
Adds a new item option to the inventory and sets the Material and the amount.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           short data)
Adds a new item option to the inventory and sets the Material and the data/damage.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
data - The data for non-damageable items and damage for damageable ones.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount,
                           short data)
Adds a new item option to the inventory and sets the Material, the amount and the data/damage.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
data - The data for non-damageable items and damage for damageable ones.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.inventory.ItemStack itemStack)
Adds a new item option to the inventory and sets the ItemStack directly.

Parameters:
value - The information for the option as Object.
itemStack - The ItemStack.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           java.lang.String name,
                           java.lang.String... descriptions)
Adds a new item option to the inventory and sets the Material, the name and the descriptions as String-array.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
name - The name of the item as String.
descriptions - The descriptions for the item as String-array.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount,
                           java.lang.String name,
                           java.lang.String... descriptions)
Adds a new item option to the inventory and sets the Material, the amount, the name and the descriptions as String-array.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
name - The name of the item as String.
descriptions - The descriptions for the item as String-array.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           short data,
                           java.lang.String name,
                           java.lang.String... descriptions)
Adds a new item option to the inventory and sets the Material, the data/damage, the name and the descriptions as String-array.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
data - The data for non-damageable items and damage for damageable ones.
name - The name of the item as String.
descriptions - The descriptions for the item as String-array.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount,
                           short data,
                           java.lang.String name,
                           java.lang.String... descriptions)
Adds a new item option to the inventory and sets the Material, the amount, the data/damage, the name and the descriptions as String-array.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
data - The data for non-damageable items and damage for damageable ones.
name - The name of the item as String.
descriptions - The descriptions for the item as String-array.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.inventory.ItemStack itemStack,
                           java.lang.String name,
                           java.lang.String... descriptions)
Adds a new item option to the inventory and sets the ItemStack directly. Furthemore, it sets the name and the descriptions as String-array.

Parameters:
value - The information for the option as Object.
itemStack - The ItemStack.
name - The name of the item as String.
descriptions - The descriptions for the item as String-array.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           java.lang.String name,
                           java.util.List<java.lang.String> descriptions)
Adds a new item option to the inventory and sets the Material, the name and the descriptions as String-List.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
name - The name of the item as String.
descriptions - The descriptions for the item as String-List.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount,
                           java.lang.String name,
                           java.util.List<java.lang.String> descriptions)
Adds a new item option to the inventory and sets the Material, the amount, the name and the descriptions as String-List.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
name - The name of the item as String.
descriptions - The descriptions for the item as String-List.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           short data,
                           java.lang.String name,
                           java.util.List<java.lang.String> descriptions)
Adds a new item option to the inventory and sets the Material, the data/damage, the name and the descriptions as String-List.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
data - The data for non-damageable items and damage for damageable ones.
name - The name of the item as String.
descriptions - The descriptions for the item as String-List.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.Material material,
                           int amount,
                           short data,
                           java.lang.String name,
                           java.util.List<java.lang.String> descriptions)
Adds a new item option to the inventory and sets the Material, the amount, the data/damage, the name and the descriptions as String-List.

Parameters:
value - The information for the option as Object.
material - The Material for the item.
amount - The amount of items.
data - The data for non-damageable items and damage for damageable ones.
name - The name of the item as String.
descriptions - The descriptions for the item as String-List.
Returns:
This instance of SelectInventory.

add

public SelectInventory add(java.lang.Object value,
                           org.bukkit.inventory.ItemStack itemStack,
                           java.lang.String name,
                           java.util.List<java.lang.String> descriptions)
Adds a new item option to the inventory and sets the ItemStack directly. Furthemore, it sets the name and the descriptions as String-List.

Parameters:
value - The information for the option as Object.
itemStack - The ItemStack.
name - The name of the item as String.
descriptions - The descriptions for the item as String-List.
Returns:
This instance of SelectInventory.

getPlayer

public org.bukkit.entity.Player getPlayer()
Returns the holder of the inventory as a Player.

Returns:
The holder of the inventory.

getTitle

public java.lang.String getTitle()
Returns the title of the inventory.

Returns:
The title of the inventory.

getSlots

public int getSlots()
Returns the amount of slots of the inventory.

Returns:
The amount of slots of the inventory.

getInventory

public org.bukkit.inventory.Inventory getInventory()
Returns the Inventory (don't modify the slots, it will break this class).

Returns:
The Inventory.

getInventoryView

public org.bukkit.inventory.InventoryView getInventoryView()
Returns the InventoryView if the inventory is open, else it is null.

Returns:
The InventoryView if the inventory is open.

onInventoryClick

public void onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)

onClick

protected abstract void onClick(java.lang.Object value,
                                SelectInventory.ClickType clickType)
Gets called if the holder clicks on a registered option.

Parameters:
value - The identifier (maybe with information).
clickType - The SelectInventory.ClickType of the click.

onInventoryClose

public void onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent event)

onPluginDisable

public void onPluginDisable(org.bukkit.event.server.PluginDisableEvent event)