mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-30 12:57:52 +01:00
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:
parent
707625a9da
commit
29a77147b5
@ -881,7 +881,16 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
new StringListGUI(this.user, this.challenge.getRewardText(), lineLength, (status, value) -> {
|
new StringListGUI(this.user, this.challenge.getRewardText(), lineLength, (status, value) -> {
|
||||||
if (status)
|
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();
|
this.build();
|
||||||
@ -1055,7 +1064,16 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
new StringListGUI(this.user, this.challenge.getRepeatRewardText(), lineLength, (status, value) -> {
|
new StringListGUI(this.user, this.challenge.getRepeatRewardText(), lineLength, (status, value) -> {
|
||||||
if (status)
|
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();
|
this.build();
|
||||||
|
@ -415,7 +415,16 @@ public class EditLevelGUI extends CommonGUI
|
|||||||
new StringListGUI(this.user, this.challengeLevel.getUnlockMessage(), lineLength, (status, value) -> {
|
new StringListGUI(this.user, this.challengeLevel.getUnlockMessage(), lineLength, (status, value) -> {
|
||||||
if (status)
|
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();
|
this.build();
|
||||||
@ -486,7 +495,16 @@ public class EditLevelGUI extends CommonGUI
|
|||||||
new StringListGUI(this.user, this.challengeLevel.getRewardText(), lineLength, (status, value) -> {
|
new StringListGUI(this.user, this.challengeLevel.getRewardText(), lineLength, (status, value) -> {
|
||||||
if (status)
|
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();
|
this.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user