2222import com .lishid .openinv .OpenInv ;
2323import io .papermc .lib .PaperLib ;
2424import lombok .EqualsAndHashCode ;
25- import net .kyori .adventure .text .Component ;
26- import net .kyori .adventure .text .serializer .legacy .LegacyComponentSerializer ;
2725import org .bukkit .*;
2826import org .bukkit .block .Block ;
2927import org .bukkit .block .BlockFace ;
4442import org .jetbrains .annotations .Nullable ;
4543import org .maxgamer .quickshop .QuickShop ;
4644import org .maxgamer .quickshop .event .*;
47- import org .maxgamer .quickshop .externalhelper .paperadventurelib .PaperAdventureLib ;
48- import org .maxgamer .quickshop .externalhelper .paperadventurelib .SignAdventure ;
4945import org .maxgamer .quickshop .util .PriceLimiter ;
5046import org .maxgamer .quickshop .util .Util ;
5147
@@ -609,78 +605,15 @@ public boolean inventoryAvailable() {
609605 return true ;
610606 }
611607
612- // @Override
613- // public Component[] getSignText() {
614- // Util.ensureThread(false);
615- // Component[] lines = new Component[4];
616- //
617- // //Line 1
618- // OfflinePlayer player = plugin.getServer().getOfflinePlayer(this.getOwner());
619- // String statusStringKey = inventoryAvailable() ? "signs.status-available" : "signs.status-unavailable";
620- // lines[0] = Component.text(plugin.text().of("signs.header", this.ownerName(false), plugin.text().of(statusStringKey).forLocale()).forLocale());
621- //
622- // //Line 2
623- // String tradingStringKey;
624- // String noRemainingStringKey;
625- // int shopRemaining;
626- //
627- // switch (shopType) {
628- // case BUYING:
629- // shopRemaining = getRemainingSpace();
630- // tradingStringKey = isStackingShop() ? "signs.stack-buying" : "signs.buying";
631- // noRemainingStringKey = "signs.out-of-space";
632- // break;
633- // case SELLING:
634- // shopRemaining = getRemainingStock();
635- // tradingStringKey = isStackingShop() ? "signs.stack-selling" : "signs.selling";
636- // noRemainingStringKey = "signs.out-of-stock";
637- // break;
638- // default:
639- // shopRemaining = 0;
640- // tradingStringKey = "MissingKey for shop type:" + shopType;
641- // noRemainingStringKey = "MissingKey for shop type:" + shopType;
642- // }
643- // switch (shopRemaining) {
644- // //Unlimited
645- // case -1:
646- // lines[1] = Component.text(plugin.text().of(tradingStringKey, plugin.text().of("signs.unlimited").forLocale()).forLocale());
647- // break;
648- // //No remaining
649- // case 0:
650- // lines[1] =Component.text(plugin.text().of(noRemainingStringKey).forLocale());
651- // break;
652- // //Has remaining
653- // default:
654- // lines[1] = Component.text(plugin.text().of(tradingStringKey, Integer.toString(shopRemaining)).forLocale());
655- // }
656- //
657- // //line 3
658- // lines[2] = Component.text(plugin.text().of("signs.item", Util.getItemStackName(this.getItem())).forLocale());
659- //
660- // //line 4
661- // if (this.isStackingShop()) {
662- // lines[3] = Component.text(plugin.text().of("signs.stack-price",
663- // Util.format(this.getPrice(), this), Integer.toString(item.getAmount()),
664- // Util.getItemStackName(item)).forLocale());
665- // } else {
666- // lines[3] = Component.text( plugin.text().of("signs.price", Util.format(this.getPrice(), this)).forLocale());
667- // }
668- //
669- // //New pattern for recognizing shop sign
670- // lines[1] = Component.text(shopSignPrefix + lines[1] + " ");
671- //
672- // return lines;
673- // }
674-
675- @ Override
676- public Component [] getSignText () {
608+ @ Override
609+ public String [] getSignText () {
677610 Util .ensureThread (false );
678- Component [] lines = new Component [4 ];
611+ String [] lines = new String [4 ];
679612
680613 //Line 1
681614 OfflinePlayer player = plugin .getServer ().getOfflinePlayer (this .getOwner ());
682615 String statusStringKey = inventoryAvailable () ? "signs.status-available" : "signs.status-unavailable" ;
683- lines [0 ] = Component . text ( plugin .text ().of ("signs.header" , this .ownerName (false ), plugin .text ().of (statusStringKey ).forLocale ()).forLocale () );
616+ lines [0 ] = plugin .text ().of ("signs.header" , this .ownerName (false ), plugin .text ().of (statusStringKey ).forLocale ()).forLocale ();
684617
685618 //Line 2
686619 String tradingStringKey ;
@@ -706,55 +639,50 @@ public Component[] getSignText() {
706639 switch (shopRemaining ) {
707640 //Unlimited
708641 case -1 :
709- lines [1 ] = Component . text ( plugin .text ().of (tradingStringKey , plugin .text ().of ("signs.unlimited" ).forLocale ()).forLocale () );
642+ lines [1 ] = plugin .text ().of (tradingStringKey , plugin .text ().of ("signs.unlimited" ).forLocale ()).forLocale ();
710643 break ;
711644 //No remaining
712645 case 0 :
713- lines [1 ] =Component . text ( plugin .text ().of (noRemainingStringKey ).forLocale () );
646+ lines [1 ] =plugin .text ().of (noRemainingStringKey ).forLocale ();
714647 break ;
715648 //Has remaining
716649 default :
717- lines [1 ] = Component . text ( plugin .text ().of (tradingStringKey , Integer .toString (shopRemaining )).forLocale () );
650+ lines [1 ] = plugin .text ().of (tradingStringKey , Integer .toString (shopRemaining )).forLocale ();
718651 }
719652
720653 //line 3
721- lines [2 ] = Component . text ( plugin .text ().of ("signs.item" , Util .getItemStackName (this .getItem ())).forLocale () );
654+ lines [2 ] = plugin .text ().of ("signs.item" , Util .getItemStackName (this .getItem ())).forLocale ();
722655
723656 //line 4
724657 if (this .isStackingShop ()) {
725- lines [3 ] = Component . text ( plugin .text ().of ("signs.stack-price" ,
658+ lines [3 ] = plugin .text ().of ("signs.stack-price" ,
726659 Util .format (this .getPrice (), this ), Integer .toString (item .getAmount ()),
727- Util .getItemStackName (item )).forLocale ()) ;
660+ Util .getItemStackName (item )).forLocale ();
728661 } else {
729- lines [3 ] = Component . text ( plugin .text ().of ("signs.price" , Util .format (this .getPrice (), this )).forLocale () );
662+ lines [3 ] = plugin .text ().of ("signs.price" , Util .format (this .getPrice (), this )).forLocale ();
730663 }
731664
732665 //New pattern for recognizing shop sign
733- lines [1 ] = Component . text ( shopSignPrefix + lines [1 ] + " " ) ;
666+ lines [1 ] = shopSignPrefix + lines [1 ] + " " ;
734667
735668 return lines ;
736669 }
737670
738-
739671 /**
740672 * Changes all lines of text on a sign near the shop
741673 *
742674 * @param lines The array of lines to change. Index is line number.
743675 */
744676 @ Override
745- public void setSignText (@ NotNull Component [] lines ) {
677+ public void setSignText (@ NotNull String [] lines ) {
746678 Util .ensureThread (false );
747679 List <Sign > signs = this .getSigns ();
748680 for (Sign sign : signs ) {
749681 if (Arrays .equals (sign .getLines (), lines )) {
750682 continue ;
751683 }
752684 for (int i = 0 ; i < lines .length ; i ++) {
753- if (PaperAdventureLib .isSupported ()){
754- SignAdventure .set (sign ,i ,lines [i ]);
755- }else {
756- sign .setLine (i , LegacyComponentSerializer .legacySection ().serialize (lines [i ]));
757- }
685+ sign .setLine (i , lines [i ]);
758686 }
759687 if (plugin .getGameVersion ().isSignTextDyeSupport ()) {
760688 DyeColor dyeColor = Util .getDyeColor ();
0 commit comments