Allow newline in faction motd

This commit is contained in:
Magnus Ulf 2019-01-08 17:37:36 +01:00
parent 9219c3eaa4
commit 84b66ba18b
2 changed files with 8 additions and 4 deletions

View File

@ -67,7 +67,8 @@ public class CmdFactionsMotd extends FactionsCommand
// Inform
for (MPlayer follower : msenderFaction.getMPlayers())
{
follower.msg("<i>%s <i>set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotdDesc());
follower.msg("<i>%s <i>changed your faction motd.", MixinDisplayName.get().getDisplayName(sender, follower));
follower.message(msenderFaction.getMotdMessages());
}
}

View File

@ -30,6 +30,7 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@ -323,8 +324,10 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
title = Txt.titleize(title);
ret.add(title);
String motd = Txt.parse("<i>") + this.getMotdDesc();
ret.add(motd);
String motd = this.getMotdDesc();
List<String> motds = Arrays.asList(motd.split("\\\\n"));
motds = motds.stream().map(s -> Txt.parse("<i>") + s).collect(Collectors.toList());
ret.addAll(motds);
ret.add("");