Mirror von
https://github.com/TheSilentPro/HeadDB.git
synchronisiert 2024-12-28 03:40:06 +01:00
Make it possible to change the item used to fill the categories menu.
Dieser Commit ist enthalten in:
Ursprung
d6cdde98c4
Commit
5fb844f4b7
@ -56,7 +56,9 @@ public class InventoryUtils {
|
|||||||
if (HeadDB.getInstance().getCfg().contains("ui.category." + category + ".item")) {
|
if (HeadDB.getInstance().getCfg().contains("ui.category." + category + ".item")) {
|
||||||
String cfg = HeadDB.getInstance().getCfg().getString("ui.category." + category + ".item");
|
String cfg = HeadDB.getInstance().getCfg().getString("ui.category." + category + ".item");
|
||||||
Material mat = Material.matchMaterial(cfg);
|
Material mat = Material.matchMaterial(cfg);
|
||||||
if (mat != null && mat != Material.AIR) {
|
|
||||||
|
// AIR is allowed as the fill material for the menu, but not as a category item.
|
||||||
|
if (mat != null && (category.equals("fill") || mat != Material.AIR)) {
|
||||||
uiItem.put(category, new ItemStack(mat));
|
uiItem.put(category, new ItemStack(mat));
|
||||||
return uiItem.get(category);
|
return uiItem.get(category);
|
||||||
}
|
}
|
||||||
@ -226,14 +228,17 @@ public class InventoryUtils {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fill(inventory, new ItemStack(Material.BLACK_STAINED_GLASS_PANE));
|
fill(inventory);
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fill(Inventory inv, ItemStack item) {
|
public static void fill(Inventory inv) {
|
||||||
int size = inv.getSize();
|
ItemStack item = uiGetItem("fill", new ItemStack(Material.BLACK_STAINED_GLASS_PANE));
|
||||||
|
// Do not bother filling the inventory if item to fill it with is AIR.
|
||||||
|
if (item == null || item.getType() == Material.AIR) return;
|
||||||
|
|
||||||
// Fill any non-empty inventory slots with the given item.
|
// Fill any non-empty inventory slots with the given item.
|
||||||
|
int size = inv.getSize();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
ItemStack slotItem = inv.getItem(i);
|
ItemStack slotItem = inv.getItem(i);
|
||||||
if (slotItem == null || slotItem.getType() == Material.AIR) {
|
if (slotItem == null || slotItem.getType() == Material.AIR) {
|
||||||
|
@ -26,7 +26,7 @@ economy:
|
|||||||
# UI customization options.
|
# UI customization options.
|
||||||
ui:
|
ui:
|
||||||
category:
|
category:
|
||||||
# Head categories.
|
# Head categories. You can use item: instead of head: here, but AIR is not supported.
|
||||||
alphabet:
|
alphabet:
|
||||||
location: 20
|
location: 20
|
||||||
head: 1788
|
head: 1788
|
||||||
@ -57,7 +57,7 @@ ui:
|
|||||||
plants:
|
plants:
|
||||||
location: 33
|
location: 33
|
||||||
head: 37278
|
head: 37278
|
||||||
# Meta categories, used for UI elements.
|
# Meta categories, used for UI elements. AIR is not supported. You can use head: instead of item: here.
|
||||||
favorites:
|
favorites:
|
||||||
location: 39
|
location: 39
|
||||||
item: BOOK
|
item: BOOK
|
||||||
@ -67,6 +67,9 @@ ui:
|
|||||||
local:
|
local:
|
||||||
location: 41
|
location: 41
|
||||||
item: COMPASS
|
item: COMPASS
|
||||||
|
# Item used to fill unused slots in the categories menu. AIR is supported. You can use head: instead of item: here.
|
||||||
|
fill:
|
||||||
|
item: BLACK_STAINED_GLASS_PANE
|
||||||
|
|
||||||
# Debug Mode
|
# Debug Mode
|
||||||
debug: false
|
debug: false
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren