diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc64ad5d..f2b451be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## v5.2.1 Changelog
+```
+* Now the SettingsStorage#getPrefix method will add a new space at the end of the prefix.
+* Now GuiModel has an option to fill all the empty slots with an entry
+* Now GuiModel has an option to fill certain slots with an entry
+* Fixes SettingsGui not showing settings selector
+```
+
## v5.2.0 Changelog
```
* New Gui System (`xyz.thepogramsrc.superocreapi.spigot.gui.Gui`)
diff --git a/pom.xml b/pom.xml
index 61b83267..bffbcee2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
xyz.theprogramsrc
SuperCoreAPI
- 5.2.0
+ 5.2.1
jar
SuperCoreAPI
diff --git a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/objets/GuiModel.java b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/objets/GuiModel.java
index 2858f2ef..e86fb5e3 100644
--- a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/objets/GuiModel.java
+++ b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/objets/GuiModel.java
@@ -2,11 +2,13 @@
import java.util.LinkedHashMap;
+import xyz.theprogramsrc.supercoreapi.spigot.SpigotModule;
+
/**
* Representation of the Gui Model
* @since 5.2.0
*/
-public class GuiModel {
+public class GuiModel extends SpigotModule{
private GuiTitle title;
private GuiRows rows;
@@ -46,6 +48,9 @@ public LinkedHashMap getButtons() {
return buttons;
}
+ /**
+ * Clear the buttons from the Gui
+ */
public void clearButtons(){
this.buttons.clear();
}
@@ -72,6 +77,47 @@ public void addButton(GuiEntry entry){
}
}
+ /**
+ * Fills all the empty slots with the given entry
+ * @param entry The entry of the button to add to all the empty slots
+ * @since 5.2.1
+ */
+ public void fillEmptySlotsWithEntry(GuiEntry entry){
+ for(int i = 0; i < this.rows.size; i++){
+ if(!this.buttons.containsKey(i)){
+ this.setButton(i, entry);
+ }
+ }
+ }
+
+ /**
+ * Fills the empty slots with the empty item.
+ * See {@link xyz.theprogramsrc.supercoreapi.spigot.items.PreloadedItems#emptyItem}
+ * @since 5.2.1
+ */
+ public void fillEmptySlots(){
+ this.fillEmptySlotsWithEntry(new GuiEntry(this.getPreloadedItems().emptyItem()));
+ }
-
+ /**
+ * Fills the specified slots with the specified entry.
+ * @param entry The entry of the button to add to the given slots
+ * @param slots The slots to fill
+ * @since 5.2.1
+ */
+
+ public void fillWithEntry(GuiEntry entry, int[] slots){
+ for(int slot : slots){
+ this.setButton(slot, entry);
+ }
+ }
+
+ /**
+ * Fills the specified slots with an empty item.
+ * @param slots The slots to fill with the empty item
+ * @since 5.2.1
+ */
+ public void fillWithEmptyItem(int[] slots){
+ this.fillWithEntry(new GuiEntry(this.getPreloadedItems().emptyItem()), slots);
+ }
}
diff --git a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/precreated/settings/SettingsGui.java b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/precreated/settings/SettingsGui.java
index 7ce3b1d8..e322459c 100644
--- a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/precreated/settings/SettingsGui.java
+++ b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/gui/precreated/settings/SettingsGui.java
@@ -75,7 +75,24 @@ public void onBuild(GuiModel model) {
}
});
}else{
+ SettingPane pane = this.settingPanes[current];
+ int[] paneContainerSlots = pane.getContainerSlots();
+ GuiEntry[] paneEntries = pane.getButtons();
+ for(int i = 0; i < paneContainerSlots.length; i++){
+ int slot = paneContainerSlots[i];
+ if(i < paneEntries.length){
+ model.setButton(slot, paneEntries[i]);
+ }else{
+ if(pane.showItemsForEmpty()){
+ model.setButton(slot, new GuiEntry(this.getPreloadedItems().emptyItem()));
+ }
+ }
+ }
+ model.setButton(0, new GuiEntry(this.getPreloadedItems().getBackItem(), a -> {
+ this.current = -1;
+ this.open();
+ }));
}
}
diff --git a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/storage/SettingsStorage.java b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/storage/SettingsStorage.java
index 4c40e635..16db4103 100644
--- a/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/storage/SettingsStorage.java
+++ b/src/main/java/xyz/theprogramsrc/supercoreapi/spigot/storage/SettingsStorage.java
@@ -14,7 +14,7 @@ public class SettingsStorage extends SpigotModule {
@Override
public void onLoad() {
this.cfg = new YMLConfig(this.getPluginFolder(), "Settings.yml");
- this.defaultPrefix = "&9" + this.getPluginName() + "»&r";
+ this.defaultPrefix = "&9" + this.getPluginName() + "»&r ";
if(this.plugin.isFirstStart()){
this.loadDefaults();
}
@@ -41,7 +41,8 @@ public void setLanguage(String language) {
* @return the prefix
*/
public String getPrefix(){
- return this.cfg.getString("Prefix", this.defaultPrefix);
+ String prefix = this.cfg.getString("Prefix", this.defaultPrefix);
+ return prefix.endsWith(" ") ? prefix : (prefix + " ");
}
/**
@@ -49,7 +50,7 @@ public String getPrefix(){
* @return the language
*/
public String getLanguage() {
- return this.cfg.getString("Language", "en_US");
+ return this.cfg.getString("Language", "en");
}
private void loadDefaults(){