v1.1.1 Update || Small Bug Fix

Hello, this update if fixing a small bug.

Bug:
  - Limiter was not personal but instead global.
This commit is contained in:
BadBones69 2016-11-14 17:50:23 -05:00
parent 936b7cf34f
commit ba92ec1ded
4 changed files with 27 additions and 18 deletions

View File

@ -2,7 +2,7 @@ name: CrazyAuctions
author: BadBones69 author: BadBones69
main: me.badbones69.crazyauctions.Main main: me.badbones69.crazyauctions.Main
website: https://www.spigotmc.org/resources/authors/kicjow.9719/ website: https://www.spigotmc.org/resources/authors/kicjow.9719/
version: 1.1 version: 1.1.1
depend: [Vault] depend: [Vault]
description: > description: >
A plugin to auction off items globally. A plugin to auction off items globally.

View File

@ -19,7 +19,9 @@ public class CrazyAuctions {
ArrayList<ItemStack> items = new ArrayList<ItemStack>(); ArrayList<ItemStack> items = new ArrayList<ItemStack>();
if(data.contains("Items")){ if(data.contains("Items")){
for(String i : data.getConfigurationSection("Items").getKeys(false)){ for(String i : data.getConfigurationSection("Items").getKeys(false)){
items.add(data.getItemStack("Items."+i+".Item").clone()); if(data.getString("Items." + i + ".Seller").equalsIgnoreCase(player.getName())){
items.add(data.getItemStack("Items."+i+".Item").clone());
}
} }
} }
return items; return items;
@ -30,13 +32,15 @@ public class CrazyAuctions {
ArrayList<ItemStack> items = new ArrayList<ItemStack>(); ArrayList<ItemStack> items = new ArrayList<ItemStack>();
if(data.contains("Items")){ if(data.contains("Items")){
for(String i : data.getConfigurationSection("Items").getKeys(false)){ for(String i : data.getConfigurationSection("Items").getKeys(false)){
if(data.getBoolean("Items."+i+".Biddable")){ if(data.getString("Items." + i + ".Seller").equalsIgnoreCase(player.getName())){
if(type==Shop.BID){ if(data.getBoolean("Items."+i+".Biddable")){
items.add(data.getItemStack("Items."+i+".Item").clone()); if(type == Shop.BID){
} items.add(data.getItemStack("Items."+i+".Item").clone());
}else{ }
if(type==Shop.SELL){ }else{
items.add(data.getItemStack("Items."+i+".Item").clone()); if(type == Shop.SELL){
items.add(data.getItemStack("Items."+i+".Item").clone());
}
} }
} }
} }

View File

@ -19,14 +19,17 @@ import org.bukkit.plugin.java.JavaPlugin;
import me.badbones69.crazyauctions.currency.Vault; import me.badbones69.crazyauctions.currency.Vault;
public class Main extends JavaPlugin implements Listener{ public class Main extends JavaPlugin implements Listener{
public static SettingsManager settings = SettingsManager.getInstance(); public static SettingsManager settings = SettingsManager.getInstance();
public static CrazyAuctions auc = CrazyAuctions.getInstance(); public static CrazyAuctions auc = CrazyAuctions.getInstance();
int file = 0; int file = 0;
@Override @Override
public void onDisable(){ public void onDisable(){
Bukkit.getScheduler().cancelTask(file); Bukkit.getScheduler().cancelTask(file);
settings.saveData(); settings.saveData();
} }
@Override @Override
public void onEnable(){ public void onEnable(){
saveDefaultConfig(); saveDefaultConfig();
@ -39,7 +42,7 @@ public class Main extends JavaPlugin implements Listener{
if (!Vault.setupEconomy()){ if (!Vault.setupEconomy()){
saveDefaultConfig(); saveDefaultConfig();
} }
if(Bukkit.getPluginManager().getPlugin("Vault")==null){ if(Bukkit.getPluginManager().getPlugin("Vault") == null){
Bukkit.getConsoleSender().sendMessage(Api.getPrefix()+ Bukkit.getConsoleSender().sendMessage(Api.getPrefix()+
Api.color("&cThis plugin is shutting down. This plugin requires a compatable currency plugin." Api.color("&cThis plugin is shutting down. This plugin requires a compatable currency plugin."
+ " &cPlease add Vault to continue using this.")); + " &cPlease add Vault to continue using this."));
@ -51,10 +54,11 @@ public class Main extends JavaPlugin implements Listener{
System.out.println("Error Submitting stats!"); System.out.println("Error Submitting stats!");
} }
} }
public boolean onCommand(CommandSender sender, Command cmd, String commandLable, String[] args){ public boolean onCommand(CommandSender sender, Command cmd, String commandLable, String[] args){
if(commandLable.equalsIgnoreCase("CrazyAuctions")||commandLable.equalsIgnoreCase("CrazyAuction") if(commandLable.equalsIgnoreCase("CrazyAuctions")||commandLable.equalsIgnoreCase("CrazyAuction")
||commandLable.equalsIgnoreCase("CA")||commandLable.equalsIgnoreCase("AH")){ ||commandLable.equalsIgnoreCase("CA")||commandLable.equalsIgnoreCase("AH")){
if(args.length==0){ if(args.length == 0){
if(!Api.hasPermission(sender, "Access"))return true; if(!Api.hasPermission(sender, "Access"))return true;
if(!(sender instanceof Player)){ if(!(sender instanceof Player)){
sender.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Players-Only"))); sender.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Players-Only")));
@ -70,7 +74,7 @@ public class Main extends JavaPlugin implements Listener{
GUI.openShop(player, Shop.SELL, Category.NONE, 1); GUI.openShop(player, Shop.SELL, Category.NONE, 1);
return true; return true;
} }
if(args.length>=1){ if(args.length >= 1){
if(args[0].equalsIgnoreCase("Help")){// CA Help if(args[0].equalsIgnoreCase("Help")){// CA Help
if(!Api.hasPermission(sender, "Access"))return true; if(!Api.hasPermission(sender, "Access"))return true;
sender.sendMessage(Api.color("&e-- &6Crazy Auctions Help &e--")); sender.sendMessage(Api.color("&e-- &6Crazy Auctions Help &e--"));
@ -130,7 +134,7 @@ public class Main extends JavaPlugin implements Listener{
sender.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Players-Only"))); sender.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Players-Only")));
return true; return true;
} }
if(args.length>=2){ if(args.length >= 2){
Player player = (Player) sender; Player player = (Player) sender;
if(args[0].equalsIgnoreCase("Sell")){ if(args[0].equalsIgnoreCase("Sell")){
if(!Api.hasPermission(player, "Sell"))return true; if(!Api.hasPermission(player, "Sell"))return true;
@ -140,7 +144,7 @@ public class Main extends JavaPlugin implements Listener{
} }
ItemStack item = Api.getItemInHand(player); ItemStack item = Api.getItemInHand(player);
int amount = item.getAmount(); int amount = item.getAmount();
if(args.length>=3){ if(args.length >= 3){
if(!Api.isInt(args[2])){ if(!Api.isInt(args[2])){
player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Not-A-Number") player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Not-A-Number")
.replaceAll("%Arg%", args[2]).replaceAll("%arg%", args[2]))); .replaceAll("%Arg%", args[2]).replaceAll("%arg%", args[2])));
@ -187,7 +191,7 @@ public class Main extends JavaPlugin implements Listener{
if(perm.startsWith("crazyauctions.sell.")){ if(perm.startsWith("crazyauctions.sell.")){
perm=perm.replace("crazyauctions.sell.", ""); perm=perm.replace("crazyauctions.sell.", "");
if(Api.isInt(perm)){ if(Api.isInt(perm)){
if(Integer.parseInt(perm)>SellLimit){ if(Integer.parseInt(perm) > SellLimit){
SellLimit = Integer.parseInt(perm); SellLimit = Integer.parseInt(perm);
} }
} }
@ -195,20 +199,20 @@ public class Main extends JavaPlugin implements Listener{
if(perm.startsWith("crazyauctions.bid.")){ if(perm.startsWith("crazyauctions.bid.")){
perm=perm.replace("crazyauctions.bid.", ""); perm=perm.replace("crazyauctions.bid.", "");
if(Api.isInt(perm)){ if(Api.isInt(perm)){
if(Integer.parseInt(perm)>BidLimit){ if(Integer.parseInt(perm) > BidLimit){
BidLimit = Integer.parseInt(perm); BidLimit = Integer.parseInt(perm);
} }
} }
} }
} }
if(args[0].equalsIgnoreCase("Sell")){ if(args[0].equalsIgnoreCase("Sell")){
if(auc.getItems(player, Shop.SELL).size()>=SellLimit){ if(auc.getItems(player, Shop.SELL).size() >= SellLimit){
player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Max-Items"))); player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Max-Items")));
return true; return true;
} }
} }
if(args[0].equalsIgnoreCase("Bid")){ if(args[0].equalsIgnoreCase("Bid")){
if(auc.getItems(player, Shop.BID).size()>=BidLimit){ if(auc.getItems(player, Shop.BID).size() >= BidLimit){
player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Max-Items"))); player.sendMessage(Api.getPrefix()+Api.color(settings.getMsg().getString("Messages.Max-Items")));
return true; return true;
} }

View File

@ -1,6 +1,7 @@
package me.badbones69.crazyauctions; package me.badbones69.crazyauctions;
public enum Shop{ public enum Shop{
SELL("Sell"), BID("Bid"); SELL("Sell"), BID("Bid");
String Name; String Name;