mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-25 19:45:36 +01:00
Ignore formatting when parsing sign lines (#503)
This commit is contained in:
parent
2ebc2f285b
commit
4c7b018f8c
@ -183,7 +183,7 @@ public class ChestShopSign {
|
|||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
boolean matches = false;
|
boolean matches = false;
|
||||||
for (Pattern pattern : SHOP_SIGN_PATTERN[i]) {
|
for (Pattern pattern : SHOP_SIGN_PATTERN[i]) {
|
||||||
if (pattern.matcher(lines[i+1]).matches()) {
|
if (pattern.matcher(StringUtils.strip(StringUtil.stripColourCodes(lines[i+1]))).matches()) {
|
||||||
matches = true;
|
matches = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ public class ChestShopSign {
|
|||||||
* @return The owner string
|
* @return The owner string
|
||||||
*/
|
*/
|
||||||
public static String getOwner(String[] lines) {
|
public static String getOwner(String[] lines) {
|
||||||
return StringUtil.stripColourCodes(StringUtils.strip(lines[NAME_LINE]));
|
return StringUtil.stripColourCodes(StringUtils.strip(StringUtil.stripColourCodes(lines[NAME_LINE])));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -233,7 +233,7 @@ public class ChestShopSign {
|
|||||||
* @throws IllegalArgumentException Thrown when an invalid quantity is present
|
* @throws IllegalArgumentException Thrown when an invalid quantity is present
|
||||||
*/
|
*/
|
||||||
public static String getQuantityLine(String[] lines) throws IllegalArgumentException {
|
public static String getQuantityLine(String[] lines) throws IllegalArgumentException {
|
||||||
return lines.length > QUANTITY_LINE ? StringUtils.strip(lines[QUANTITY_LINE]) : "";
|
return lines.length > QUANTITY_LINE ? StringUtils.strip(StringUtil.stripColourCodes(lines[QUANTITY_LINE])) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,7 +262,7 @@ public class ChestShopSign {
|
|||||||
* @return The price line
|
* @return The price line
|
||||||
*/
|
*/
|
||||||
public static String getPrice(Sign sign) {
|
public static String getPrice(Sign sign) {
|
||||||
return StringUtils.strip(sign.getLine(PRICE_LINE));
|
return StringUtils.strip(StringUtil.stripColourCodes(sign.getLine(PRICE_LINE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,7 +271,7 @@ public class ChestShopSign {
|
|||||||
* @return The price line
|
* @return The price line
|
||||||
*/
|
*/
|
||||||
public static String getPrice(String[] lines) {
|
public static String getPrice(String[] lines) {
|
||||||
return lines.length > PRICE_LINE ? StringUtils.strip(lines[PRICE_LINE]) : "";
|
return lines.length > PRICE_LINE ? StringUtils.strip(StringUtil.stripColourCodes(lines[PRICE_LINE])) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,6 +289,6 @@ public class ChestShopSign {
|
|||||||
* @return The item line
|
* @return The item line
|
||||||
*/
|
*/
|
||||||
public static String getItem(String[] lines) {
|
public static String getItem(String[] lines) {
|
||||||
return lines.length > ITEM_LINE ? StringUtils.strip(lines[ITEM_LINE]) : "";
|
return lines.length > ITEM_LINE ? StringUtils.strip(StringUtil.stripColourCodes(lines[ITEM_LINE])) : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user