mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
refresh
This commit is contained in:
parent
c5591fe742
commit
9ea4986092
@ -46,6 +46,10 @@
|
|||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -78,6 +82,12 @@
|
|||||||
<version>1.14.3-R0.1-SNAPSHOT</version>
|
<version>1.14.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
10
pom.xml
10
pom.xml
@ -59,6 +59,10 @@
|
|||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -79,5 +83,11 @@
|
|||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<version>1.10</version>
|
<version>1.10</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -7,25 +7,123 @@ package com.kiranhart.auctionhouse.inventory.inventories;
|
|||||||
Code within this class is not to be redistributed without proper permission.
|
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.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.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AuctionGUI implements AGUI {
|
public class AuctionGUI implements AGUI {
|
||||||
|
|
||||||
|
private Player p;
|
||||||
|
private List<List<AuctionItem>> chunks;
|
||||||
|
|
||||||
|
public AuctionGUI(Player p) {
|
||||||
|
this.p = p;
|
||||||
|
chunks = Lists.partition(Core.getInstance().getAuctionItems(), 45);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int page = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void click(InventoryClickEvent e, ItemStack clicked, int slot) {
|
public void click(InventoryClickEvent e, ItemStack clicked, int slot) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
Player p = (Player) e.getWhoClicked();
|
||||||
|
|
||||||
}
|
/*
|
||||||
|
Page navigation system
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
try {
|
||||||
public void close(InventoryCloseEvent e) {
|
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
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return null;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,8 @@ public class Debugger {
|
|||||||
Bukkit.getConsoleSender().sendMessage(translateAlternateColorCodes('&', "&b================================================================"));
|
Bukkit.getConsoleSender().sendMessage(translateAlternateColorCodes('&', "&b================================================================"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void report(Exception e, boolean show) {
|
||||||
|
if (show) report(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
@ -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 {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user