Fix issue when each save added unnecessary "|" at the end of rewards and unlock message. (#123)

Algorithm that I used to join output list into single string, always added "|" at the end. Last "|" should be removed.
This commit is contained in:
BONNe 2019-09-02 13:20:59 +03:00 committed by BONNe1704
parent 707625a9da
commit 29a77147b5
2 changed files with 40 additions and 4 deletions

View File

@ -881,7 +881,16 @@ public class EditChallengeGUI extends CommonGUI
new StringListGUI(this.user, this.challenge.getRewardText(), lineLength, (status, value) -> {
if (status)
{
this.challenge.setRewardText(value.stream().map(s -> s + "|").collect(Collectors.joining()));
String singleLineMessage = value.stream().
map(s -> s + "|").
collect(Collectors.joining());
if (singleLineMessage.endsWith("|"))
{
singleLineMessage = singleLineMessage.substring(0, singleLineMessage.length() - 1);
}
this.challenge.setRewardText(singleLineMessage);
}
this.build();
@ -1055,7 +1064,16 @@ public class EditChallengeGUI extends CommonGUI
new StringListGUI(this.user, this.challenge.getRepeatRewardText(), lineLength, (status, value) -> {
if (status)
{
this.challenge.setRepeatRewardText(value.stream().map(s -> s + "|").collect(Collectors.joining()));
String singleLineMessage = value.stream().
map(s -> s + "|").
collect(Collectors.joining());
if (singleLineMessage.endsWith("|"))
{
singleLineMessage = singleLineMessage.substring(0, singleLineMessage.length() - 1);
}
this.challenge.setRepeatRewardText(singleLineMessage);
}
this.build();

View File

@ -415,7 +415,16 @@ public class EditLevelGUI extends CommonGUI
new StringListGUI(this.user, this.challengeLevel.getUnlockMessage(), lineLength, (status, value) -> {
if (status)
{
this.challengeLevel.setUnlockMessage(value.stream().map(s -> s + "|").collect(Collectors.joining()));
String singleLineMessage = value.stream().
map(s -> s + "|").
collect(Collectors.joining());
if (singleLineMessage.endsWith("|"))
{
singleLineMessage = singleLineMessage.substring(0, singleLineMessage.length() - 1);
}
this.challengeLevel.setUnlockMessage(singleLineMessage);
}
this.build();
@ -486,7 +495,16 @@ public class EditLevelGUI extends CommonGUI
new StringListGUI(this.user, this.challengeLevel.getRewardText(), lineLength, (status, value) -> {
if (status)
{
this.challengeLevel.setRewardText(value.stream().map(s -> s + "|").collect(Collectors.joining()));
String singleLineMessage = value.stream().
map(s -> s + "|").
collect(Collectors.joining());
if (singleLineMessage.endsWith("|"))
{
singleLineMessage = singleLineMessage.substring(0, singleLineMessage.length() - 1);
}
this.challengeLevel.setRewardText(singleLineMessage);
}
this.build();