From ee53672de15e8456cab1bcb5d042239f4f330bb3 Mon Sep 17 00:00:00 2001 From: BadBones69 Date: Thu, 10 Aug 2017 15:27:09 -0400 Subject: [PATCH] v1.2.4 Update Bugs: - Comment in the config.yml said Budding instead of Bidding. - Small typos were found in the Messages.yml. Thanks to Fozzie for the pull request. - Some permission plugins such as BungeePerms did not work with /ah sell . Added: - AuctionWinBidEvent: called when someone wins a bidding item. Only called if the winner is online. - AuctionNewBidEvent: called when a player places a bid onto an item. - AuctionListEvent: called when a player lists a new item to the auction house. - AuctionBuyEvent: called when a player buys an item on the buying auction house. Changes: - Cleaned up some code so it is more organized. --- .classpath | 2 +- Notes | 2 +- config.yml | 2 +- plugin.yml | 2 +- src/me/badbones69/crazyauctions/Main.java | 36 ++++++++--- src/me/badbones69/crazyauctions/Methods.java | 8 ++- .../crazyauctions/{ => api}/Category.java | 2 +- .../{ => api}/CrazyAuctions.java | 10 +-- .../crazyauctions/{ => api}/MCUpdate.java | 2 +- .../{ => api}/SettingsManager.java | 2 +- .../{Shop.java => api/ShopType.java} | 10 +-- .../crazyauctions/{ => controlers}/GUI.java | 38 ++++++----- .../crazyauctions/events/AuctionBuyEvent.java | 54 ++++++++++++++++ .../events/AuctionListEvent.java | 63 +++++++++++++++++++ .../events/AuctionNewBidEvent.java | 54 ++++++++++++++++ .../events/AuctionWinBidEvent.java | 54 ++++++++++++++++ 16 files changed, 301 insertions(+), 40 deletions(-) rename src/me/badbones69/crazyauctions/{ => api}/Category.java (98%) rename src/me/badbones69/crazyauctions/{ => api}/CrazyAuctions.java (86%) rename src/me/badbones69/crazyauctions/{ => api}/MCUpdate.java (99%) rename src/me/badbones69/crazyauctions/{ => api}/SettingsManager.java (98%) rename src/me/badbones69/crazyauctions/{Shop.java => api/ShopType.java} (68%) rename src/me/badbones69/crazyauctions/{ => controlers}/GUI.java (97%) create mode 100644 src/me/badbones69/crazyauctions/events/AuctionBuyEvent.java create mode 100644 src/me/badbones69/crazyauctions/events/AuctionListEvent.java create mode 100644 src/me/badbones69/crazyauctions/events/AuctionNewBidEvent.java create mode 100644 src/me/badbones69/crazyauctions/events/AuctionWinBidEvent.java diff --git a/.classpath b/.classpath index 2d421c1..8d26340 100644 --- a/.classpath +++ b/.classpath @@ -2,7 +2,7 @@ - + diff --git a/Notes b/Notes index 2e54ca8..f31e856 100644 --- a/Notes +++ b/Notes @@ -12,7 +12,7 @@ Feature Requests: - Add an option to search for items by ID. Reports: - - When you collect an item from the expired list with a fully inventory, the item gets lost. + - Bug Fixes: - diff --git a/config.yml b/config.yml index 817d44f..b08a470 100644 --- a/config.yml +++ b/config.yml @@ -4,7 +4,7 @@ Settings: Players-Current-Items: '&8Your Current Listings' #The Name of the Player Current Items GUI. Cancelled/Expired-Items: '&8Cancelled/Expired Listings' #Name of the Cancelled/Expired GUI. Buying-Item: '&8Purchase Item: Are You Sure?' #Name of the Buying GUI. - Bidding-On-Item: '&8You Are Bidding On This Item.' #Name of the Budding GUI. + Bidding-On-Item: '&8You Are Bidding On This Item.' #Name of the Bidding GUI. Categories: '&8Categories' #Name of the Category GUI. Sell-Time: 2d #The time that each item will sell for. Bid-Time: 2m 30s #Time for each item that is biddable. diff --git a/plugin.yml b/plugin.yml index 2571740..1391771 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: CrazyAuctions author: BadBones69 main: me.badbones69.crazyauctions.Main website: https://www.spigotmc.org/resources/authors/kicjow.9719/ -version: 1.2.3 +version: 1.2.4 depend: [Vault] description: > A plugin to auction off items globally. diff --git a/src/me/badbones69/crazyauctions/Main.java b/src/me/badbones69/crazyauctions/Main.java index 21ca7a7..8c4db46 100644 --- a/src/me/badbones69/crazyauctions/Main.java +++ b/src/me/badbones69/crazyauctions/Main.java @@ -17,7 +17,14 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; +import me.badbones69.crazyauctions.api.Category; +import me.badbones69.crazyauctions.api.CrazyAuctions; +import me.badbones69.crazyauctions.api.MCUpdate; +import me.badbones69.crazyauctions.api.SettingsManager; +import me.badbones69.crazyauctions.api.ShopType; +import me.badbones69.crazyauctions.controlers.GUI; import me.badbones69.crazyauctions.currency.Vault; +import me.badbones69.crazyauctions.events.AuctionListEvent; public class Main extends JavaPlugin implements Listener{ @@ -67,11 +74,11 @@ public class Main extends JavaPlugin implements Listener{ Player player = (Player) sender; if(settings.getConfig().contains("Settings.Category-Page-Opens-First")){ if(settings.getConfig().getBoolean("Settings.Category-Page-Opens-First")){ - GUI.openCateories(player, Shop.SELL); + GUI.openCateories(player, ShopType.SELL); return true; } } - GUI.openShop(player, Shop.SELL, Category.NONE, 1); + GUI.openShop(player, ShopType.SELL, Category.NONE, 1); return true; } if(args.length >= 1){ @@ -201,14 +208,26 @@ public class Main extends JavaPlugin implements Listener{ } } } + for(int i = 1; i < 100; i++) { + if(SellLimit < i) { + if(player.hasPermission("crazyauctions.sell." + i)) { + SellLimit = i; + } + } + if(BidLimit < i) { + if(player.hasPermission("crazyauctions.bid." + i)) { + BidLimit = i; + } + } + } if(args[0].equalsIgnoreCase("Sell")){ - if(auc.getItems(player, Shop.SELL).size() >= SellLimit){ + if(auc.getItems(player, ShopType.SELL).size() >= SellLimit){ player.sendMessage(Methods.getPrefix()+Methods.color(settings.getMsg().getString("Messages.Max-Items"))); return true; } } if(args[0].equalsIgnoreCase("Bid")){ - if(auc.getItems(player, Shop.BID).size() >= BidLimit){ + if(auc.getItems(player, ShopType.BID).size() >= BidLimit){ player.sendMessage(Methods.getPrefix()+Methods.color(settings.getMsg().getString("Messages.Max-Items"))); return true; } @@ -244,12 +263,14 @@ public class Main extends JavaPlugin implements Listener{ settings.getData().set("Items."+num+".Full-Time", Methods.convertToMill(settings.getConfig().getString("Settings.Full-Expire-Time"))); int id = r.nextInt(999999); // Runs 3x to check for same ID. - for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(999999); - for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(999999); - for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(999999); + for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(Integer.MAX_VALUE); + for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(Integer.MAX_VALUE); + for(String i : settings.getData().getConfigurationSection("Items").getKeys(false))if(settings.getData().getInt("Items."+i+".StoreID")==id)id=r.nextInt(Integer.MAX_VALUE); settings.getData().set("Items."+num+".StoreID", id); + ShopType type = ShopType.SELL; if(args[0].equalsIgnoreCase("Bid")){ settings.getData().set("Items."+num+".Biddable", true); + type = ShopType.BID; }else{ settings.getData().set("Items."+num+".Biddable", false); } @@ -258,6 +279,7 @@ public class Main extends JavaPlugin implements Listener{ I.setAmount(amount); settings.getData().set("Items."+num+".Item", I); settings.saveData(); + Bukkit.getPluginManager().callEvent(new AuctionListEvent(player, type, I, price)); player.sendMessage(Methods.getPrefix()+Methods.color(settings.getMsg().getString("Messages.Added-Item-To-Auction") .replaceAll("%Price%", price+"").replaceAll("%price%", price+""))); if(item.getAmount()<=1||(item.getAmount()-amount)<=0){ diff --git a/src/me/badbones69/crazyauctions/Methods.java b/src/me/badbones69/crazyauctions/Methods.java index 35a8a58..4ab1b14 100644 --- a/src/me/badbones69/crazyauctions/Methods.java +++ b/src/me/badbones69/crazyauctions/Methods.java @@ -24,6 +24,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.Plugin; import me.badbones69.crazyauctions.currency.CurrencyManager; +import me.badbones69.crazyauctions.events.AuctionWinBidEvent; public class Methods { @@ -397,7 +398,9 @@ public class Methods { if(cal.after(expireTime)){ int num = 1; for(;data.contains("OutOfTime/Cancelled."+num);num++); - if(data.getBoolean("Items."+i+".Biddable")&&!data.getString("Items."+i+".TopBidder").equalsIgnoreCase("None")&&CurrencyManager.getMoney(Methods.getPlayer(data.getString("Items."+i+".TopBidder")))>=data.getInt("Items."+i+".Price")){ + if(data.getBoolean("Items."+i+".Biddable")&& + !data.getString("Items."+i+".TopBidder").equalsIgnoreCase("None")&& + CurrencyManager.getMoney(Methods.getPlayer(data.getString("Items."+i+".TopBidder")))>=data.getInt("Items."+i+".Price")){ String winner = data.getString("Items."+i+".TopBidder"); String seller = data.getString("Items."+i+".Seller"); Long price = data.getLong("Items."+i+".Price"); @@ -405,6 +408,7 @@ public class Methods { CurrencyManager.removeMoney(Methods.getOfflinePlayer(winner), price); if(Methods.isOnline(winner)){ Player player = Methods.getPlayer(winner); + Bukkit.getPluginManager().callEvent(new AuctionWinBidEvent(player, data.getItemStack("Items."+i+".Item"), price)); player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Win-Bidding") .replaceAll("%Price%", getPrice(i, false)).replaceAll("%price%", getPrice(i, false)))); } @@ -450,4 +454,4 @@ public class Methods { return NumberFormat.getNumberInstance().format(price); } -} +} \ No newline at end of file diff --git a/src/me/badbones69/crazyauctions/Category.java b/src/me/badbones69/crazyauctions/api/Category.java similarity index 98% rename from src/me/badbones69/crazyauctions/Category.java rename to src/me/badbones69/crazyauctions/api/Category.java index 8a4ac5b..b5a548c 100644 --- a/src/me/badbones69/crazyauctions/Category.java +++ b/src/me/badbones69/crazyauctions/api/Category.java @@ -1,4 +1,4 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.api; import java.util.ArrayList; diff --git a/src/me/badbones69/crazyauctions/CrazyAuctions.java b/src/me/badbones69/crazyauctions/api/CrazyAuctions.java similarity index 86% rename from src/me/badbones69/crazyauctions/CrazyAuctions.java rename to src/me/badbones69/crazyauctions/api/CrazyAuctions.java index 92a283b..c9da96c 100644 --- a/src/me/badbones69/crazyauctions/CrazyAuctions.java +++ b/src/me/badbones69/crazyauctions/api/CrazyAuctions.java @@ -1,4 +1,4 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.api; import java.util.ArrayList; @@ -6,6 +6,8 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import me.badbones69.crazyauctions.Main; + public class CrazyAuctions { public static CrazyAuctions instance; @@ -30,18 +32,18 @@ public class CrazyAuctions { return items; } - public ArrayList getItems(Player player, Shop type){ + public ArrayList getItems(Player player, ShopType type){ FileConfiguration data = Main.settings.getData(); ArrayList items = new ArrayList(); if(data.contains("Items")){ for(String i : data.getConfigurationSection("Items").getKeys(false)){ if(data.getString("Items." + i + ".Seller").equalsIgnoreCase(player.getName())){ if(data.getBoolean("Items." + i + ".Biddable")){ - if(type == Shop.BID){ + if(type == ShopType.BID){ items.add(data.getItemStack("Items."+i+".Item").clone()); } }else{ - if(type == Shop.SELL){ + if(type == ShopType.SELL){ items.add(data.getItemStack("Items."+i+".Item").clone()); } } diff --git a/src/me/badbones69/crazyauctions/MCUpdate.java b/src/me/badbones69/crazyauctions/api/MCUpdate.java similarity index 99% rename from src/me/badbones69/crazyauctions/MCUpdate.java rename to src/me/badbones69/crazyauctions/api/MCUpdate.java index 4db24fe..87a56e9 100644 --- a/src/me/badbones69/crazyauctions/MCUpdate.java +++ b/src/me/badbones69/crazyauctions/api/MCUpdate.java @@ -1,4 +1,4 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.api; import java.io.BufferedReader; import java.io.IOException; diff --git a/src/me/badbones69/crazyauctions/SettingsManager.java b/src/me/badbones69/crazyauctions/api/SettingsManager.java similarity index 98% rename from src/me/badbones69/crazyauctions/SettingsManager.java rename to src/me/badbones69/crazyauctions/api/SettingsManager.java index 8550950..53972de 100644 --- a/src/me/badbones69/crazyauctions/SettingsManager.java +++ b/src/me/badbones69/crazyauctions/api/SettingsManager.java @@ -1,4 +1,4 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.api; import java.io.File; import java.io.FileOutputStream; diff --git a/src/me/badbones69/crazyauctions/Shop.java b/src/me/badbones69/crazyauctions/api/ShopType.java similarity index 68% rename from src/me/badbones69/crazyauctions/Shop.java rename to src/me/badbones69/crazyauctions/api/ShopType.java index c7be912..ac4a310 100644 --- a/src/me/badbones69/crazyauctions/Shop.java +++ b/src/me/badbones69/crazyauctions/api/ShopType.java @@ -1,6 +1,6 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.api; -public enum Shop{ +public enum ShopType{ SELL("Sell"), BID("Bid"); @@ -9,7 +9,7 @@ public enum Shop{ /** * @param name Name of the Shop Type. */ - private Shop(String name){ + private ShopType(String name){ this.Name=name; } @@ -24,8 +24,8 @@ public enum Shop{ * @param name Name of the Type you want. * @return Returns the Type as a Enum. */ - public static Shop getFromName(String name){ - for(Shop type : Shop.values()){ + public static ShopType getFromName(String name){ + for(ShopType type : ShopType.values()){ if(type.getName().equalsIgnoreCase(name)){ return type; } diff --git a/src/me/badbones69/crazyauctions/GUI.java b/src/me/badbones69/crazyauctions/controlers/GUI.java similarity index 97% rename from src/me/badbones69/crazyauctions/GUI.java rename to src/me/badbones69/crazyauctions/controlers/GUI.java index 0360804..6606fdd 100644 --- a/src/me/badbones69/crazyauctions/GUI.java +++ b/src/me/badbones69/crazyauctions/controlers/GUI.java @@ -1,4 +1,4 @@ -package me.badbones69.crazyauctions; +package me.badbones69.crazyauctions.controlers; import java.util.ArrayList; import java.util.HashMap; @@ -19,20 +19,26 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; +import me.badbones69.crazyauctions.Main; +import me.badbones69.crazyauctions.Methods; +import me.badbones69.crazyauctions.api.Category; +import me.badbones69.crazyauctions.api.ShopType; import me.badbones69.crazyauctions.currency.CurrencyManager; +import me.badbones69.crazyauctions.events.AuctionBuyEvent; +import me.badbones69.crazyauctions.events.AuctionNewBidEvent; public class GUI implements Listener{ private static HashMap Bidding = new HashMap(); private static HashMap BiddingID = new HashMap(); - private static HashMap Type = new HashMap(); // Shop Type + private static HashMap Type = new HashMap(); // Shop Type private static HashMap Cat = new HashMap(); // Category Type private static HashMap> List = new HashMap>(); private static HashMap IDs = new HashMap(); public static Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("CrazyAuctions"); - public static void openShop(Player player, Shop sell, Category cat, int page){ + public static void openShop(Player player, ShopType sell, Category cat, int page){ Methods.updateAuction(); FileConfiguration config = Main.settings.getConfig(); FileConfiguration data = Main.settings.getData(); @@ -53,7 +59,7 @@ public class GUI implements Listener{ List lore = new ArrayList(); if(cat.getItems().contains(data.getItemStack("Items."+i+".Item").getType()) || cat == Category.NONE){ if(data.getBoolean("Items."+i+".Biddable")){ - if(sell==Shop.BID){ + if(sell==ShopType.BID){ String seller = data.getString("Items."+i+".Seller"); String topbidder = data.getString("Items."+i+".TopBidder"); for(String l : config.getStringList("Settings.GUISettings.Bidding")){ @@ -66,7 +72,7 @@ public class GUI implements Listener{ ID.add(data.getInt("Items."+i+".StoreID")); } }else{ - if(sell==Shop.SELL){ + if(sell==ShopType.SELL){ for(String l : config.getStringList("Settings.GUISettings.SellingItemLore")){ lore.add(l.replaceAll("%Price%", Methods.getPrice(i, false)).replaceAll("%price%", Methods.getPrice(i, false)) .replaceAll("%Seller%", data.getString("Items."+i+".Seller")).replaceAll("%seller%", data.getString("Items."+i+".Seller"))); @@ -85,13 +91,13 @@ public class GUI implements Listener{ options.add("SellingItems");options.add("Cancelled/ExpiredItems"); options.add("PreviousPage");options.add("Refesh");options.add("NextPage"); options.add("Category1");options.add("Category2"); - if(sell==Shop.SELL){ - Type.put(player, Shop.SELL); + if(sell==ShopType.SELL){ + Type.put(player, ShopType.SELL); options.add("Bidding/Selling.Selling"); options.add("WhatIsThis.SellingShop"); } - if(sell==Shop.BID){ - Type.put(player, Shop.BID); + if(sell==ShopType.BID){ + Type.put(player, ShopType.BID); options.add("Bidding/Selling.Bidding"); options.add("WhatIsThis.BiddingShop"); } @@ -126,7 +132,7 @@ public class GUI implements Listener{ player.openInventory(inv); } - public static void openCateories(Player player, Shop shop){ + public static void openCateories(Player player, ShopType shop){ Methods.updateAuction(); FileConfiguration config = Main.settings.getConfig(); Inventory inv = Bukkit.createInventory(null, 54, Methods.color(config.getString("Settings.Categories"))); @@ -263,7 +269,7 @@ public class GUI implements Listener{ FileConfiguration data = Main.settings.getData(); FileConfiguration msg = Main.settings.getMsg(); if(!data.contains("Items."+ID)){ - openShop(player, Shop.SELL, Cat.get(player), 1); + openShop(player, ShopType.SELL, Cat.get(player), 1); player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Item-Doesnt-Exist"))); return; } @@ -309,7 +315,7 @@ public class GUI implements Listener{ FileConfiguration data = Main.settings.getData(); FileConfiguration msg = Main.settings.getMsg(); if(!data.contains("Items."+ID)){ - openShop(player, Shop.BID, Cat.get(player), 1); + openShop(player, ShopType.BID, Cat.get(player), 1); player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Item-Doesnt-Exist"))); return; } @@ -506,6 +512,7 @@ public class GUI implements Listener{ player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Bid-More-Money"))); return; } + Bukkit.getPluginManager().callEvent(new AuctionNewBidEvent(player, data.getItemStack("Items."+ID+".Item"), bid)); data.set("Items."+ID+".Price", bid); data.set("Items."+ID+".TopBidder", player.getName()); player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Bid-Msg") @@ -616,12 +623,12 @@ public class GUI implements Listener{ return; } if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Bidding/Selling.Selling.Name")))){ - openShop(player, Shop.BID, Cat.get(player), 1); + openShop(player, ShopType.BID, Cat.get(player), 1); playClick(player); return; } if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Bidding/Selling.Bidding.Name")))){ - openShop(player, Shop.SELL, Cat.get(player), 1); + openShop(player, ShopType.SELL, Cat.get(player), 1); playClick(player); return; } @@ -797,6 +804,8 @@ public class GUI implements Listener{ .replaceAll("%Money_Needed%", (cost-CurrencyManager.getMoney(player))+"").replaceAll("%money_needed%", (cost-CurrencyManager.getMoney(player))+""))); return; } + ItemStack i = data.getItemStack("Items."+ID+".Item"); + Bukkit.getPluginManager().callEvent(new AuctionBuyEvent(player, i, cost)); CurrencyManager.removeMoney(player, cost); CurrencyManager.addMoney(Methods.getOfflinePlayer(seller), cost); player.sendMessage(Methods.getPrefix()+Methods.color(msg.getString("Messages.Bought-Item") @@ -807,7 +816,6 @@ public class GUI implements Listener{ .replaceAll("%Price%", Methods.getPrice(ID, false)).replaceAll("%price%", Methods.getPrice(ID, false)) .replaceAll("%Player%", player.getName()).replaceAll("%player%", player.getName()))); } - ItemStack i = data.getItemStack("Items."+ID+".Item"); player.getInventory().addItem(i); data.set("Items."+ID, null); Main.settings.saveData(); diff --git a/src/me/badbones69/crazyauctions/events/AuctionBuyEvent.java b/src/me/badbones69/crazyauctions/events/AuctionBuyEvent.java new file mode 100644 index 0000000..eb5e4bf --- /dev/null +++ b/src/me/badbones69/crazyauctions/events/AuctionBuyEvent.java @@ -0,0 +1,54 @@ +package me.badbones69.crazyauctions.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +/** + * + * @author BadBones69 + * + * This event is fired when a player buys something from the selling auction house. + * + */ +public class AuctionBuyEvent extends Event{ + + private Player player; + private long price; + private ItemStack item; + private static final HandlerList handlers = new HandlerList(); + + /** + * + * @param player + * @param item + * @param price + */ + public AuctionBuyEvent(Player player, ItemStack item, long price) { + this.player = player; + this.item = item; + this.price = price; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public Player getPlayer() { + return player; + } + + public ItemStack getItem() { + return item; + } + + public long getPrice() { + return price; + } + +} \ No newline at end of file diff --git a/src/me/badbones69/crazyauctions/events/AuctionListEvent.java b/src/me/badbones69/crazyauctions/events/AuctionListEvent.java new file mode 100644 index 0000000..0fca59f --- /dev/null +++ b/src/me/badbones69/crazyauctions/events/AuctionListEvent.java @@ -0,0 +1,63 @@ +package me.badbones69.crazyauctions.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +import me.badbones69.crazyauctions.api.ShopType; + +/** + * + * @author BadBones69 + * + * This event is fired when a new item is listed onto the auction house. + * + */ +public class AuctionListEvent extends Event{ + + private Player player; + private long price; + private ShopType shop; + private ItemStack item; + private static final HandlerList handlers = new HandlerList(); + + /** + * + * @param player + * @param shop + * @param item + * @param price + */ + public AuctionListEvent(Player player, ShopType shop, ItemStack item, long price) { + this.player = player; + this.shop = shop; + this.item = item; + this.price = price; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public Player getPlayer() { + return player; + } + + public ShopType getShopType() { + return shop; + } + + public ItemStack getItem() { + return item; + } + + public long getPrice() { + return price; + } + +} \ No newline at end of file diff --git a/src/me/badbones69/crazyauctions/events/AuctionNewBidEvent.java b/src/me/badbones69/crazyauctions/events/AuctionNewBidEvent.java new file mode 100644 index 0000000..b327409 --- /dev/null +++ b/src/me/badbones69/crazyauctions/events/AuctionNewBidEvent.java @@ -0,0 +1,54 @@ +package me.badbones69.crazyauctions.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +/** + * + * @author BadBones69 + * + * This event is fired when a player places a new bid onto an item in the auction house. + * + */ +public class AuctionNewBidEvent extends Event{ + + private Player player; + private long bid; + private ItemStack item; + private static final HandlerList handlers = new HandlerList(); + + /** + * + * @param player + * @param item + * @param bid + */ + public AuctionNewBidEvent(Player player, ItemStack item, long bid) { + this.player = player; + this.item = item; + this.bid = bid; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public Player getPlayer() { + return player; + } + + public ItemStack getItem() { + return item; + } + + public long getBid() { + return bid; + } + +} \ No newline at end of file diff --git a/src/me/badbones69/crazyauctions/events/AuctionWinBidEvent.java b/src/me/badbones69/crazyauctions/events/AuctionWinBidEvent.java new file mode 100644 index 0000000..b129ce8 --- /dev/null +++ b/src/me/badbones69/crazyauctions/events/AuctionWinBidEvent.java @@ -0,0 +1,54 @@ +package me.badbones69.crazyauctions.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; + +/** + * + * @author BadBones69 + * + * This event is fired when a bidding item's time has run out and so a player wins the item. + * + */ +public class AuctionWinBidEvent extends Event{ + + private Player player; + private long bid; + private ItemStack item; + private static final HandlerList handlers = new HandlerList(); + + /** + * + * @param player + * @param item + * @param bid + */ + public AuctionWinBidEvent(Player player, ItemStack item, long bid) { + this.player = player; + this.item = item; + this.bid = bid; + } + + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + public Player getPlayer() { + return player; + } + + public ItemStack getItem() { + return item; + } + + public long getBid() { + return bid; + } + +} \ No newline at end of file