From d47d6ed4a15e3835a2562f99fd84ddf3fb2caebf Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sun, 2 Jul 2017 17:20:51 +0200 Subject: [PATCH] Add consoleColorsEnabled configuration option --- .../massivecraft/factions/cmd/CmdFactionsHome.java | 4 +++- .../massivecraft/factions/engine/EngineMoveChunk.java | 3 ++- .../integration/herochat/ChannelFactionsAbstract.java | 11 +++++++---- .../factions/integration/lwc/FactionsLwcModule.java | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java index a3532490..fb42b9ef 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -11,6 +11,7 @@ import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.event.EventFactionsHomeTeleport; import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer; +import com.massivecraft.massivecore.mixin.MixinMessage; import com.massivecraft.massivecore.mixin.MixinTeleport; import com.massivecraft.massivecore.mixin.TeleporterException; import com.massivecraft.massivecore.ps.PS; @@ -148,7 +149,8 @@ public class CmdFactionsHome extends FactionsCommandHome } catch (TeleporterException e) { - me.sendMessage(e.getMessage()); + String message = e.getMessage(); + MixinMessage.get().messageOne(me, message); } } diff --git a/src/com/massivecraft/factions/engine/EngineMoveChunk.java b/src/com/massivecraft/factions/engine/EngineMoveChunk.java index 1a42194d..df31e952 100644 --- a/src/com/massivecraft/factions/engine/EngineMoveChunk.java +++ b/src/com/massivecraft/factions/engine/EngineMoveChunk.java @@ -7,6 +7,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.massivecore.Engine; +import com.massivecraft.massivecore.mixin.MixinMessage; import com.massivecraft.massivecore.mixin.MixinTitle; import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.MUtil; @@ -77,7 +78,7 @@ public class EngineMoveChunk extends Engine else { String message = parseTerritoryInfo(MConf.get().territoryInfoChat, mplayer, factionTo); - player.sendMessage(message); + MixinMessage.get().messageOne(player, message); } } diff --git a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java index 41d5780d..51277b92 100644 --- a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java +++ b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java @@ -11,6 +11,7 @@ import com.dthielke.herochat.MessageNotFoundException; import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MPlayer; +import com.massivecraft.massivecore.mixin.MixinMessage; import com.massivecraft.massivecore.util.MUtil; import net.milkbowl.vault.chat.Chat; import org.bukkit.Bukkit; @@ -112,7 +113,8 @@ public abstract class ChannelFactionsAbstract implements Channel message = applyFormat(this.getFormatSupplier().getAnnounceFormat(), "").replace("%2$s", colorized); for (Chatter member : this.getMembers()) { - member.getPlayer().sendMessage(message); + Player player = member.getPlayer(); + MixinMessage.get().messageOne(player, message); } Herochat.logChat(ChatColor.stripColor(message)); } @@ -210,7 +212,7 @@ public abstract class ChannelFactionsAbstract implements Channel for (Player recipient : recipients) { - recipient.sendMessage(message); + MixinMessage.get().messageOne(recipient, message); } } @@ -256,7 +258,7 @@ public abstract class ChannelFactionsAbstract implements Channel String msg = String.format(format, new Object[] { player.getDisplayName(), event.getMessage() }); for (Player recipient : recipients) { - recipient.sendMessage(msg); + MixinMessage.get().messageOne(recipient, msg); } Bukkit.getPluginManager().callEvent(new ChatCompleteEvent(sender, this, msg)); @@ -362,7 +364,8 @@ public abstract class ChannelFactionsAbstract implements Channel { for (Chatter member : this.getMembers()) { - member.getPlayer().sendMessage(rawMessage); + Player player = member.getPlayer(); + MixinMessage.get().messageOne(player, rawMessage); } } } diff --git a/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java b/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java index 7823b685..f4b9d7ca 100644 --- a/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java +++ b/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java @@ -10,6 +10,7 @@ import com.massivecraft.factions.engine.EnginePermBuild; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.massivecore.SoundEffect; +import com.massivecraft.massivecore.mixin.MixinMessage; import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.SmokeUtil; @@ -97,7 +98,7 @@ public class FactionsLwcModule extends JavaModule // ... and inform. Player player = event.getPlayer(); String message = Txt.parse("Factions removed %s's LWC. They lacked build rights.", mowner.getDisplayName(player)); - player.sendMessage(message); + MixinMessage.get().messageOne(player, message); } }