diff --git a/src/main/java/world/bentobox/challenges/utils/GuiUtils.java b/src/main/java/world/bentobox/challenges/utils/GuiUtils.java index 8315910..34b6107 100644 --- a/src/main/java/world/bentobox/challenges/utils/GuiUtils.java +++ b/src/main/java/world/bentobox/challenges/utils/GuiUtils.java @@ -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); + } + } }