package com.Acrobot.ChestShop.Signs;

import com.Acrobot.Breeze.Utils.BlockUtil;
import com.Acrobot.ChestShop.Config.Config;
import com.Acrobot.ChestShop.Utils.uName;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;

import java.util.regex.Pattern;

import static com.Acrobot.ChestShop.Config.Property.ADMIN_SHOP_NAME;

/**
 * @author Acrobot
 */
public class ChestShopSign {
    public static final byte NAME_LINE = 0;
    public static final byte QUANTITY_LINE = 1;
    public static final byte PRICE_LINE = 2;
    public static final byte ITEM_LINE = 3;

    public static final Pattern[] SHOP_SIGN_PATTERN = {
            Pattern.compile("^$|^\\w.+$"),
            Pattern.compile("[0-9]+"),
            Pattern.compile("(?i)(((b *[0-9]+)|([0-9]+ *b))|((s *[0-9]+)|([0-9]+ *s)))|((((b *[0-9]+)|([0-9]+ *b))[ ]*:[ ]*((s *[0-9]+)|([0-9]+ *s))))"),
            Pattern.compile("[\\w : -]+")
    };

    public static boolean isAdminShop(String owner) {
        return owner.toLowerCase().replace(" ", "").equals(Config.getString(ADMIN_SHOP_NAME).toLowerCase().replace(" ", ""));
    }

    public static boolean isAdminShop(Sign sign) {
        return isAdminShop(sign.getLine(NAME_LINE));
    }

    public static boolean isValid(Sign sign) {
        return isValid(sign.getLines());
    }

    public static boolean isValid(String[] line) {
        return isValidPreparedSign(line) && !line[0].isEmpty();
    }

    public static boolean isValid(Block sign) {
        return BlockUtil.isSign(sign) && isValid((Sign) sign.getState());
    }

    public static boolean canAccess(Player player, Sign sign) {
        if (player == null) return false;
        if (sign == null) return true;

        return uName.canUseName(player, sign.getLine(0));
    }

    public static boolean isValidPreparedSign(String[] lines) {
        for (int i = 0; i < 4; i++) {
            if (!SHOP_SIGN_PATTERN[i].matcher(lines[i]).matches()) {
                return false;
            }
        }
    }
}

@@ -767,129 +767,10 @@
 le(%22
-(?i)(((b *%5B0-9%5D+)%7C(%5B0-9%5D+ *b))%7C((s *%5B0-9%5D+)%7C(%5B0-9%5D+ *s)))%7C((((b *%5B0-9%5D+)%7C(%5B0-9%5D+ *b))%5B %5D*:%5B %5D*((s *%5B0-9%5D+)%7C(%5B0-9%5D+ *s))))
+.+
 %22),%0A
@@ -1306,16 +1306,96 @@
 line) &&
+ (line%5B2%5D.toUpperCase().contains(%22B%22) %7C%7C line%5B2%5D.toUpperCase().contains(%22S%22)) &&
  !line%5B0
@@ -1407,16 +1407,17 @@
 mpty();%0A
+%0A
     %7D%0A%0A 
@@ -1966,24 +1966,24 @@
           %7D%0A
-
         %7D%0A  
@@ -1976,20 +1976,87 @@
 %7D%0A        %7D%0A
+        return lines%5B2%5D.indexOf(':') == lines%5B2%5D.lastIndexOf(':');%0A
     %7D%0A%7D%0A

Update com/Acrobot/ChestShop/Signs/ChestShopSign.java