Pulling all pending Bukkit-JavaDoc changes
A special thanks goes to @aerouk for almost all of the changes found here. By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of an Anvil.
|
||||
*/
|
||||
public interface AnvilInventory extends Inventory {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of a Beacon.
|
||||
*/
|
||||
public interface BeaconInventory extends Inventory {
|
||||
|
||||
/**
|
||||
@@ -8,6 +11,7 @@ public interface BeaconInventory extends Inventory {
|
||||
* @param item The new item
|
||||
*/
|
||||
void setItem(ItemStack item);
|
||||
|
||||
/**
|
||||
* Get the item powering the beacon.
|
||||
*
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.bukkit.inventory;
|
||||
|
||||
import org.bukkit.block.BrewingStand;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of a Brewing Stand.
|
||||
*/
|
||||
public interface BrewerInventory extends Inventory {
|
||||
|
||||
/**
|
||||
@@ -10,6 +13,7 @@ public interface BrewerInventory extends Inventory {
|
||||
* @return The ingredient.
|
||||
*/
|
||||
ItemStack getIngredient();
|
||||
|
||||
/**
|
||||
* Set the current ingredient for brewing.
|
||||
*
|
||||
|
||||
@@ -11,29 +11,35 @@ public interface CraftingInventory extends Inventory {
|
||||
* @return The result item.
|
||||
*/
|
||||
ItemStack getResult();
|
||||
|
||||
/**
|
||||
* Get the contents of the crafting matrix.
|
||||
*
|
||||
* @return The contents.
|
||||
*/
|
||||
ItemStack[] getMatrix();
|
||||
|
||||
/**
|
||||
* Set the item in the result slot of the crafting inventory.
|
||||
*
|
||||
* @param newResult The new result item.
|
||||
*/
|
||||
void setResult(ItemStack newResult);
|
||||
|
||||
/**
|
||||
* Replace the contents of the crafting matrix
|
||||
*
|
||||
* @param contents The new contents.
|
||||
* @throws IllegalArgumentException if the length of contents is greater than the size of the crafting matrix.
|
||||
* @throws IllegalArgumentException if the length of contents is greater
|
||||
* than the size of the crafting matrix.
|
||||
*/
|
||||
void setMatrix(ItemStack[] contents);
|
||||
|
||||
/**
|
||||
* Get the current recipe formed on the crafting inventory, if any.
|
||||
*
|
||||
* @return The recipe, or null if the current contents don't match any recipe.
|
||||
* @return The recipe, or null if the current contents don't match any
|
||||
* recipe.
|
||||
*/
|
||||
Recipe getRecipe();
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package org.bukkit.inventory;
|
||||
|
||||
import org.bukkit.block.DoubleChest;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of a Double Chest.
|
||||
*/
|
||||
public interface DoubleChestInventory extends Inventory {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of an Enchantment Table.
|
||||
*/
|
||||
public interface EnchantingInventory extends Inventory {
|
||||
|
||||
/**
|
||||
@@ -8,6 +11,7 @@ public interface EnchantingInventory extends Inventory {
|
||||
* @param item The new item
|
||||
*/
|
||||
void setItem(ItemStack item);
|
||||
|
||||
/**
|
||||
* Get the item being enchanted.
|
||||
*
|
||||
|
||||
@@ -97,20 +97,26 @@ public interface EntityEquipment {
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Gets the chance of the currently held item being dropped upon this creature's death
|
||||
* Gets the chance of the currently held item being dropped upon this
|
||||
* creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @return chance of the currently held item being dropped (1 for players)
|
||||
*/
|
||||
float getItemInHandDropChance();
|
||||
|
||||
/**
|
||||
* Sets the chance of the item this creature is currently holding being dropped upon this creature's death
|
||||
* Sets the chance of the item this creature is currently holding being
|
||||
* dropped upon this creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @param chance the chance of the currently held item being dropped
|
||||
* @throws UnsupportedOperationException when called on players
|
||||
@@ -120,8 +126,10 @@ public interface EntityEquipment {
|
||||
/**
|
||||
* Gets the chance of the helmet being dropped upon this creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @return the chance of the helmet being dropped (1 for players)
|
||||
*/
|
||||
@@ -130,8 +138,10 @@ public interface EntityEquipment {
|
||||
/**
|
||||
* Sets the chance of the helmet being dropped upon this creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @param chance of the helmet being dropped
|
||||
* @throws UnsupportedOperationException when called on players
|
||||
@@ -139,20 +149,26 @@ public interface EntityEquipment {
|
||||
void setHelmetDropChance(float chance);
|
||||
|
||||
/**
|
||||
* Gets the chance of the chest plate being dropped upon this creature's death
|
||||
* Gets the chance of the chest plate being dropped upon this creature's
|
||||
* death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @return the chance of the chest plate being dropped (1 for players)
|
||||
*/
|
||||
float getChestplateDropChance();
|
||||
|
||||
/**
|
||||
* Sets the chance of the chest plate being dropped upon this creature's death
|
||||
* Sets the chance of the chest plate being dropped upon this creature's
|
||||
* death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @param chance of the chest plate being dropped
|
||||
* @throws UnsupportedOperationException when called on players
|
||||
@@ -160,20 +176,26 @@ public interface EntityEquipment {
|
||||
void setChestplateDropChance(float chance);
|
||||
|
||||
/**
|
||||
* Gets the chance of the leggings being dropped upon this creature's death
|
||||
* Gets the chance of the leggings being dropped upon this creature's
|
||||
* death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @return the chance of the leggings being dropped (1 for players)
|
||||
*/
|
||||
float getLeggingsDropChance();
|
||||
|
||||
/**
|
||||
* Sets the chance of the leggings being dropped upon this creature's death
|
||||
* Sets the chance of the leggings being dropped upon this creature's
|
||||
* death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @param chance chance of the leggings being dropped
|
||||
* @throws UnsupportedOperationException when called on players
|
||||
@@ -183,8 +205,10 @@ public interface EntityEquipment {
|
||||
/**
|
||||
* Gets the chance of the boots being dropped upon this creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @return the chance of the boots being dropped (1 for players)
|
||||
*/
|
||||
@@ -193,8 +217,10 @@ public interface EntityEquipment {
|
||||
/**
|
||||
* Sets the chance of the boots being dropped upon this creature's death
|
||||
* <p>
|
||||
* <li />A drop chance of 0F will never drop
|
||||
* <li />A drop chance of 1F will always drop
|
||||
* <ul>
|
||||
* <li>A drop chance of 0F will never drop
|
||||
* <li>A drop chance of 1F will always drop
|
||||
* </ul>
|
||||
*
|
||||
* @param chance of the boots being dropped
|
||||
* @throws UnsupportedOperationException when called on players
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.bukkit.inventory;
|
||||
|
||||
import org.bukkit.block.Furnace;
|
||||
|
||||
/**
|
||||
* Interface to the inventory of a Furnace.
|
||||
*/
|
||||
public interface FurnaceInventory extends Inventory {
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,8 @@ public class FurnaceRecipe implements Recipe {
|
||||
*
|
||||
* @param result The item you want the recipe to create.
|
||||
* @param source The input material.
|
||||
* @param data The data value. (Note: This is currently ignored by the CraftBukkit server.)
|
||||
* @param data The data value. (Note: This is currently ignored by the
|
||||
* CraftBukkit server.)
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -68,7 +69,8 @@ public class FurnaceRecipe implements Recipe {
|
||||
* Sets the input of this furnace recipe.
|
||||
*
|
||||
* @param input The input material.
|
||||
* @param data The data value. (Note: This is currently ignored by the CraftBukkit server.)
|
||||
* @param data The data value. (Note: This is currently ignored by the
|
||||
* CraftBukkit server.)
|
||||
* @return The changed recipe, so you can chain calls.
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
/**
|
||||
* An interface to the inventory of a Horse.
|
||||
*/
|
||||
public interface HorseInventory extends Inventory {
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,8 @@ import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
* Interface to the various inventories. Behavior relating to {@link Material#AIR} is unspecified.
|
||||
* Interface to the various inventories. Behavior relating to {@link
|
||||
* Material#AIR} is unspecified.
|
||||
*/
|
||||
public interface Inventory extends Iterable<ItemStack> {
|
||||
|
||||
@@ -28,15 +29,17 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public int getMaxStackSize();
|
||||
|
||||
/**
|
||||
* This method allows you to change the maximum stack size for an inventory.
|
||||
* <p><b>Caveats:</b>
|
||||
* This method allows you to change the maximum stack size for an
|
||||
* inventory.
|
||||
* <p>
|
||||
* <b>Caveats:</b>
|
||||
* <ul>
|
||||
* <li>Not all inventories respect this value.
|
||||
* <li>Stacks larger than 127 may be clipped when the world is saved.
|
||||
* <li>This value is not guaranteed to be preserved; be sure to set it before every time
|
||||
* you want to set a slot over the max stack size.
|
||||
* <li>Stacks larger than the default max size for this type of inventory may not display
|
||||
* correctly in the client.
|
||||
* <li>This value is not guaranteed to be preserved; be sure to set it
|
||||
* before every time you want to set a slot over the max stack size.
|
||||
* <li>Stacks larger than the default max size for this type of inventory
|
||||
* may not display correctly in the client.
|
||||
* </ul>
|
||||
*
|
||||
* @param size The new maximum stack size for items in this inventory.
|
||||
@@ -67,13 +70,13 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public void setItem(int index, ItemStack item);
|
||||
|
||||
/**
|
||||
* Stores the given ItemStacks in the inventory.
|
||||
* This will try to fill existing stacks and empty slots as well as it can.
|
||||
* Stores the given ItemStacks in the inventory. This will try to fill
|
||||
* existing stacks and empty slots as well as it can.
|
||||
* <p>
|
||||
* The returned HashMap contains what it couldn't store, where the key is the
|
||||
* index of the parameter, and the value is the ItemStack at that index
|
||||
* of the varargs parameter. If all items are stored, it will return an
|
||||
* empty HashMap.
|
||||
* The returned HashMap contains what it couldn't store, where the key is
|
||||
* the index of the parameter, and the value is the ItemStack at that
|
||||
* index of the varargs parameter. If all items are stored, it will return
|
||||
* an empty HashMap.
|
||||
* <p>
|
||||
* If you pass in ItemStacks which exceed the maximum stack size for the
|
||||
* Material, first they will be added to partial stacks where
|
||||
@@ -91,13 +94,13 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
/**
|
||||
* Removes the given ItemStacks from the inventory.
|
||||
* <p>
|
||||
* It will try to remove 'as much as possible' from the types and amounts you
|
||||
* give as arguments.
|
||||
* It will try to remove 'as much as possible' from the types and amounts
|
||||
* you give as arguments.
|
||||
* <p>
|
||||
* The returned HashMap contains what it couldn't remove, where the key is the
|
||||
* index of the parameter, and the value is the ItemStack at that index of the
|
||||
* varargs parameter. If all the given ItemStacks are removed, it will return
|
||||
* an empty HashMap.
|
||||
* The returned HashMap contains what it couldn't remove, where the key is
|
||||
* the index of the parameter, and the value is the ItemStack at that
|
||||
* index of the varargs parameter. If all the given ItemStacks are
|
||||
* removed, it will return an empty HashMap.
|
||||
*
|
||||
* @param items The ItemStacks to remove
|
||||
* @return A HashMap containing items that couldn't be removed.
|
||||
@@ -116,13 +119,16 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
* Completely replaces the inventory's contents. Removes all existing
|
||||
* contents and replaces it with the ItemStacks given in the array.
|
||||
*
|
||||
* @param items A complete replacement for the contents; the length must be less than or equal to {@link #getSize()}.
|
||||
* @throws IllegalArgumentException If the array has more items than the inventory.
|
||||
* @param items A complete replacement for the contents; the length must
|
||||
* be less than or equal to {@link #getSize()}.
|
||||
* @throws IllegalArgumentException If the array has more items than the
|
||||
* inventory.
|
||||
*/
|
||||
public void setContents(ItemStack[] items) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks with the given materialId
|
||||
* Checks if the inventory contains any ItemStacks with the given
|
||||
* materialId
|
||||
*
|
||||
* @param materialId The materialId to check for
|
||||
* @return true if an ItemStack in this inventory contains the materialId
|
||||
@@ -132,7 +138,8 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public boolean contains(int materialId);
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks with the given material.
|
||||
* Checks if the inventory contains any ItemStacks with the given
|
||||
* material.
|
||||
*
|
||||
* @param material The material to check for
|
||||
* @return true if an ItemStack is found with the given Material
|
||||
@@ -141,31 +148,39 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public boolean contains(Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks matching the given ItemStack.
|
||||
* This will only return true if both the type and the amount of the stack match.
|
||||
* Checks if the inventory contains any ItemStacks matching the given
|
||||
* ItemStack.
|
||||
* <p>
|
||||
* This will only return true if both the type and the amount of the stack
|
||||
* match.
|
||||
*
|
||||
* @param item The ItemStack to match against
|
||||
* @return false if item is null, true if any exactly matching ItemStacks were found
|
||||
* @return false if item is null, true if any exactly matching ItemStacks
|
||||
* were found
|
||||
*/
|
||||
public boolean contains(ItemStack item);
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks with the given materialId, adding to at least the minimum amount specified.
|
||||
* Checks if the inventory contains any ItemStacks with the given
|
||||
* materialId, adding to at least the minimum amount specified.
|
||||
*
|
||||
* @param materialId The materialId to check for
|
||||
* @param amount The minimum amount to look for
|
||||
* @return true if this contains any matching ItemStack with the given materialId and amount
|
||||
* @return true if this contains any matching ItemStack with the given
|
||||
* materialId and amount
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean contains(int materialId, int amount);
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks with the given material, adding to at least the minimum amount specified.
|
||||
* Checks if the inventory contains any ItemStacks with the given
|
||||
* material, adding to at least the minimum amount specified.
|
||||
*
|
||||
* @param material The material to check for
|
||||
* @param amount The minimum amount
|
||||
* @return true if amount is less than 1, true if enough ItemStacks were found to add to the given amount
|
||||
* @return true if amount is less than 1, true if enough ItemStacks were
|
||||
* found to add to the given amount
|
||||
* @throws IllegalArgumentException if material is null
|
||||
*/
|
||||
public boolean contains(Material material, int amount) throws IllegalArgumentException;
|
||||
@@ -226,12 +241,13 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public HashMap<Integer, ? extends ItemStack> all(Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Finds all slots in the inventory containing any ItemStacks with the given ItemStack
|
||||
* This will only match slots if both the type and the amount of the stack match
|
||||
* Finds all slots in the inventory containing any ItemStacks with the
|
||||
* given ItemStack. This will only match slots if both the type and the
|
||||
* amount of the stack match
|
||||
* <p>
|
||||
* The HashMap contains entries where, the key is the
|
||||
* slot index, and the value is the ItemStack in that slot. If no matching
|
||||
* ImemStrack with the given Material is found, an empty map is returned.
|
||||
* The HashMap contains entries where, the key is the slot index, and the
|
||||
* value is the ItemStack in that slot. If no matching ItemStack with the
|
||||
* given Material is found, an empty map is returned.
|
||||
*
|
||||
* @param item The ItemStack to match against
|
||||
* @return A map from slot indexes to item at index
|
||||
@@ -239,7 +255,8 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public HashMap<Integer, ? extends ItemStack> all(ItemStack item);
|
||||
|
||||
/**
|
||||
* Finds the first slot in the inventory containing an ItemStack with the given materialId.
|
||||
* Finds the first slot in the inventory containing an ItemStack with the
|
||||
* given materialId.
|
||||
*
|
||||
* @param materialId The materialId to look for
|
||||
* @return The slot index of the given materialId or -1 if not found
|
||||
@@ -249,7 +266,8 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public int first(int materialId);
|
||||
|
||||
/**
|
||||
* Finds the first slot in the inventory containing an ItemStack with the given material
|
||||
* Finds the first slot in the inventory containing an ItemStack with the
|
||||
* given material
|
||||
*
|
||||
* @param material The material to look for
|
||||
* @return The slot index of the given Material or -1 if not found
|
||||
@@ -258,8 +276,9 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public int first(Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Returns the first slot in the inventory containing an ItemStack with the given stack
|
||||
* This will only match a slot if both the type and the amount of the stack match
|
||||
* Returns the first slot in the inventory containing an ItemStack with
|
||||
* the given stack. This will only match a slot if both the type and the
|
||||
* amount of the stack match
|
||||
*
|
||||
* @param item The ItemStack to match against
|
||||
* @return The slot index of the given ItemStack or -1 if not found
|
||||
@@ -292,7 +311,9 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
|
||||
/**
|
||||
* Removes all stacks in the inventory matching the given stack.
|
||||
* This will only match a slot if both the type and the amount of the stack match
|
||||
* <p>
|
||||
* This will only match a slot if both the type and the amount of the
|
||||
* stack match
|
||||
*
|
||||
* @param item The ItemStack to match against
|
||||
*/
|
||||
@@ -311,10 +332,12 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public void clear();
|
||||
|
||||
/**
|
||||
* Gets a list of players viewing. Note that a player is considered to be viewing their own
|
||||
* inventory and internal crafting screen even when said inventory is not open. They will normally
|
||||
* be considered to be viewing their inventory even when they have a different inventory screen open,
|
||||
* but it's possible for customized inventory screens to exclude the viewer's inventory, so this should
|
||||
* Gets a list of players viewing the inventory. Note that a player is
|
||||
* considered to be viewing their own inventory and internal crafting
|
||||
* screen even when said inventory is not open. They will normally be
|
||||
* considered to be viewing their inventory even when they have a
|
||||
* different inventory screen open, but it's possible for customized
|
||||
* inventory screens to exclude the viewer's inventory, so this should
|
||||
* never be assumed to be non-empty.
|
||||
*
|
||||
* @return A list of HumanEntities who are viewing this Inventory.
|
||||
@@ -346,9 +369,10 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
public ListIterator<ItemStack> iterator();
|
||||
|
||||
/**
|
||||
* Returns an iterator starting at the given index. If the index is positive, then the first
|
||||
* call to next() will return the item at that index; if it is negative, the first call to
|
||||
* previous will return the item at index (getSize() + index).
|
||||
* Returns an iterator starting at the given index. If the index is
|
||||
* positive, then the first call to next() will return the item at that
|
||||
* index; if it is negative, the first call to previous will return the
|
||||
* item at index (getSize() + index).
|
||||
*
|
||||
* @param index The index.
|
||||
* @return An iterator.
|
||||
|
||||
@@ -4,12 +4,12 @@ import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
* Represents a view linking two inventories and a single player
|
||||
* (whose inventory may or may not be one of the two)
|
||||
* Represents a view linking two inventories and a single player (whose
|
||||
* inventory may or may not be one of the two).
|
||||
* <p>
|
||||
* Note: If you implement this interface but fail to satisfy the expected
|
||||
* contracts of certain methods, there's no guarantee that the game
|
||||
* will work as it should.
|
||||
* contracts of certain methods, there's no guarantee that the game will work
|
||||
* as it should.
|
||||
*/
|
||||
public abstract class InventoryView {
|
||||
public final static int OUTSIDE = -999;
|
||||
@@ -34,15 +34,18 @@ public abstract class InventoryView {
|
||||
*/
|
||||
TICKS_FOR_CURRENT_FUEL(2, InventoryType.FURNACE),
|
||||
/**
|
||||
* In an enchanting inventory, the top button's experience level value.
|
||||
* In an enchanting inventory, the top button's experience level
|
||||
* value.
|
||||
*/
|
||||
ENCHANT_BUTTON1(0, InventoryType.ENCHANTING),
|
||||
/**
|
||||
* In an enchanting inventory, the middle button's experience level value.
|
||||
* In an enchanting inventory, the middle button's experience level
|
||||
* value.
|
||||
*/
|
||||
ENCHANT_BUTTON2(1, InventoryType.ENCHANTING),
|
||||
/**
|
||||
* In an enchanting inventory, the bottom button's experience level value.
|
||||
* In an enchanting inventory, the bottom button's experience level
|
||||
* value.
|
||||
*/
|
||||
ENCHANT_BUTTON3(2, InventoryType.ENCHANTING);
|
||||
int id;
|
||||
@@ -87,9 +90,9 @@ public abstract class InventoryView {
|
||||
public abstract HumanEntity getPlayer();
|
||||
|
||||
/**
|
||||
* Determine the type of inventory involved in the transaction. This indicates
|
||||
* the window style being shown. It will never return PLAYER, since that is
|
||||
* common to all windows.
|
||||
* Determine the type of inventory involved in the transaction. This
|
||||
* indicates the window style being shown. It will never return PLAYER,
|
||||
* since that is common to all windows.
|
||||
*
|
||||
* @return the inventory type
|
||||
*/
|
||||
@@ -136,7 +139,8 @@ public abstract class InventoryView {
|
||||
/**
|
||||
* Sets the item on the cursor of one of the viewing players.
|
||||
*
|
||||
* @param item The item to put on the cursor, or null to remove the item on their cursor.
|
||||
* @param item The item to put on the cursor, or null to remove the item
|
||||
* on their cursor.
|
||||
*/
|
||||
public final void setCursor(ItemStack item) {
|
||||
getPlayer().setItemOnCursor(item);
|
||||
@@ -145,18 +149,21 @@ public abstract class InventoryView {
|
||||
/**
|
||||
* Get the item on the cursor of one of the viewing players.
|
||||
*
|
||||
* @return The item on the player's cursor, or null if they aren't holding one.
|
||||
* @return The item on the player's cursor, or null if they aren't holding
|
||||
* one.
|
||||
*/
|
||||
public final ItemStack getCursor() {
|
||||
return getPlayer().getItemOnCursor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a raw slot ID into its local slot ID into whichever of the two inventories
|
||||
* the slot points to. If the raw slot refers to the upper inventory, it will be returned
|
||||
* unchanged and thus be suitable for getTopInventory().getItem(); if it refers to the
|
||||
* lower inventory, the output will differ from the input and be suitable for
|
||||
* getBottomInventory().getItem().
|
||||
* Converts a raw slot ID into its local slot ID into whichever of the two
|
||||
* inventories the slot points to.
|
||||
* <p>
|
||||
* If the raw slot refers to the upper inventory, it will be returned
|
||||
* unchanged and thus be suitable for getTopInventory().getItem(); if it
|
||||
* refers to the lower inventory, the output will differ from the input
|
||||
* and be suitable for getBottomInventory().getItem().
|
||||
*
|
||||
* @param rawSlot The raw slot ID.
|
||||
* @return The converted slot ID.
|
||||
@@ -184,9 +191,11 @@ public abstract class InventoryView {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the total number of slots in this view, combining the upper and lower inventories.
|
||||
* Note though that it's possible for this to be greater than the sum of the two inventories
|
||||
* if for example some slots are not being used.
|
||||
* Check the total number of slots in this view, combining the upper and
|
||||
* lower inventories.
|
||||
* <p>
|
||||
* Note though that it's possible for this to be greater than the sum of
|
||||
* the two inventories if for example some slots are not being used.
|
||||
*
|
||||
* @return The total size
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
/**
|
||||
* An instance of the ItemFactory can be obtained with {@link Server#getItemFactory()}.
|
||||
* The ItemFactory is solely responsible for creating item meta containers to apply on item stacks.
|
||||
* An instance of the ItemFactory can be obtained with {@link
|
||||
* Server#getItemFactory()}.
|
||||
* <p>
|
||||
* The ItemFactory is solely responsible for creating item meta containers to
|
||||
* apply on item stacks.
|
||||
*/
|
||||
public interface ItemFactory {
|
||||
|
||||
@@ -17,29 +20,40 @@ public interface ItemFactory {
|
||||
* This creates a new item meta for the material.
|
||||
*
|
||||
* @param material The material to consider as base for the meta
|
||||
* @return a new ItemMeta that could be applied to an item stack of the specified material
|
||||
* @return a new ItemMeta that could be applied to an item stack of the
|
||||
* specified material
|
||||
*/
|
||||
ItemMeta getItemMeta(final Material material);
|
||||
|
||||
/**
|
||||
* This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified ItemStack.
|
||||
* A {@link SkullMeta} would not be valid for a sword, but a normal {@link ItemMeta} from an enchanted dirt block would.
|
||||
* This method checks the item meta to confirm that it is applicable (no
|
||||
* data lost if applied) to the specified ItemStack.
|
||||
* <p>
|
||||
* A {@link SkullMeta} would not be valid for a sword, but a normal {@link
|
||||
* ItemMeta} from an enchanted dirt block would.
|
||||
*
|
||||
* @param meta Meta to check
|
||||
* @param stack Item that meta will be applied to
|
||||
* @return true if the meta can be applied without losing data, false otherwise
|
||||
* @throws IllegalArgumentException if the meta was not created by this factory
|
||||
* @return true if the meta can be applied without losing data, false
|
||||
* otherwise
|
||||
* @throws IllegalArgumentException if the meta was not created by this
|
||||
* factory
|
||||
*/
|
||||
boolean isApplicable(final ItemMeta meta, final ItemStack stack) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* This method checks the item meta to confirm that it is applicable (no data lost if applied) to the specified Material.
|
||||
* A {@link SkullMeta} would not be valid for a sword, but a normal {@link ItemMeta} from an enchanted dirt block would.
|
||||
* This method checks the item meta to confirm that it is applicable (no
|
||||
* data lost if applied) to the specified Material.
|
||||
* <p>
|
||||
* A {@link SkullMeta} would not be valid for a sword, but a normal {@link
|
||||
* ItemMeta} from an enchanted dirt block would.
|
||||
*
|
||||
* @param meta Meta to check
|
||||
* @param material Material that meta will be applied to
|
||||
* @return true if the meta can be applied without losing data, false otherwise
|
||||
* @throws IllegalArgumentException if the meta was not created by this factory
|
||||
* @return true if the meta can be applied without losing data, false
|
||||
* otherwise
|
||||
* @throws IllegalArgumentException if the meta was not created by this
|
||||
* factory
|
||||
*/
|
||||
boolean isApplicable(final ItemMeta meta, final Material material) throws IllegalArgumentException;
|
||||
|
||||
@@ -47,42 +61,57 @@ public interface ItemFactory {
|
||||
* This method is used to compare two item meta data objects.
|
||||
*
|
||||
* @param meta1 First meta to compare, and may be null to indicate no data
|
||||
* @param meta2 Second meta to compare, and may be null to indicate no data
|
||||
* @return false if one of the meta has data the other does not, otherwise true
|
||||
* @throws IllegalArgumentException if either meta was not created by this factory
|
||||
* @param meta2 Second meta to compare, and may be null to indicate no
|
||||
* data
|
||||
* @return false if one of the meta has data the other does not, otherwise
|
||||
* true
|
||||
* @throws IllegalArgumentException if either meta was not created by this
|
||||
* factory
|
||||
*/
|
||||
boolean equals(final ItemMeta meta1, final ItemMeta meta2) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Returns an appropriate item meta for the specified stack.
|
||||
*
|
||||
* The item meta returned will always be a valid meta for a given item stack of the specified material.
|
||||
* It may be a more or less specific meta, and could also be the same meta or meta type as the parameter.
|
||||
* The item meta returned will also always be the most appropriate meta. <br>
|
||||
* <br>
|
||||
* Example, if a {@link SkullMeta} is being applied to a book, this method would return a {@link BookMeta} containing all
|
||||
* information in the specified meta that is applicable to an {@link ItemMeta}, the highest common interface.
|
||||
* <p>
|
||||
* The item meta returned will always be a valid meta for a given
|
||||
* ItemStack of the specified material. It may be a more or less specific
|
||||
* meta, and could also be the same meta or meta type as the parameter.
|
||||
* The item meta returned will also always be the most appropriate meta.
|
||||
* <p>
|
||||
* Example, if a {@link SkullMeta} is being applied to a book, this method
|
||||
* would return a {@link BookMeta} containing all information in the
|
||||
* specified meta that is applicable to an {@link ItemMeta}, the highest
|
||||
* common interface.
|
||||
*
|
||||
* @param meta the meta to convert
|
||||
* @param stack the stack to convert the meta for
|
||||
* @return An appropriate item meta for the specified item stack. No guarantees are made as to if a copy is returned. This will be null for a stack of air.
|
||||
* @throws IllegalArgumentException if the specified meta was not created by this factory
|
||||
* @return An appropriate item meta for the specified item stack. No
|
||||
* guarantees are made as to if a copy is returned. This will be null
|
||||
* for a stack of air.
|
||||
* @throws IllegalArgumentException if the specified meta was not created
|
||||
* by this factory
|
||||
*/
|
||||
ItemMeta asMetaFor(final ItemMeta meta, final ItemStack stack) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Returns an appropriate item meta for the specified material.
|
||||
* The item meta returned will always be a valid meta for a given item stack of the specified material.
|
||||
* It may be a more or less specific meta, and could also be the same meta or meta type as the parameter.
|
||||
* The item meta returned will also always be the most appropriate meta. <br>
|
||||
* <br>
|
||||
* Example, if a {@link SkullMeta} is being applied to a book, this method would return a {@link BookMeta} containing all
|
||||
* information in the specified meta that is applicable to an {@link ItemMeta}, the highest common interface.
|
||||
* <p>
|
||||
* The item meta returned will always be a valid meta for a given
|
||||
* ItemStack of the specified material. It may be a more or less specific
|
||||
* meta, and could also be the same meta or meta type as the parameter.
|
||||
* The item meta returned will also always be the most appropriate meta.
|
||||
* <p>
|
||||
* Example, if a {@link SkullMeta} is being applied to a book, this method
|
||||
* would return a {@link BookMeta} containing all information in the
|
||||
* specified meta that is applicable to an {@link ItemMeta}, the highest
|
||||
* common interface.
|
||||
*
|
||||
* @param meta the meta to convert
|
||||
* @param material the material to convert the meta for
|
||||
* @return An appropriate item meta for the specified item material. No guarantees are made as to if a copy is returned. This will be null for air.
|
||||
* @throws IllegalArgumentException if the specified meta was not created by this factory
|
||||
* @return An appropriate item meta for the specified item material. No
|
||||
* guarantees are made as to if a copy is returned. This will be null for air.
|
||||
* @throws IllegalArgumentException if the specified meta was not created
|
||||
* by this factory
|
||||
*/
|
||||
ItemMeta asMetaFor(final ItemMeta meta, final Material material) throws IllegalArgumentException;
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
* Creates a new item stack derived from the specified stack
|
||||
*
|
||||
* @param stack the stack to copy
|
||||
* @throws IllegalArgumentException if the specified stack is null or returns an item meta not created by the item factory
|
||||
* @throws IllegalArgumentException if the specified stack is null or
|
||||
* returns an item meta not created by the item factory
|
||||
*/
|
||||
public ItemStack(final ItemStack stack) throws IllegalArgumentException {
|
||||
Validate.notNull(stack, "Cannot copy null stack");
|
||||
@@ -263,8 +264,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum stacksize for the material hold in this ItemStack
|
||||
* Returns -1 if it has no idea.
|
||||
* Get the maximum stacksize for the material hold in this ItemStack.
|
||||
* (Returns -1 if it has no idea)
|
||||
*
|
||||
* @return The maximum you can stack this material to.
|
||||
*/
|
||||
@@ -312,7 +313,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is the same as equals, but does not consider stack size (amount).
|
||||
* This method is the same as equals, but does not consider stack size
|
||||
* (amount).
|
||||
*
|
||||
* @param stack the item stack to compare to
|
||||
* @return true if the two stacks are equal, ignoring the amount
|
||||
@@ -392,13 +394,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
/**
|
||||
* Adds the specified enchantments to this item stack.
|
||||
* <p>
|
||||
* This method is the same as calling {@link #addEnchantment(org.bukkit.enchantments.Enchantment, int)}
|
||||
* for each element of the map.
|
||||
* This method is the same as calling {@link
|
||||
* #addEnchantment(org.bukkit.enchantments.Enchantment, int)} for each
|
||||
* element of the map.
|
||||
*
|
||||
* @param enchantments Enchantments to add
|
||||
* @throws IllegalArgumentException if the specified enchantments is null
|
||||
* @throws IllegalArgumentException if any specific enchantment or level is null.
|
||||
* <b>Warning</b>: Some enchantments may be added before this exception is thrown.
|
||||
* @throws IllegalArgumentException if any specific enchantment or level
|
||||
* is null. <b>Warning</b>: Some enchantments may be added before this
|
||||
* exception is thrown.
|
||||
*/
|
||||
@Utility
|
||||
public void addEnchantments(Map<Enchantment, Integer> enchantments) {
|
||||
@@ -411,11 +415,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
/**
|
||||
* Adds the specified {@link Enchantment} to this item stack.
|
||||
* <p>
|
||||
* If this item stack already contained the given enchantment (at any level), it will be replaced.
|
||||
* If this item stack already contained the given enchantment (at any
|
||||
* level), it will be replaced.
|
||||
*
|
||||
* @param ench Enchantment to add
|
||||
* @param level Level of the enchantment
|
||||
* @throws IllegalArgumentException if enchantment null, or enchantment is not applicable
|
||||
* @throws IllegalArgumentException if enchantment null, or enchantment is
|
||||
* not applicable
|
||||
*/
|
||||
@Utility
|
||||
public void addEnchantment(Enchantment ench, int level) {
|
||||
@@ -432,8 +438,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
/**
|
||||
* Adds the specified enchantments to this item stack in an unsafe manner.
|
||||
* <p>
|
||||
* This method is the same as calling {@link #addUnsafeEnchantment(org.bukkit.enchantments.Enchantment, int)}
|
||||
* for each element of the map.
|
||||
* This method is the same as calling {@link
|
||||
* #addUnsafeEnchantment(org.bukkit.enchantments.Enchantment, int)} for
|
||||
* each element of the map.
|
||||
*
|
||||
* @param enchantments Enchantments to add
|
||||
*/
|
||||
@@ -447,10 +454,11 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
/**
|
||||
* Adds the specified {@link Enchantment} to this item stack.
|
||||
* <p>
|
||||
* If this item stack already contained the given enchantment (at any level), it will be replaced.
|
||||
* If this item stack already contained the given enchantment (at any
|
||||
* level), it will be replaced.
|
||||
* <p>
|
||||
* This method is unsafe and will ignore level restrictions or item type. Use at your own
|
||||
* discretion.
|
||||
* This method is unsafe and will ignore level restrictions or item type.
|
||||
* Use at your own discretion.
|
||||
*
|
||||
* @param ench Enchantment to add
|
||||
* @param level Level of the enchantment
|
||||
@@ -460,7 +468,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link Enchantment} if it exists on this item stack
|
||||
* Removes the specified {@link Enchantment} if it exists on this
|
||||
* ItemStack
|
||||
*
|
||||
* @param ench Enchantment to remove
|
||||
* @return Previous level, or 0
|
||||
@@ -564,8 +573,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
* Set the ItemMeta of this ItemStack.
|
||||
*
|
||||
* @param itemMeta new ItemMeta, or null to indicate meta data be cleared.
|
||||
* @return True if successfully applied ItemMeta, see {@link ItemFactory#isApplicable(ItemMeta, ItemStack)}
|
||||
* @throws IllegalArgumentException if the item meta was not created by the {@link ItemFactory}
|
||||
* @return True if successfully applied ItemMeta, see {@link
|
||||
* ItemFactory#isApplicable(ItemMeta, ItemStack)}
|
||||
* @throws IllegalArgumentException if the item meta was not created by
|
||||
* the {@link ItemFactory}
|
||||
*/
|
||||
public boolean setItemMeta(ItemMeta itemMeta) {
|
||||
return setItemMeta0(itemMeta, getType0());
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.bukkit.inventory;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
||||
/**
|
||||
* Includes interface to the 4 armor slots
|
||||
* Interface to the inventory of a Player, including the four armor slots.
|
||||
*/
|
||||
public interface PlayerInventory extends Inventory {
|
||||
|
||||
@@ -50,32 +50,32 @@ public interface PlayerInventory extends Inventory {
|
||||
public void setArmorContents(ItemStack[] items);
|
||||
|
||||
/**
|
||||
* Put the given ItemStack into the helmet slot
|
||||
* This does not check if the ItemStack is a helmet
|
||||
* Put the given ItemStack into the helmet slot. This does not check if
|
||||
* the ItemStack is a helmet
|
||||
*
|
||||
* @param helmet The ItemStack to use as helmet
|
||||
*/
|
||||
public void setHelmet(ItemStack helmet);
|
||||
|
||||
/**
|
||||
* Put the given ItemStack into the chestplate slot
|
||||
* This does not check if the ItemStack is a chestplate
|
||||
* Put the given ItemStack into the chestplate slot. This does not check
|
||||
* if the ItemStack is a chestplate
|
||||
*
|
||||
* @param chestplate The ItemStack to use as chestplate
|
||||
*/
|
||||
public void setChestplate(ItemStack chestplate);
|
||||
|
||||
/**
|
||||
* Put the given ItemStack into the leg slot
|
||||
* This does not check if the ItemStack is a pair of leggings
|
||||
* Put the given ItemStack into the leg slot. This does not check if the
|
||||
* ItemStack is a pair of leggings
|
||||
*
|
||||
* @param leggings The ItemStack to use as leggings
|
||||
*/
|
||||
public void setLeggings(ItemStack leggings);
|
||||
|
||||
/**
|
||||
* Put the given ItemStack into the boots slot
|
||||
* This does not check if the ItemStack is a boots
|
||||
* Put the given ItemStack into the boots slot. This does not check if the
|
||||
* ItemStack is a boots
|
||||
*
|
||||
* @param boots The ItemStack to use as boots
|
||||
*/
|
||||
@@ -108,13 +108,15 @@ public interface PlayerInventory extends Inventory {
|
||||
* This validates whether the slot is between 0 and 8 inclusive.
|
||||
*
|
||||
* @param slot The new slot number
|
||||
* @throws IllegalArgumentException Thrown if slot is not between 0 and 8 inclusive
|
||||
* @throws IllegalArgumentException Thrown if slot is not between 0 and 8
|
||||
* inclusive
|
||||
*/
|
||||
public void setHeldItemSlot(int slot);
|
||||
|
||||
/**
|
||||
* Clears all matching items from the inventory. Setting either value to -1 will skip it's check,
|
||||
* while setting both to -1 will clear all items in your inventory unconditionally.
|
||||
* Clears all matching items from the inventory. Setting either value to
|
||||
* -1 will skip it's check, while setting both to -1 will clear all items
|
||||
* in your inventory unconditionally.
|
||||
*
|
||||
* @param id the id of the item you want to clear from the inventory
|
||||
* @param data the data of the item you want to clear from the inventory
|
||||
|
||||
@@ -17,8 +17,9 @@ public class ShapedRecipe implements Recipe {
|
||||
private Map<Character, ItemStack> ingredients = new HashMap<Character, ItemStack>();
|
||||
|
||||
/**
|
||||
* Create a shaped recipe to craft the specified ItemStack. The constructor merely determines the
|
||||
* result and type; to set the actual recipe, you'll need to call the appropriate methods.
|
||||
* Create a shaped recipe to craft the specified ItemStack. The
|
||||
* constructor merely determines the result and type; to set the actual
|
||||
* recipe, you'll need to call the appropriate methods.
|
||||
*
|
||||
* @param result The item you want the recipe to create.
|
||||
* @see ShapedRecipe#shape(String...)
|
||||
@@ -31,10 +32,12 @@ public class ShapedRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the shape of this recipe to the specified rows. Each character represents a different
|
||||
* ingredient; exactly what each character represents is set separately. The first row supplied
|
||||
* corresponds with the upper most part of the recipe on the workbench e.g. if all three
|
||||
* rows are supplies the first string represents the top row on the workbench.
|
||||
* Set the shape of this recipe to the specified rows. Each character
|
||||
* represents a different ingredient; exactly what each character
|
||||
* represents is set separately. The first row supplied corresponds with
|
||||
* the upper most part of the recipe on the workbench e.g. if all three
|
||||
* rows are supplies the first string represents the top row on the
|
||||
* workbench.
|
||||
*
|
||||
* @param shape The rows of the recipe (up to 3 rows).
|
||||
* @return The changed recipe, so you can chain calls.
|
||||
|
||||
@@ -10,16 +10,17 @@ import org.bukkit.Material;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
/**
|
||||
* Represents a shapeless recipe, where the arrangement of the ingredients on the crafting grid
|
||||
* does not matter.
|
||||
* Represents a shapeless recipe, where the arrangement of the ingredients on
|
||||
* the crafting grid does not matter.
|
||||
*/
|
||||
public class ShapelessRecipe implements Recipe {
|
||||
private ItemStack output;
|
||||
private List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
|
||||
/**
|
||||
* Create a shapeless recipe to craft the specified ItemStack. The constructor merely determines the
|
||||
* result and type; to set the actual recipe, you'll need to call the appropriate methods.
|
||||
* Create a shapeless recipe to craft the specified ItemStack. The
|
||||
* constructor merely determines the result and type; to set the actual
|
||||
* recipe, you'll need to call the appropriate methods.
|
||||
*
|
||||
* @param result The item you want the recipe to create.
|
||||
* @see ShapelessRecipe#addIngredient(Material)
|
||||
@@ -113,9 +114,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple times,
|
||||
* only one instance of it is removed. Only removes exact matches, with a data value
|
||||
* of 0.
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple
|
||||
* times, only one instance of it is removed. Only removes exact matches,
|
||||
* with a data value of 0.
|
||||
*
|
||||
* @param ingredient The ingredient to remove
|
||||
* @return The changed recipe.
|
||||
@@ -125,9 +126,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple times,
|
||||
* only one instance of it is removed. If the data value is -1, only ingredients
|
||||
* with a -1 data value will be removed.
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple
|
||||
* times, only one instance of it is removed. If the data value is -1,
|
||||
* only ingredients with a -1 data value will be removed.
|
||||
*
|
||||
* @param ingredient The ingredient to remove
|
||||
* @return The changed recipe.
|
||||
@@ -137,9 +138,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple instances of an ingredient from the list. If there are less instances
|
||||
* then specified, all will be removed. Only removes exact matches, with a data value
|
||||
* of 0.
|
||||
* Removes multiple instances of an ingredient from the list. If there are
|
||||
* less instances then specified, all will be removed. Only removes exact
|
||||
* matches, with a data value of 0.
|
||||
*
|
||||
* @param count The number of copies to remove.
|
||||
* @param ingredient The ingredient to remove
|
||||
@@ -150,9 +151,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple instances of an ingredient from the list. If there are less instances
|
||||
* then specified, all will be removed. If the data value is -1, only ingredients
|
||||
* with a -1 data value will be removed.
|
||||
* Removes multiple instances of an ingredient from the list. If there are
|
||||
* less instances then specified, all will be removed. If the data value
|
||||
* is -1, only ingredients with a -1 data value will be removed.
|
||||
*
|
||||
* @param count The number of copies to remove.
|
||||
* @param ingredient The ingredient to remove.
|
||||
@@ -163,9 +164,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple times,
|
||||
* only one instance of it is removed. If the data value is -1, only ingredients
|
||||
* with a -1 data value will be removed.
|
||||
* Removes an ingredient from the list. If the ingredient occurs multiple
|
||||
* times, only one instance of it is removed. If the data value is -1,
|
||||
* only ingredients with a -1 data value will be removed.
|
||||
*
|
||||
* @param ingredient The ingredient to remove
|
||||
* @param rawdata The data value;
|
||||
@@ -178,9 +179,9 @@ public class ShapelessRecipe implements Recipe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple instances of an ingredient from the list. If there are less instances
|
||||
* then specified, all will be removed. If the data value is -1, only ingredients
|
||||
* with a -1 data value will be removed.
|
||||
* Removes multiple instances of an ingredient from the list. If there are
|
||||
* less instances then specified, all will be removed. If the data value
|
||||
* is -1, only ingredients with a -1 data value will be removed.
|
||||
*
|
||||
* @param count The number of copies to remove.
|
||||
* @param ingredient The ingredient to remove.
|
||||
|
||||
@@ -5,7 +5,8 @@ import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents a book ({@link Material#BOOK_AND_QUILL} or {@link Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
|
||||
* Represents a book ({@link Material#BOOK_AND_QUILL} or {@link
|
||||
* Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
|
||||
*/
|
||||
public interface BookMeta extends ItemMeta {
|
||||
|
||||
@@ -18,14 +19,18 @@ public interface BookMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Gets the title of the book.
|
||||
* Plugins should check that hasTitle() returns true before calling this method.
|
||||
* <p>
|
||||
* Plugins should check that hasTitle() returns true before calling this
|
||||
* method.
|
||||
*
|
||||
* @return the title of the book
|
||||
*/
|
||||
String getTitle();
|
||||
|
||||
/**
|
||||
* Sets the title of the book. Limited to 16 characters. Removes title when given null.
|
||||
* Sets the title of the book.
|
||||
* <p>
|
||||
* Limited to 16 characters. Removes title when given null.
|
||||
*
|
||||
* @param title the title to set
|
||||
* @return true if the title was successfully set
|
||||
@@ -41,7 +46,9 @@ public interface BookMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Gets the author of the book.
|
||||
* Plugins should check that hasAuthor() returns true before calling this method.
|
||||
* <p>
|
||||
* Plugins should check that hasAuthor() returns true before calling this
|
||||
* method.
|
||||
*
|
||||
* @return the author of the book
|
||||
*/
|
||||
@@ -70,8 +77,11 @@ public interface BookMeta extends ItemMeta {
|
||||
String getPage(int page);
|
||||
|
||||
/**
|
||||
* Sets the specified page in the book. Pages of the book must be contiguous.
|
||||
* The data can be up to 256 characters in length, additional characters are trucated.
|
||||
* Sets the specified page in the book. Pages of the book must be
|
||||
* contiguous.
|
||||
* <p>
|
||||
* The data can be up to 256 characters in length, additional characters
|
||||
* are truncated.
|
||||
*
|
||||
* @param page the page number to set
|
||||
* @param data the data to set for that page
|
||||
@@ -86,21 +96,24 @@ public interface BookMeta extends ItemMeta {
|
||||
List<String> getPages();
|
||||
|
||||
/**
|
||||
* Clears the existing book pages, and sets the book to use the provided pages. Maximum 50 pages with 256 characters per page.
|
||||
* Clears the existing book pages, and sets the book to use the provided
|
||||
* pages. Maximum 50 pages with 256 characters per page.
|
||||
*
|
||||
* @param pages A list of pages to set the book to use
|
||||
*/
|
||||
void setPages(List<String> pages);
|
||||
|
||||
/**
|
||||
* Clears the existing book pages, and sets the book to use the provided pages. Maximum 50 pages with 256 characters per page.
|
||||
* Clears the existing book pages, and sets the book to use the provided
|
||||
* pages. Maximum 50 pages with 256 characters per page.
|
||||
*
|
||||
* @param pages A list of strings, each being a page
|
||||
*/
|
||||
void setPages(String... pages);
|
||||
|
||||
/**
|
||||
* Adds new pages to the end of the book. Up to a maximum of 50 pages with 256 characters per page.
|
||||
* Adds new pages to the end of the book. Up to a maximum of 50 pages with
|
||||
* 256 characters per page.
|
||||
*
|
||||
* @param pages A list of strings, each being a page
|
||||
*/
|
||||
|
||||
@@ -6,8 +6,9 @@ import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
/**
|
||||
* EnchantmentMeta is specific to items that can <i>store</i> enchantments, as opposed to being enchanted.
|
||||
* {@link Material#ENCHANTED_BOOK} is an example of an item with enchantment storage.
|
||||
* EnchantmentMeta is specific to items that can <i>store</i> enchantments, as
|
||||
* opposed to being enchanted. {@link Material#ENCHANTED_BOOK} is an example
|
||||
* of an item with enchantment storage.
|
||||
*/
|
||||
public interface EnchantmentStorageMeta extends ItemMeta {
|
||||
|
||||
@@ -30,7 +31,8 @@ public interface EnchantmentStorageMeta extends ItemMeta {
|
||||
* Checks for the level of the stored enchantment.
|
||||
*
|
||||
* @param ench enchantment to check
|
||||
* @return The level that the specified stored enchantment has, or 0 if none
|
||||
* @return The level that the specified stored enchantment has, or 0 if
|
||||
* none
|
||||
*/
|
||||
int getStoredEnchantLevel(Enchantment ench);
|
||||
|
||||
@@ -46,8 +48,10 @@ public interface EnchantmentStorageMeta extends ItemMeta {
|
||||
*
|
||||
* @param ench Enchantment to store
|
||||
* @param level Level for the enchantment
|
||||
* @param ignoreLevelRestriction this indicates the enchantment should be applied, ignoring the level limit
|
||||
* @return true if the item meta changed as a result of this call, false otherwise
|
||||
* @param ignoreLevelRestriction this indicates the enchantment should be
|
||||
* applied, ignoring the level limit
|
||||
* @return true if the item meta changed as a result of this call, false
|
||||
* otherwise
|
||||
* @throws IllegalArgumentException if enchantment is null
|
||||
*/
|
||||
boolean addStoredEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction);
|
||||
@@ -56,13 +60,15 @@ public interface EnchantmentStorageMeta extends ItemMeta {
|
||||
* Remove the specified stored enchantment from this item meta.
|
||||
*
|
||||
* @param ench Enchantment to remove
|
||||
* @return true if the item meta changed as a result of this call, false otherwise
|
||||
* @return true if the item meta changed as a result of this call, false
|
||||
* otherwise
|
||||
* @throws IllegalArgumentException if enchantment is null
|
||||
*/
|
||||
boolean removeStoredEnchant(Enchantment ench) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.
|
||||
* Checks if the specified enchantment conflicts with any enchantments in
|
||||
* this ItemMeta.
|
||||
*
|
||||
* @param ench enchantment to test
|
||||
* @return true if the enchantment conflicts, false otherwise
|
||||
|
||||
@@ -4,7 +4,8 @@ import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents a meta that can store a single FireworkEffect. An example includes {@link Material#FIREWORK_CHARGE}.
|
||||
* Represents a meta that can store a single FireworkEffect. An example
|
||||
* includes {@link Material#FIREWORK_CHARGE}.
|
||||
*/
|
||||
public interface FireworkEffectMeta extends ItemMeta {
|
||||
|
||||
|
||||
@@ -23,16 +23,19 @@ public interface FireworkMeta extends ItemMeta {
|
||||
*
|
||||
* @param effects The firework effects to add
|
||||
* @throws IllegalArgumentException If effects is null
|
||||
* @throws IllegalArgumentException If any effect is null (may be thrown after changes have occurred)
|
||||
* @throws IllegalArgumentException If any effect is null (may be thrown
|
||||
* after changes have occurred)
|
||||
*/
|
||||
void addEffects(FireworkEffect...effects) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Add several firework effects to this firework.
|
||||
*
|
||||
* @param effects An iterable object whose iterator yields the desired firework effects
|
||||
* @param effects An iterable object whose iterator yields the desired
|
||||
* firework effects
|
||||
* @throws IllegalArgumentException If effects is null
|
||||
* @throws IllegalArgumentException If any effect is null (may be thrown after changes have occurred)
|
||||
* @throws IllegalArgumentException If any effect is null (may be thrown
|
||||
* after changes have occurred)
|
||||
*/
|
||||
void addEffects(Iterable<FireworkEffect> effects) throws IllegalArgumentException;
|
||||
|
||||
@@ -54,7 +57,8 @@ public interface FireworkMeta extends ItemMeta {
|
||||
* Remove an effect from this firework.
|
||||
*
|
||||
* @param index The index of the effect to remove
|
||||
* @throws IndexOutOfBoundsException If index < 0 or index > {@link #getEffectsSize()}
|
||||
* @throws IndexOutOfBoundsException If index < 0 or index > {@link
|
||||
* #getEffectsSize()}
|
||||
*/
|
||||
void removeEffect(int index) throws IndexOutOfBoundsException;
|
||||
|
||||
@@ -78,7 +82,8 @@ public interface FireworkMeta extends ItemMeta {
|
||||
int getPower();
|
||||
|
||||
/**
|
||||
* Sets the approximate power of the firework. Each level of power is half a second of flight time.
|
||||
* Sets the approximate power of the firework. Each level of power is half
|
||||
* a second of flight time.
|
||||
*
|
||||
* @param power the power of the firework, from 0-128
|
||||
* @throws IllegalArgumentException if height<0 or height>128
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
/**
|
||||
* This type represents the storage mechanism for auxiliary item data.
|
||||
* <p>
|
||||
* An implementation will handle the creation and application for ItemMeta.
|
||||
* This class should not be implemented by a plugin in a live environment.
|
||||
*/
|
||||
@@ -22,7 +23,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
|
||||
|
||||
/**
|
||||
* Gets the display name that is set.
|
||||
* Plugins should check that hasDisplayName() returns <code>true</code> before calling this method.
|
||||
* <p>
|
||||
* Plugins should check that hasDisplayName() returns <code>true</code>
|
||||
* before calling this method.
|
||||
*
|
||||
* @return the display name that is set
|
||||
*/
|
||||
@@ -44,7 +47,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
|
||||
|
||||
/**
|
||||
* Gets the lore that is set.
|
||||
* Plugins should check if hasLore() returns <code>true</code> before calling this method.
|
||||
* <p>
|
||||
* Plugins should check if hasLore() returns <code>true</code> before
|
||||
* calling this method.
|
||||
*
|
||||
* @return a list of lore that is set
|
||||
*/
|
||||
@@ -94,8 +99,10 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
|
||||
*
|
||||
* @param ench Enchantment to add
|
||||
* @param level Level for the enchantment
|
||||
* @param ignoreLevelRestriction this indicates the enchantment should be applied, ignoring the level limit
|
||||
* @return true if the item meta changed as a result of this call, false otherwise
|
||||
* @param ignoreLevelRestriction this indicates the enchantment should be
|
||||
* applied, ignoring the level limit
|
||||
* @return true if the item meta changed as a result of this call, false
|
||||
* otherwise
|
||||
*/
|
||||
boolean addEnchant(Enchantment ench, int level, boolean ignoreLevelRestriction);
|
||||
|
||||
@@ -103,12 +110,14 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
|
||||
* Removes the specified enchantment from this item meta.
|
||||
*
|
||||
* @param ench Enchantment to remove
|
||||
* @return true if the item meta changed as a result of this call, false otherwise
|
||||
* @return true if the item meta changed as a result of this call, false
|
||||
* otherwise
|
||||
*/
|
||||
boolean removeEnchant(Enchantment ench);
|
||||
|
||||
/**
|
||||
* Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.
|
||||
* Checks if the specified enchantment conflicts with any enchantments in
|
||||
* this ItemMeta.
|
||||
*
|
||||
* @param ench enchantment to test
|
||||
* @return true if the enchantment conflicts, false otherwise
|
||||
|
||||
@@ -5,12 +5,15 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
|
||||
/**
|
||||
* Represents leather armor ({@link Material#LEATHER_BOOTS}, {@link Material#LEATHER_CHESTPLATE}, {@link Material#LEATHER_HELMET}, or {@link Material#LEATHER_LEGGINGS}) that can be colored.
|
||||
* Represents leather armor ({@link Material#LEATHER_BOOTS}, {@link
|
||||
* Material#LEATHER_CHESTPLATE}, {@link Material#LEATHER_HELMET}, or {@link
|
||||
* Material#LEATHER_LEGGINGS}) that can be colored.
|
||||
*/
|
||||
public interface LeatherArmorMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Gets the color of the armor. If it has not been set otherwise, it will be {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
* Gets the color of the armor. If it has not been set otherwise, it will
|
||||
* be {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
*
|
||||
* @return the color of the armor, never null
|
||||
*/
|
||||
@@ -19,7 +22,8 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
/**
|
||||
* Sets the color of the armor.
|
||||
*
|
||||
* @param color the color to set. Setting it to null is equivalent to setting it to {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
* @param color the color to set. Setting it to null is equivalent to
|
||||
* setting it to {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
*/
|
||||
void setColor(Color color);
|
||||
|
||||
|
||||
@@ -19,8 +19,11 @@ public interface PotionMeta extends ItemMeta {
|
||||
boolean hasCustomEffects();
|
||||
|
||||
/**
|
||||
* Gets an immutable list containing all custom potion effects applied to this potion.
|
||||
* Plugins should check that hasCustomEffects() returns true before calling this method.
|
||||
* Gets an immutable list containing all custom potion effects applied to
|
||||
* this potion.
|
||||
* <p>
|
||||
* Plugins should check that hasCustomEffects() returns true before
|
||||
* calling this method.
|
||||
*
|
||||
* @return the immutable list of custom potion effects
|
||||
*/
|
||||
@@ -30,7 +33,8 @@ public interface PotionMeta extends ItemMeta {
|
||||
* Adds a custom potion effect to this potion.
|
||||
*
|
||||
* @param effect the potion effect to add
|
||||
* @param overwrite true if any existing effect of the same type should be overwritten
|
||||
* @param overwrite true if any existing effect of the same type should be
|
||||
* overwritten
|
||||
* @return true if the potion meta changed as a result of this call
|
||||
*/
|
||||
boolean addCustomEffect(PotionEffect effect, boolean overwrite);
|
||||
@@ -53,7 +57,9 @@ public interface PotionMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Moves a potion effect to the top of the potion effect list.
|
||||
* This causes the client to display the potion effect in the potion's name.
|
||||
* <p>
|
||||
* This causes the client to display the potion effect in the potion's
|
||||
* name.
|
||||
*
|
||||
* @param type the potion effect type to move
|
||||
* @return true if the potion meta changed as a result of this call
|
||||
|
||||
@@ -23,7 +23,9 @@ public interface SkullMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Sets the owner of the skull.
|
||||
* Plugins should check that hasOwner() returns true before calling this plugin.
|
||||
* <p>
|
||||
* Plugins should check that hasOwner() returns true before calling this
|
||||
* plugin.
|
||||
*
|
||||
* @param owner the new owner of the skull
|
||||
* @return true if the owner was successfully set
|
||||
|
||||
Reference in New Issue
Block a user