From 84b66ba18b3a0907ba39ddd4158ace42e7265f2e Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Tue, 8 Jan 2019 17:37:36 +0100 Subject: [PATCH] Allow newline in faction motd --- src/com/massivecraft/factions/cmd/CmdFactionsMotd.java | 5 +++-- src/com/massivecraft/factions/entity/Faction.java | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java b/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java index ba608ae8..35e868f6 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java @@ -63,11 +63,12 @@ public class CmdFactionsMotd extends FactionsCommand // Apply msenderFaction.setMotd(target); - + // Inform for (MPlayer follower : msenderFaction.getMPlayers()) { - follower.msg("%s set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotdDesc()); + follower.msg("%s changed your faction motd.", MixinDisplayName.get().getDisplayName(sender, follower)); + follower.message(msenderFaction.getMotdMessages()); } } diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 027960c3..c28a1508 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -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 implements FactionsParticipator, MP title = Txt.titleize(title); ret.add(title); - String motd = Txt.parse("") + this.getMotdDesc(); - ret.add(motd); + String motd = this.getMotdDesc(); + List motds = Arrays.asList(motd.split("\\\\n")); + motds = motds.stream().map(s -> Txt.parse("") + s).collect(Collectors.toList()); + ret.addAll(motds); ret.add("");