Remove item name from Border Items

This commit is contained in:
BONNe1704 2019-01-21 14:00:13 +02:00
parent 60789276be
commit c78c690818

View File

@ -5,8 +5,10 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import java.util.Collections;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
/**
@ -72,7 +74,7 @@ public class GuiUtils
if (i < 9 || i > 9 * (rowCount - 1) || i % 9 == 0 || i % 9 == 8)
{
panelBuilder.item(i, new PanelItemBuilder().name("&2").icon(material).build());
panelBuilder.item(i, BorderBlock.getPanelBorder(material));
}
}
}
@ -332,4 +334,30 @@ public class GuiUtils
return itemStack;
}
/**
* This BorderBlock is simple PanelItem but without item meta data.
*/
private static class BorderBlock extends PanelItem
{
private BorderBlock(ItemStack icon)
{
super(icon.clone(), " ", Collections.emptyList(), false, null, false);
}
/**
* This method retunrs BorderBlock with requested item stack.
* @param material of which broder must be created.
* @return PanelItem that acts like border.
*/
private static BorderBlock getPanelBorder(Material material)
{
ItemStack itemStack = new ItemStack(material);
itemStack.getItemMeta().setDisplayName(" ");
return new BorderBlock(itemStack);
}
}
}