|
33 | 33 | import org.jetbrains.annotations.Nullable; |
34 | 34 | import org.maxgamer.quickshop.QuickShop; |
35 | 35 | import org.maxgamer.quickshop.api.chat.ComponentPackage; |
| 36 | +import org.maxgamer.quickshop.api.localization.text.TextManager; |
36 | 37 | import org.maxgamer.quickshop.shop.ShopSignPersistentDataType; |
37 | 38 | import org.maxgamer.quickshop.shop.ShopSignStorage; |
38 | 39 |
|
@@ -594,18 +595,23 @@ default boolean isShopSign(@NotNull Sign sign, @Nullable Shop shop) { |
594 | 595 | return false; |
595 | 596 | } |
596 | 597 | String header = lines[0]; |
597 | | - String adminShopHeader = QuickShop.getInstance().text().of("signs.header", QuickShop.getInstance().text().of("admin-shop").forLocale()).forLocale(); |
598 | | - String signHeaderUsername = QuickShop.getInstance().text().of("signs.header", this.ownerName(true)).forLocale(); |
599 | | - if (header.contains(adminShopHeader) || header.contains(signHeaderUsername)) { |
| 598 | + TextManager textManager=QuickShop.getInstance().text(); |
| 599 | + String ownerName=this.ownerName(true); |
| 600 | + //Raw text matching |
| 601 | + String adminShopHeader = textManager.of("signs.header", textManager.of("admin-shop").forLocale()).forLocale(); |
| 602 | + String userShopHeader = textManager.of("signs.header", ownerName).forLocale(); |
| 603 | + if (header.contains(adminShopHeader) || header.contains(userShopHeader)) { |
600 | 604 | return true; |
601 | 605 | //TEXT SIGN |
602 | 606 | //continue |
603 | 607 | } else { |
604 | | - adminShopHeader = QuickShop.getInstance().text().of("signs.header", QuickShop.getInstance().text().of("admin-shop").forLocale(), "").forLocale(); |
605 | | - signHeaderUsername = QuickShop.getInstance().text().of("signs.header", this.ownerName(true), "").forLocale(); |
606 | | - adminShopHeader = ChatColor.stripColor(adminShopHeader).trim(); |
607 | | - signHeaderUsername = ChatColor.stripColor(signHeaderUsername).trim(); |
608 | | - return header.contains(adminShopHeader) || header.contains(signHeaderUsername); |
| 608 | + //Try no color matching |
| 609 | + //arg[0] is name, arg[1] is color code |
| 610 | + adminShopHeader = textManager.of("signs.header", textManager.of("admin-shop").forLocale(), "").forLocale(); |
| 611 | + userShopHeader = textManager.of("signs.header", ownerName, "").forLocale(); |
| 612 | + adminShopHeader = ChatColor.stripColor(adminShopHeader); |
| 613 | + userShopHeader = ChatColor.stripColor(userShopHeader); |
| 614 | + return header.contains(adminShopHeader) || header.contains(userShopHeader); |
609 | 615 | } |
610 | 616 | } |
611 | 617 | } |
|
0 commit comments