This commit is contained in:
filoghost 2020-06-11 18:29:09 +02:00
parent a48121dbad
commit 27c05ece6a
2 changed files with 4 additions and 9 deletions

View File

@ -25,7 +25,6 @@ import org.bukkit.inventory.meta.ItemMeta;
import me.filoghost.chestcommands.ChestCommands;
import me.filoghost.chestcommands.Permissions;
import me.filoghost.chestcommands.action.Action;
import me.filoghost.chestcommands.api.Icon;
public class AdvancedIconMenu extends BaseIconMenu<AdvancedIcon> {
@ -77,12 +76,8 @@ public class AdvancedIconMenu extends BaseIconMenu<AdvancedIcon> {
}
@Override
protected boolean canViewIcon(Player player, Icon icon) {
if (icon instanceof AdvancedIcon) {
return true;
}
return ((AdvancedIcon) icon).canViewIcon(player);
protected boolean canViewIcon(Player player, AdvancedIcon icon) {
return icon.canViewIcon(player);
}
public void openCheckingPermission(Player player) {

View File

@ -72,7 +72,7 @@ public class BaseIconMenu<T extends Icon> {
Inventory inventory = Bukkit.createInventory(new MenuInventoryHolder(this), getSize(), title);
for (int i = 0; i < inventoryGrid.getSize(); i++) {
Icon icon = inventoryGrid.getElementAtIndex(i);
T icon = inventoryGrid.getElementAtIndex(i);
if (icon != null && canViewIcon(player, icon)) {
inventory.setItem(i, hideAttributes(icon.createItemStack(player)));
}
@ -81,7 +81,7 @@ public class BaseIconMenu<T extends Icon> {
player.openInventory(inventory);
}
protected boolean canViewIcon(Player player, Icon icon) {
protected boolean canViewIcon(Player player, T icon) {
return true;
}