mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-20 23:37:36 +01:00
d6bdb0486a
- Formatting - Warning about old Bukkit version - Renamed "TOWNY_CANNOT_CREATE_SHOP_HERE" to "CANNOT_CREATE_SHOP_HERE" to avoid confusion - Renamed "NOT_ENOUGH_LWC_PROTECTIONS" to "NOT_ENOUGH_PROTECTIONS" and changed its message - Fixed armour enchantments - Logging shop location - Fixed Heroes for the newest version - Removed redutant plugin object - Added dev-url for CraftBukkitUpToDate - Removed redutant plugins from softdepend - Fixed a bug when the player interacts with a shop with a sign in hand
58 lines
1.5 KiB
Java
58 lines
1.5 KiB
Java
package com.Acrobot.ChestShop.Chests;
|
|
|
|
import com.Acrobot.ChestShop.Utils.uBlock;
|
|
import com.Acrobot.ChestShop.Utils.uInventory;
|
|
import org.bukkit.block.Chest;
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class MinecraftChest implements ChestObject {
|
|
private final Chest chest;
|
|
|
|
public MinecraftChest(Chest chest) {
|
|
this.chest = chest;
|
|
}
|
|
|
|
public ItemStack[] getContents() {
|
|
return chest.getInventory().getContents();
|
|
}
|
|
|
|
public void setSlot(int slot, ItemStack item) {
|
|
chest.getInventory().setItem(slot, item);
|
|
}
|
|
|
|
public void clearSlot(int slot) {
|
|
chest.getInventory().setItem(slot, null);
|
|
}
|
|
|
|
public void addItem(ItemStack item, int amount) {
|
|
uInventory.add(chest.getInventory(), item, amount);
|
|
}
|
|
|
|
public void removeItem(ItemStack item, short durability, int amount) {
|
|
uInventory.remove(chest.getInventory(), item, amount, durability);
|
|
}
|
|
|
|
public int amount(ItemStack item, short durability) {
|
|
return uInventory.amount(chest.getInventory(), item, durability);
|
|
}
|
|
|
|
public boolean hasEnough(ItemStack item, int amount, short durability) {
|
|
return amount(item, durability) >= amount;
|
|
}
|
|
|
|
public boolean fits(ItemStack item, int amount, short durability) {
|
|
return uInventory.fits(chest.getInventory(), item, amount, durability) <= 0;
|
|
}
|
|
|
|
public int getSize() {
|
|
return chest.getInventory().getSize();
|
|
}
|
|
|
|
public Chest getNeighbor() {
|
|
return uBlock.findNeighbor(chest);
|
|
}
|
|
}
|