com.quartercode.quarterbukkit.api.select
Class SelectInventory

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

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

This class is for simple creating of custom selection Inventorys. You can define your own titles using ChatColors and sort your selections in the Inventory.


Constructor Summary
SelectInventory(org.bukkit.plugin.Plugin plugin)
          Creates an empty select inventory without a title.
SelectInventory(org.bukkit.plugin.Plugin plugin, InventoryLayouter layouter)
          Creates an empty select inventory with an InventoryLayouter.
SelectInventory(org.bukkit.plugin.Plugin plugin, java.lang.String title)
          Creates an empty select inventory with a title.
SelectInventory(org.bukkit.plugin.Plugin plugin, java.lang.String title, InventoryLayouter layouter)
          Creates an empty select inventory with a title and an InventoryLayouter.
 
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 clear()
          Clears all existing item options.
 void close(org.bukkit.entity.Player player)
          Closes the Inventory for a defined Player.
 void closeAll()
          Closes all open Inventorys.
 InventoryLayouter getLayouter()
          Returns the InventoryLayouter.
 java.util.List<Selection> getSelections()
          Returns all existing selections.
 java.lang.String getTitle()
          Returns the title of the Inventory.
 boolean isOpen(org.bukkit.entity.Player player)
          Returns if the defined Player has an open Inventory of this SelectInventory.
protected abstract  void onClick(Selection selection, ClickType clickType, org.bukkit.entity.Player player)
          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)
           
 void open(org.bukkit.entity.Player player)
          Opens an Inventory for a defined Player.
 SelectInventory remove(java.lang.Object value)
          Removes an existing item option from the inventory.
 void setLayouter(InventoryLayouter layouter)
          Sets the new InventoryLayouter.
 void setTitle(java.lang.String title)
          Sets the title of the Inventory.
 
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)
Creates an empty select inventory without a title.

Parameters:
plugin - The plugin to bind the internal methods on.

SelectInventory

public SelectInventory(org.bukkit.plugin.Plugin plugin,
                       java.lang.String title)
Creates an empty select inventory with a title. You can also colorize the title with ChatColors.

Parameters:
plugin - The plugin to bind the internal methods on.
title - The visible title, maybe colored with ChatColors.

SelectInventory

public SelectInventory(org.bukkit.plugin.Plugin plugin,
                       InventoryLayouter layouter)
Creates an empty select inventory with an InventoryLayouter.

Parameters:
plugin - The plugin to bind the internal methods on.
layouter - The InventoryLayouter for layouting the Inventory.

SelectInventory

public SelectInventory(org.bukkit.plugin.Plugin plugin,
                       java.lang.String title,
                       InventoryLayouter layouter)
Creates an empty select inventory with a title and an InventoryLayouter. You can also colorize the title with ChatColors.

Parameters:
plugin - The plugin to bind the internal methods on.
title - The visible title, maybe colored with ChatColors.
layouter - The InventoryLayouter for layouting the Inventory.
Method Detail

getTitle

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

Returns:
The title of the Inventory.

setTitle

public void setTitle(java.lang.String title)
Sets the title of the Inventory.

Parameters:
title - The new title of the Inventory.

getLayouter

public InventoryLayouter getLayouter()
Returns the InventoryLayouter.

Returns:
The InventoryLayouter.

setLayouter

public void setLayouter(InventoryLayouter layouter)
Sets the new InventoryLayouter.

Parameters:
layouter - The new InventoryLayouter.

getSelections

public java.util.List<Selection> getSelections()
Returns all existing selections.

Returns:
All existing selections.

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.

remove

public SelectInventory remove(java.lang.Object value)
Removes an existing item option from the inventory.

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

clear

public SelectInventory clear()
Clears all existing item options.

Returns:
This instance of SelectInventory.

isOpen

public boolean isOpen(org.bukkit.entity.Player player)
Returns if the defined Player has an open Inventory of this SelectInventory.

Parameters:
player - The Player to check.
Returns:
If the defined Player has an open Inventory of this SelectInventory.

open

public void open(org.bukkit.entity.Player player)
Opens an Inventory for a defined Player.

Parameters:
player - The Player which gets the Inventory.

close

public void close(org.bukkit.entity.Player player)
Closes the Inventory for a defined Player.

Parameters:
player - The Player which inventory should get closed.

closeAll

public void closeAll()
Closes all open Inventorys.


onInventoryClick

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

onClick

protected abstract void onClick(Selection selection,
                                ClickType clickType,
                                org.bukkit.entity.Player player)
Gets called if the holder clicks on a registered option.

Parameters:
selection - The selected Selection (with the informational value and the graphical ItemStack).
clickType - The ClickType of the click.
player - The Player who selected.

onInventoryClose

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

onPluginDisable

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