Skip to content

Commit

Permalink
Create new method in CommonGUI, that allows to fill border with black…
Browse files Browse the repository at this point in the history
… stained glass around Panel.
  • Loading branch information
BONNe committed Jan 19, 2019
1 parent 88f9d32 commit 0109431
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/world/bentobox/challenges/panel/CommonGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.List;

import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
Expand Down Expand Up @@ -233,6 +234,26 @@ protected PanelItem getButton(CommonButtons button)
}


/**
* This method creates border of black panes around given panel.
* @param panelBuilder PanelBuilder which must be filled with border blocks.
*/
protected void fillBorder(PanelBuilder panelBuilder)
{
for (int i = 0; i < 45; i++)
{
// First (i < 9) and last (i > 35) rows must be filled
// First column (i % 9 == 0) and last column (i % 9 == 8) also must be filled.

if (i < 9 || i > 35 || i % 9 == 0 || i % 9 == 8)
{
panelBuilder.item(i,
new PanelItemBuilder().name("").icon(Material.BLACK_STAINED_GLASS_PANE).build());
}
}
}


/**
* This method sets new value to ValueObject variable.
* @param value new Value of valueObject.
Expand Down

0 comments on commit 0109431

Please sign in to comment.