Create new method in CommonGUI, that allows to fill border with black stained glass around Panel.

This commit is contained in:
BONNe 2019-01-19 21:25:48 +02:00
parent 88f9d32862
commit 0109431262

View File

@ -8,6 +8,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import world.bentobox.bentobox.api.panels.PanelItem; 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.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.ChallengesAddon;
@ -233,6 +234,26 @@ public abstract class CommonGUI
} }
/**
* 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. * This method sets new value to ValueObject variable.
* @param value new Value of valueObject. * @param value new Value of valueObject.