Package net.glowstone.inventory
Class GlowAnvilInventory
java.lang.Object
net.glowstone.inventory.GlowInventory
net.glowstone.inventory.GlowAnvilInventory
- All Implemented Interfaces:
Iterable<org.bukkit.inventory.ItemStack>
,org.bukkit.inventory.AnvilInventory
,org.bukkit.inventory.Inventory
public class GlowAnvilInventory
extends GlowInventory
implements org.bukkit.inventory.AnvilInventory
-
Constructor Summary
ConstructorDescriptionGlowAnvilInventory
(org.bukkit.inventory.InventoryHolder holder) Creates an instance for the given player. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStack
org.bukkit.inventory.ItemStack
Returns the item that will result when this anvil is applied to the currently loaded items, combining them, provided that two items which can be combined are loaded.int
int
Gets the number of slots in this inventory according to the protocol.int
org.bukkit.inventory.ItemStack
org.bukkit.inventory.ItemStack
void
handleShiftClick
(GlowPlayer player, org.bukkit.inventory.InventoryView view, int clickedSlot, org.bukkit.inventory.ItemStack clickedItem) Handle a shift click in this inventory by the specified player.void
setItem
(int index, org.bukkit.inventory.ItemStack item) void
setMaximumRepairCost
(int maximumRepairCost) void
setRenameText
(String name) Sets the name of the next item to be modified on this anvil.void
setRepairCost
(int repairCost) Methods inherited from class net.glowstone.inventory.GlowInventory
addItem, addItemStack, addViewer, all, all, clear, clear, close, consumeItem, consumeItem, contains, contains, contains, contains, containsAtLeast, first, first, firstEmpty, getContents, getHolder, getHolder, getItem, getLocation, getMaxStackSize, getSize, getSlot, getSlots, getSlotType, getStorageContents, getTitle, getType, getViewers, getViewersSet, initialize, isEmpty, itemPlaceAllowed, itemShiftClickAllowed, iterator, iterator, remove, remove, removeItem, removeItemAnySlot, removeItemStack, removeViewer, setContents, setMaxStackSize, setStorageContents, setTitle, toString, tryToFillSlots
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bukkit.inventory.AnvilInventory
getResult, setFirstItem, setResult, setSecondItem
Methods inherited from interface org.bukkit.inventory.Inventory
addItem, all, all, clear, clear, close, contains, contains, contains, contains, containsAtLeast, first, first, firstEmpty, getContents, getHolder, getHolder, getItem, getLocation, getMaxStackSize, getSize, getStorageContents, getType, getViewers, isEmpty, iterator, iterator, remove, remove, removeItem, removeItemAnySlot, setContents, setMaxStackSize, setStorageContents
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GlowAnvilInventory
public GlowAnvilInventory(org.bukkit.inventory.InventoryHolder holder) Creates an instance for the given player.- Parameters:
holder
- the player
-
-
Method Details
-
getRawSlots
public int getRawSlots()Description copied from class:GlowInventory
Gets the number of slots in this inventory according to the protocol.Some inventories have 0 slots in the protocol, despite having slots.
- Overrides:
getRawSlots
in classGlowInventory
- Returns:
- The numbers of slots
-
getFirstItem
public org.bukkit.inventory.ItemStack getFirstItem()- Specified by:
getFirstItem
in interfaceorg.bukkit.inventory.AnvilInventory
-
getSecondItem
public org.bukkit.inventory.ItemStack getSecondItem()- Specified by:
getSecondItem
in interfaceorg.bukkit.inventory.AnvilInventory
-
getResultItem
public org.bukkit.inventory.ItemStack getResultItem() -
handleShiftClick
public void handleShiftClick(GlowPlayer player, org.bukkit.inventory.InventoryView view, int clickedSlot, org.bukkit.inventory.ItemStack clickedItem) Description copied from class:GlowInventory
Handle a shift click in this inventory by the specified player.The default implementation distributes items from the right to the left and from the bottom to the top.
- Overrides:
handleShiftClick
in classGlowInventory
- Parameters:
player
- The player who clickedview
- The inventory view in which was clickedclickedSlot
- The slot in the viewclickedItem
- The item at which was clicked
-
setItem
public void setItem(int index, org.bukkit.inventory.ItemStack item) - Specified by:
setItem
in interfaceorg.bukkit.inventory.Inventory
- Overrides:
setItem
in classGlowInventory
-
getForged
public org.bukkit.inventory.ItemStack getForged()Returns the item that will result when this anvil is applied to the currently loaded items, combining them, provided that two items which can be combined are loaded. A return of null doesn't imply that the anvil cannot be activated, since it may still be able to repair/name a single item.- Returns:
- the resulting item, or null if two items that can be combined are not loaded
-
setRenameText
Sets the name of the next item to be modified on this anvil.- Parameters:
name
- the item name
-
getRenameText
- Specified by:
getRenameText
in interfaceorg.bukkit.inventory.AnvilInventory
-
getRepairCost
public int getRepairCost()- Specified by:
getRepairCost
in interfaceorg.bukkit.inventory.AnvilInventory
-
setRepairCost
public void setRepairCost(int repairCost) - Specified by:
setRepairCost
in interfaceorg.bukkit.inventory.AnvilInventory
-
getMaximumRepairCost
public int getMaximumRepairCost()- Specified by:
getMaximumRepairCost
in interfaceorg.bukkit.inventory.AnvilInventory
-
setMaximumRepairCost
public void setMaximumRepairCost(int maximumRepairCost) - Specified by:
setMaximumRepairCost
in interfaceorg.bukkit.inventory.AnvilInventory
-