diff --git a/src/main/java/me/despical/inventoryframework/pane/Fillable.java b/src/main/java/me/despical/inventoryframework/pane/Fillable.java
new file mode 100644
index 0000000..7a699c8
--- /dev/null
+++ b/src/main/java/me/despical/inventoryframework/pane/Fillable.java
@@ -0,0 +1,55 @@
+package me.despical.inventoryframework.pane;
+
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.function.Consumer;
+
+/**
+ * An interface for panes that can be fillable
+ *
+ * @author Despical
+ * @since 1.0.8
+ *
+ * Created at 18.01.2021
+ */
+public interface Fillable {
+
+ /**
+ * Fills specified row line horizontally with given {@code itemStack}
+ *
+ * @param itemStack The {@link ItemStack} to fill the empty space with
+ * @param line Line to fill with {@code itemStack}
+ * @param action The action called whenever an interaction with the item happens
+ * @since 1.0.5
+ */
+ void fillHorizontallyWith(@NotNull ItemStack itemStack, int line, @Nullable Consumer action);
+
+ /**
+ * Fills specified row line horizontally with given {@code itemStack}
+ *
+ * @param itemStack The {@link ItemStack} to fill the empty space with
+ * @param line Line to fill with {@code itemStack}
+ * @since 1.0.5
+ */
+ void fillHorizontallyWith(@NotNull ItemStack itemStack, int line);
+
+ /**
+ * Fills inventory borders with given {@code itemStack}
+ *
+ * @param itemStack The {@link ItemStack} to fill the empty space with
+ * @param action The action called whenever an interaction with the item happens
+ * @since 1.0.8
+ */
+ void fillBorder(@NotNull ItemStack itemStack, @Nullable Consumer action);
+
+ /**
+ * Fills inventory borders with given {@code itemStack}
+ *
+ * @param itemStack The {@link ItemStack} to fill the empty space with
+ * @since 1.0.8
+ */
+ void fillBorder(@NotNull ItemStack itemStack);
+}
\ No newline at end of file
diff --git a/src/main/java/me/despical/inventoryframework/pane/StaticPane.java b/src/main/java/me/despical/inventoryframework/pane/StaticPane.java
index dd8a2bd..cd6325d 100644
--- a/src/main/java/me/despical/inventoryframework/pane/StaticPane.java
+++ b/src/main/java/me/despical/inventoryframework/pane/StaticPane.java
@@ -26,7 +26,7 @@
*
* Created at 04.09.2020
*/
-public class StaticPane extends Pane implements Flippable, Rotatable {
+public class StaticPane extends Pane implements Flippable, Rotatable, Fillable {
/**
* A map of locations inside this pane and their item. The locations are stored in a way where the x coordinate is
@@ -222,14 +222,6 @@ public void fillWith(@NotNull ItemStack itemStack) {
this.fillWith(itemStack, null);
}
- /**
- * Fills specified row line horizontally with given {@code itemStack}
- *
- * @param itemStack The {@link ItemStack} to fill the empty space with
- * @param line Line to fill with {@code itemStack}
- * @param action The action called whenever an interaction with the item happens
- * @since 1.0.5
- */
public void fillHorizontallyWith(@NotNull ItemStack itemStack, int line, @Nullable Consumer action) {
Set> locations = this.items.keySet();
boolean found = false;
@@ -252,18 +244,35 @@ public void fillHorizontallyWith(@NotNull ItemStack itemStack, int line, @Nullab
}
}
- /**
- * Fills specified row line horizontally with given {@code itemStack}
- *
- * @param itemStack The {@link ItemStack} to fill the empty space with
- * @param line Line to fill with {@code itemStack}
- * @since 1.0.5
- */
public void fillHorizontallyWith(@NotNull ItemStack itemStack, int line) {
this.fillHorizontallyWith(itemStack, line, null);
}
- @NotNull
+ @Override
+ public void fillBorder(@NotNull ItemStack itemStack, @Nullable Consumer action) {
+ // Top
+ for (int i = 0; i < 9; i++)
+ this.addItem(new GuiItem(itemStack, action), i, 0);
+
+ // Bottom
+ for (int i = 0; i < 9; i++)
+ this.addItem(new GuiItem(itemStack, action), i, y - 1);
+
+ // Left
+ for (int i = 0; i < y * 9; i += 9)
+ this.addItem(new GuiItem(itemStack, action), 0, i % (y - 1));
+
+ // Right
+ for (int i = 8; i < y * 9; i += 9)
+ this.addItem(new GuiItem(itemStack, action), 8, i % (y - 1));
+ }
+
+ @Override
+ public void fillBorder(@NotNull ItemStack itemStack) {
+ this.fillBorder(itemStack, null);
+ }
+
+ @NotNull
@Override
public Collection getItems() {
return items.values();