Added config option to define the item to use to fill gaps in Panels

Implements https://github.com/BentoBoxWorld/BentoBox/issues/1344
Addons should also use this setting as much as possible when dealing with Panels
This commit is contained in:
Florian CUNY 2020-05-13 18:06:15 +02:00
parent 321637b9b9
commit f66fafd0aa
5 changed files with 29 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Material;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
import world.bentobox.bentobox.api.configuration.ConfigObject;
@ -115,11 +116,15 @@ public class Settings implements ConfigObject {
private Set<String> fakePlayers = new HashSet<>();
/* PANELS */
@ConfigComment("Toggle whether panels should be closed or not when the player clicks anywhere outside of the inventory view.")
@ConfigEntry(path = "panel.close-on-click-outside")
private boolean closePanelOnClickOutside = true;
@ConfigComment("Defines the Material of the item that fills the gaps (in the header, etc.) of most panels.")
@ConfigEntry(path = "panel.filler-material", since = "1.14.0")
private Material panelFillerMaterial = Material.LIGHT_BLUE_STAINED_GLASS_PANE;
/*
* Logs
*/
@ -685,8 +690,27 @@ public class Settings implements ConfigObject {
/**
* Set the MongoDB client connection URI.
* @param mongodbConnectionUri connection URI.
* @since 1.14.0
*/
public void setMongodbConnectionUri(String mongodbConnectionUri) {
this.mongodbConnectionUri = mongodbConnectionUri;
}
/**
* Returns the Material of the item to preferably use when one needs to fill gaps in Panels.
* @return the Material of the item to preferably use when one needs to fill gaps in Panels.
* @since 1.14.0
*/
public Material getPanelFillerMaterial() {
return panelFillerMaterial;
}
/**
* Sets the Material of the item to preferably use when one needs to fill gaps in Panels.
* @param panelFillerMaterial the Material of the item to preferably use when one needs to fill gaps in Panels.
* @since 1.14.0
*/
public void setPanelFillerMaterial(Material panelFillerMaterial) {
this.panelFillerMaterial = panelFillerMaterial;
}
}

View File

@ -127,7 +127,7 @@ public class TabbedPanel extends Panel implements PanelListener {
private void setupHeader(Tab tab, TreeMap<Integer, PanelItem> items) {
// Set up top
for (int i = 0; i < 9; i++) {
items.put(i, new PanelItemBuilder().icon(Material.LIGHT_BLUE_STAINED_GLASS_PANE).name(" ").build());
items.put(i, new PanelItemBuilder().icon(plugin.getSettings().getPanelFillerMaterial()).name(" ").build());
}
// Add icons
for (Entry<Integer, Tab> tabPanel : tpb.getTabs().entrySet()) {

View File

@ -35,7 +35,7 @@ public class CatalogPanel {
// Setup header and corners
for (int i : PANES) {
builder.item(i, new PanelItemBuilder().icon(Material.LIGHT_BLUE_STAINED_GLASS_PANE).name(" ").build());
builder.item(i, new PanelItemBuilder().icon(plugin.getSettings().getPanelFillerMaterial()).name(" ").build());
}
PanelItemBuilder gamemodesButton = new PanelItemBuilder()

View File

@ -33,7 +33,7 @@ public class CreditsPanel {
// Setup header and corners
for (int i : PANES) {
builder.item(i, new PanelItemBuilder().icon(Material.LIGHT_BLUE_STAINED_GLASS_PANE).name(" ").build());
builder.item(i, new PanelItemBuilder().icon(plugin.getSettings().getPanelFillerMaterial()).name(" ").build());
}
if (plugin.getWebManager().getContributors(repository).isEmpty()) {

View File

@ -44,7 +44,7 @@ public class ManagementPanel {
// Setup header and corner
setupHeader(builder, user, view);
for (int i : PANES) {
builder.item(i, new PanelItemBuilder().icon(Material.LIGHT_BLUE_STAINED_GLASS_PANE).name(" ").build());
builder.item(i, new PanelItemBuilder().icon(plugin.getSettings().getPanelFillerMaterial()).name(" ").build());
}
// Setup the views