mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-13 22:21:06 +00:00
Added durability requirement and placeholder for hologram format
This commit is contained in:
parent
8533c017e7
commit
1ae4ee379b
@ -18,7 +18,7 @@ public class HologramFormat {
|
|||||||
public enum Requirement {
|
public enum Requirement {
|
||||||
VENDOR, AMOUNT, ITEM_TYPE, ITEM_NAME, HAS_ENCHANTMENT, BUY_PRICE,
|
VENDOR, AMOUNT, ITEM_TYPE, ITEM_NAME, HAS_ENCHANTMENT, BUY_PRICE,
|
||||||
SELL_PRICE, HAS_POTION_EFFECT, IS_MUSIC_DISC, IS_POTION_EXTENDED, IS_WRITTEN_BOOK, ADMIN_SHOP,
|
SELL_PRICE, HAS_POTION_EFFECT, IS_MUSIC_DISC, IS_POTION_EXTENDED, IS_WRITTEN_BOOK, ADMIN_SHOP,
|
||||||
NORMAL_SHOP, IN_STOCK, MAX_STACK, CHEST_SPACE
|
NORMAL_SHOP, IN_STOCK, MAX_STACK, CHEST_SPACE, DURABILITY
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShopChest plugin;
|
private ShopChest plugin;
|
||||||
|
@ -25,7 +25,8 @@ public enum Placeholder {
|
|||||||
STOCK("%STOCK%"),
|
STOCK("%STOCK%"),
|
||||||
CHEST_SPACE("%CHEST-SPACE%"),
|
CHEST_SPACE("%CHEST-SPACE%"),
|
||||||
MAX_STACK("%MAX-STACK%"),
|
MAX_STACK("%MAX-STACK%"),
|
||||||
COMMAND("%COMMAND%");
|
COMMAND("%COMMAND%"),
|
||||||
|
DURABILITY("%DURABILITY%");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ public class Shop {
|
|||||||
requirements.put(HologramFormat.Requirement.IN_STOCK, Utils.getAmount(getInventoryHolder().getInventory(), getProduct()));
|
requirements.put(HologramFormat.Requirement.IN_STOCK, Utils.getAmount(getInventoryHolder().getInventory(), getProduct()));
|
||||||
requirements.put(HologramFormat.Requirement.MAX_STACK, getProduct().getMaxStackSize());
|
requirements.put(HologramFormat.Requirement.MAX_STACK, getProduct().getMaxStackSize());
|
||||||
requirements.put(HologramFormat.Requirement.CHEST_SPACE, Utils.getFreeSpaceForItem(getInventoryHolder().getInventory(), getProduct()));
|
requirements.put(HologramFormat.Requirement.CHEST_SPACE, Utils.getFreeSpaceForItem(getInventoryHolder().getInventory(), getProduct()));
|
||||||
|
requirements.put(HologramFormat.Requirement.DURABILITY, getProduct().getDurability());
|
||||||
|
|
||||||
Map<Placeholder, Object> placeholders = new HashMap<>();
|
Map<Placeholder, Object> placeholders = new HashMap<>();
|
||||||
placeholders.put(Placeholder.VENDOR, getVendor().getName());
|
placeholders.put(Placeholder.VENDOR, getVendor().getName());
|
||||||
@ -212,6 +213,7 @@ public class Shop {
|
|||||||
placeholders.put(Placeholder.STOCK, Utils.getAmount(getInventoryHolder().getInventory(), getProduct()));
|
placeholders.put(Placeholder.STOCK, Utils.getAmount(getInventoryHolder().getInventory(), getProduct()));
|
||||||
placeholders.put(Placeholder.MAX_STACK, getProduct().getMaxStackSize());
|
placeholders.put(Placeholder.MAX_STACK, getProduct().getMaxStackSize());
|
||||||
placeholders.put(Placeholder.CHEST_SPACE, Utils.getFreeSpaceForItem(getInventoryHolder().getInventory(), getProduct()));
|
placeholders.put(Placeholder.CHEST_SPACE, Utils.getFreeSpaceForItem(getInventoryHolder().getInventory(), getProduct()));
|
||||||
|
placeholders.put(Placeholder.DURABILITY, getProduct().getDurability());
|
||||||
|
|
||||||
int lineCount = plugin.getHologramFormat().getLineCount();
|
int lineCount = plugin.getHologramFormat().getLineCount();
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
# Valid requirements are:
|
# Valid requirements are:
|
||||||
# VENDOR, AMOUNT, ITEM_TYPE, ITEM_NAME, HAS_ENCHANTMENT, BUY_PRICE,
|
# VENDOR, AMOUNT, ITEM_TYPE, ITEM_NAME, HAS_ENCHANTMENT, BUY_PRICE,
|
||||||
# SELL_PRICE, HAS_POTION_EFFECT, IS_MUSIC_DISC, IS_POTION_EXTENDED,
|
# SELL_PRICE, HAS_POTION_EFFECT, IS_MUSIC_DISC, IS_POTION_EXTENDED,
|
||||||
# IS_WRITTEN_BOOK, ADMIN_SHOP, NORMAL_SHOP, IN_STOCK, MAX_STACK, CHEST_SPACE
|
# IS_WRITTEN_BOOK, ADMIN_SHOP, NORMAL_SHOP, IN_STOCK, MAX_STACK,
|
||||||
|
# CHEST_SPACE, DURABILITY
|
||||||
#
|
#
|
||||||
# You can also use the requirements for conditions.
|
# You can also use the requirements for conditions.
|
||||||
# ITEM_TYPE will return the type of the item (-> item_names.txt),
|
# ITEM_TYPE will return the type of the item (-> item_names.txt),
|
||||||
@ -24,7 +25,7 @@
|
|||||||
# Valid placeholders are:
|
# Valid placeholders are:
|
||||||
# %VENDOR%, %AMOUNT%, %ITEM-NAME%, %ENCHANTMENT%, %BUY-PRICE%,
|
# %VENDOR%, %AMOUNT%, %ITEM-NAME%, %ENCHANTMENT%, %BUY-PRICE%,
|
||||||
# %SELL-PRICE%, %POTION-EFFECT%, %MUSIC-TITLE%, %GENERATION%,
|
# %SELL-PRICE%, %POTION-EFFECT%, %MUSIC-TITLE%, %GENERATION%,
|
||||||
# %STOCK%, %MAX-STACK%, %CHEST-SPACE%
|
# %STOCK%, %MAX-STACK%, %CHEST-SPACE%, %DURABILITY%
|
||||||
#
|
#
|
||||||
# In the format, placeholders can also be used for scripts.
|
# In the format, placeholders can also be used for scripts.
|
||||||
# Examples:
|
# Examples:
|
||||||
|
Loading…
Reference in New Issue
Block a user