Hide the Favorites, Search and Local UI options based on permissions.

The Search UI option uses a new permission, headdb.searchui in order to keep the /hdb search command in servers where the UI errors out.
Dieser Commit ist enthalten in:
Leandro 2021-07-01 02:31:53 -03:00
Ursprung 267bb78cf3
Commit 96717d05e0

Datei anzeigen

@ -163,33 +163,39 @@ public class InventoryUtils {
inventory.addItem(item); inventory.addItem(item);
} }
if (player.hasPermission("headdb.favorites")) {
inventory.setItem(39, buildButton( inventory.setItem(39, buildButton(
XMaterial.BOOK.parseItem(), XMaterial.BOOK.parseItem(),
"&eFavorites", "&eFavorites",
"", "",
"&8Click to view your favorites") "&8Click to view your favorites")
); );
}
if (player.hasPermission("headdb.searchui")) {
inventory.setItem(40, buildButton( inventory.setItem(40, buildButton(
XMaterial.DARK_OAK_SIGN.parseItem(), XMaterial.DARK_OAK_SIGN.parseItem(),
"&9Search", "&9Search",
"", "",
"&8Click to open search menu" "&8Click to open search menu"
)); ));
}
if (player.hasPermission("headdb.local")) {
inventory.setItem(41, buildButton( inventory.setItem(41, buildButton(
XMaterial.COMPASS.parseItem(), XMaterial.COMPASS.parseItem(),
"&aLocal", "&aLocal",
"", "",
"&8Heads from any players that have logged on the server" "&8Heads from any players that have logged on the server"
)); ));
}
player.openInventory(inventory); player.openInventory(inventory);
} }
public static void fill(Inventory inv, ItemStack item) { public static void fill(Inventory inv, ItemStack item) {
int size = inv.getSize(); int size = inv.getSize();
int[] ignored = new int[]{20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 39, 40, 41}; int[] ignored = new int[]{20, 21, 22, 23, 24, 29, 30, 31, 32, 33};
// Fill // Fill
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {