File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/main/java/org/maxgamer/quickshop/util Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 3030import java .util .Base64 ;
3131
3232public class TextSplitter {
33+ private final static String HEADER = "!-!-!=-=-=-=-=-=" ;
34+ private final static String FOOTER = "=-=-=-=-=-=!-!-!" ;
35+
3336 public static String bakeComponent (BaseComponent [] components ) {
34- return "!!!=-=-=-=-=-=" +
37+ return HEADER +
3538 Base64 .getEncoder ().encodeToString (ComponentSerializer .toString (components ).getBytes (StandardCharsets .UTF_8 )) +
36- "=-=-=-=-=-=!!!" ;
39+ FOOTER ;
3740 }
3841
3942 @ SneakyThrows
4043 public static SpilledString deBakeItem (String src ) {
41- if (!src .contains ("!!!=-=-=-=-=-=" )) {
44+ if (!src .contains (HEADER )) {
4245 Util .debugLog (src + " seems not a baked message" );
4346 return null ;
4447 }
45- String base64 = StringUtils .substringBetween (src , "!!!=-=-=-=-=-=" , "=-=-=-=-=-=!!!" );
48+ String base64 = StringUtils .substringBetween (src , HEADER , FOOTER );
4649 BaseComponent [] components = ComponentSerializer .parse (new String (Base64 .getDecoder ().decode (base64 ), StandardCharsets .UTF_8 ));
47- String left = StringUtils .substringBefore (src , "!!!=-=-=-=-=-=" );
48- String right = StringUtils .substringAfter (src , "=-=-=-=-=-=!!!" );
50+ String left = StringUtils .substringBefore (src , HEADER );
51+ String right = StringUtils .substringAfter (src , FOOTER );
4952 return new SpilledString (left , right , components );
5053 }
5154
You can’t perform that action at this time.
0 commit comments