Skip to content

Commit 3b991b5

Browse files
committed
move to vars
1 parent fb3d69c commit 3b991b5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/java/org/maxgamer/quickshop/util/TextSplitter.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,25 @@
3030
import java.util.Base64;
3131

3232
public 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

0 commit comments

Comments
 (0)