diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index e90a235..b4974a5 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -46,6 +46,10 @@
spigotmc-repo
https://hub.spigotmc.org/nexus/content/groups/public/
+
+ jitpack.io
+ https://jitpack.io
+
@@ -78,6 +82,12 @@
1.14.3-R0.1-SNAPSHOT
provided
+
+ com.github.MilkBowl
+ VaultAPI
+ 1.7
+ provided
+
UTF-8
diff --git a/pom.xml b/pom.xml
index a243741..d5a22bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,6 +59,10 @@
spigotmc-repo
https://hub.spigotmc.org/nexus/content/groups/public/
+
+ jitpack.io
+ https://jitpack.io
+
@@ -79,5 +83,11 @@
commons-codec
1.10
+
+ com.github.MilkBowl
+ VaultAPI
+ 1.7
+ provided
+
diff --git a/src/main/java/com/kiranhart/auctionhouse/inventory/inventories/AuctionGUI.java b/src/main/java/com/kiranhart/auctionhouse/inventory/inventories/AuctionGUI.java
index 52647fd..881efd1 100644
--- a/src/main/java/com/kiranhart/auctionhouse/inventory/inventories/AuctionGUI.java
+++ b/src/main/java/com/kiranhart/auctionhouse/inventory/inventories/AuctionGUI.java
@@ -7,25 +7,123 @@ package com.kiranhart.auctionhouse.inventory.inventories;
Code within this class is not to be redistributed without proper permission.
*/
+import com.google.common.collect.Lists;
+import com.kiranhart.auctionhouse.Core;
+import com.kiranhart.auctionhouse.api.statics.AuctionSettings;
+import com.kiranhart.auctionhouse.api.version.NBTEditor;
+import com.kiranhart.auctionhouse.api.version.XMaterial;
+import com.kiranhart.auctionhouse.auction.AuctionItem;
import com.kiranhart.auctionhouse.inventory.AGUI;
+import com.kiranhart.auctionhouse.util.Debugger;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
+import java.util.List;
+
public class AuctionGUI implements AGUI {
+ private Player p;
+ private List> chunks;
+
+ public AuctionGUI(Player p) {
+ this.p = p;
+ chunks = Lists.partition(Core.getInstance().getAuctionItems(), 45);
+ }
+
+ private int page = 1;
+
@Override
public void click(InventoryClickEvent e, ItemStack clicked, int slot) {
+ e.setCancelled(true);
+ Player p = (Player) e.getWhoClicked();
- }
+ /*
+ Page navigation system
+ */
- @Override
- public void close(InventoryCloseEvent e) {
+ try {
+ if (page >= 1 && slot == 48) p.openInventory(setPage(this.getPage() - 1).getInventory());
+ if (page >= 1 && slot == 50) p.openInventory(setPage(this.getPage() + 1).getInventory());
+ } catch (Exception ex) {
+ Debugger.report(ex, false);
+ }
+
+ //Different auction inventories
+ //Refresh Auction GUI
+ if (slot == 49) {
+
+ return;
+ }
+
+ //Open Listings GUI
+ if (slot == 45) {
+
+ return;
+ }
+
+ //Open Expired GUI
+ if (slot == 46) {
+
+ return;
+ }
+
+ //Open Transaction Selection GUI
+ if (slot == 51) {
+
+ return;
+ }
+
+ //Clicking on active auction items.
+ //Check if air
+ if (clicked == null || clicked.getType() == XMaterial.AIR.parseMaterial()) {
+ return;
+ }
+
+ AuctionItem possibleAuctionItem = null;
+
+ /*
+ Perform the proper steps if the user left-clicks (not using bid system)
+ */
+ if (e.getClick() == ClickType.LEFT) {
+ //Check if the bid system is set to false
+ if (!AuctionSettings.USE_BIDDING_SYSTEM) {
+ return;
+ }
+
+ //Get the key of the auction item
+ String auctionItemKey = NBTEditor.getString(clicked, "AuctionItemKey");
+ for (AuctionItem auctionItem : Core.getInstance().getAuctionItems()) {
+ if (auctionItem.getKey().equalsIgnoreCase(auctionItemKey)) possibleAuctionItem = auctionItem;
+ }
+
+
+
+ return;
+ }
}
@Override
public Inventory getInventory() {
return null;
}
+
+ @Override
+ public void close(InventoryCloseEvent e) {
+ }
+
+ public AuctionGUI setPage(int page) {
+ if (page <= 0)
+ this.page = 1;
+ else
+ this.page = page;
+ return this;
+ }
+
+ public int getPage() {
+ return page;
+ }
}
diff --git a/src/main/java/com/kiranhart/auctionhouse/util/Debugger.java b/src/main/java/com/kiranhart/auctionhouse/util/Debugger.java
index 2f9abd0..50ac9c3 100644
--- a/src/main/java/com/kiranhart/auctionhouse/util/Debugger.java
+++ b/src/main/java/com/kiranhart/auctionhouse/util/Debugger.java
@@ -27,4 +27,8 @@ public class Debugger {
Bukkit.getConsoleSender().sendMessage(translateAlternateColorCodes('&', "&b================================================================"));
}
}
+
+ public static void report(Exception e, boolean show) {
+ if (show) report(e);
+ }
}
diff --git a/src/main/java/com/kiranhart/auctionhouse/util/economy/Economy.java b/src/main/java/com/kiranhart/auctionhouse/util/economy/Economy.java
new file mode 100644
index 0000000..8c50b74
--- /dev/null
+++ b/src/main/java/com/kiranhart/auctionhouse/util/economy/Economy.java
@@ -0,0 +1,19 @@
+package com.kiranhart.auctionhouse.util.economy;
+/*
+ The current file was created by Kiran Hart
+ Date: August 05 2019
+ Time: 9:06 PM
+
+ Code within this class is not to be redistributed without proper permission.
+*/
+
+import org.bukkit.OfflinePlayer;
+
+public interface Economy {
+
+ boolean hasBalance(OfflinePlayer p, double cost);
+
+ boolean withdrawBalance(OfflinePlayer p, double cost);
+
+ boolean deposit(OfflinePlayer p, double amount);
+}
diff --git a/src/main/java/com/kiranhart/auctionhouse/util/economy/VaultEconomy.java b/src/main/java/com/kiranhart/auctionhouse/util/economy/VaultEconomy.java
new file mode 100644
index 0000000..58e1d49
--- /dev/null
+++ b/src/main/java/com/kiranhart/auctionhouse/util/economy/VaultEconomy.java
@@ -0,0 +1,11 @@
+package com.kiranhart.auctionhouse.util.economy;
+/*
+ The current file was created by Kiran Hart
+ Date: August 05 2019
+ Time: 9:13 PM
+
+ Code within this class is not to be redistributed without proper permission.
+*/
+
+public class VaultEconomy {
+}