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

@ -63,11 +63,12 @@ public class CmdFactionsMotd extends FactionsCommand
// Apply // Apply
msenderFaction.setMotd(target); msenderFaction.setMotd(target);
// Inform // Inform
for (MPlayer follower : msenderFaction.getMPlayers()) 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.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -323,8 +324,10 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
title = Txt.titleize(title); title = Txt.titleize(title);
ret.add(title); ret.add(title);
String motd = Txt.parse("<i>") + this.getMotdDesc(); String motd = this.getMotdDesc();
ret.add(motd); 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(""); ret.add("");