package org.shanerx.tradeshop;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;

import java.util.ArrayList;

public class Utils {

	final String plugin = "TradeShop";
	final String author = "Lori00";
	final String version = Bukkit.getPluginManager().getPlugin("TradeShop").getDescription().getVersion();
	final String website = null;
	
	final String PREFIX = "&a[&eTradeShop&a] ";

	public String getPluginName() {
		return plugin;
	}
	
	public String getVersion() {
		return version;
	}
	
	public String getAuthor() {
		return author;
	}
	
	public String getWebsite() {
		return website;
	}
	
	public String getPrefix() {
		return PREFIX;
	}
	
	public boolean isTradeShopSign(Block b) {
		if (b.getType() != Material.SIGN_POST && b.getType() != Material.WALL_SIGN) {
			return false;
		}
		Sign sign = (Sign) b.getState();
		if (!ChatColor.stripColor(sign.getLine(0)).equals("[Trade]")) {
			return false;
		} else {
			return true;
		}
	}
	
	public boolean isInfiniteTradeShopSign(Block b) {
		if (b.getType() != Material.SIGN_POST && b.getType() != Material.WALL_SIGN) {
			return false;
		}
		Sign sign = (Sign) b.getState();
		if (!ChatColor.stripColor(sign.getLine(0)).equals("[iTrade]")) {
			return false;
		} else {
			return true;
		}
	}
	
	public boolean isInt(String str) {
		try {
			Integer.parseInt(str);
			return true;
		} catch (Exception e) {
			return false;
		}
	}
}

@@ -84,36 +84,8 @@
 or;%0A
-import org.bukkit.Location;%0A
 impo
@@ -108,16 +108,16 @@
 terial;%0A
+
 import o
@@ -173,35 +173,84 @@
 gn;%0A
-%0A
 import 
-java.util.ArrayList
+org.bukkit.inventory.Inventory;%0Aimport org.bukkit.inventory.ItemStack
 ;%0A%0Ap
@@ -1522,13 +1522,1366 @@
 se;%0A%09%09%7D%0A
-
 %09%7D
+%0A%0A%09public boolean canFit(Inventory inv, ItemStack itm, int amt) %0A%09%7B%0A%09    int count = 0;%0A%09    if(inv.firstEmpty() %3E= 0)%0A%09        return true;%0A%09    for (ItemStack i : inv.getContents()) %0A%09    %7B%0A%09        if (i != null) %7B%0A%09            if (i.getType() == itm.getType() && i.getData() == itm.getData() && i.getDurability() == itm.getDurability() && i.getItemMeta() == itm.getItemMeta()) %7B%0A%09                count += i.getAmount();%0A%0A%09                Bukkit.getServer().broadcastMessage(%22For Count: %22 + count);//Debug #Remove%0A%09            %7D%0A%09        %7D%0A%09    %7D%0A%0A%09    while(count %3E= itm.getMaxStackSize())%0A%09    %7B%0A%09        Bukkit.getServer().broadcastMessage(%22While Count: %22 + count);//Debug #Remove%0A%09        count -= itm.getMaxStackSize();%0A%09    %7D%0A%0A        Bukkit.getServer().broadcastMessage(%22Count + Amt: %22 + (count + amt) + %22    StackSize: %22 + itm.getMaxStackSize()); //Debug #Remove%0A        if(count == 0)%0A            return false;%0A        else%0A            return count + amt %3C= itm.getMaxStackSize();%0A%09%7D%0A%09%0A    public boolean containsAtLeast(Inventory inv, Material mat, int amt) %7B%0A        int count = 0;%0A        for (ItemStack itm : inv.getContents()) %7B%0A            if (itm != null) %7B%0A                if (itm.getType() == mat) %7B%0A                    count += itm.getAmount();%0A                %7D%0A            %7D%0A        %7D%0A        return count %3E= amt;%0A    %7D%0A    %0A    
 %0A%7D%0A

Clean up & Bug fix