Skip to content

Commit

Permalink
Remove item name from Border Items
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 21, 2019
1 parent 6078927 commit c78c690
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/main/java/world/bentobox/challenges/utils/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
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;


/**
Expand Down Expand Up @@ -72,7 +74,7 @@ public static void fillBorder(PanelBuilder panelBuilder, int rowCount, Material

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));
}
}
}
Expand Down Expand Up @@ -332,4 +334,30 @@ else if (material.equals(Material.PISTON_HEAD) || material.equals(Material.MOVIN

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);
}
}
}

0 comments on commit c78c690

Please sign in to comment.