From 5386ad74b4048bae049972daed6e78cc163d8e1b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 21 May 2020 21:00:02 +1000 Subject: [PATCH] Don't allow custom /pay messages while muted --- MCGalaxy/Commands/Economy/CmdPay.cs | 6 ++++++ MCGalaxy/Player/Player.cs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/MCGalaxy/Commands/Economy/CmdPay.cs b/MCGalaxy/Commands/Economy/CmdPay.cs index d09000c42..10049b8d2 100644 --- a/MCGalaxy/Commands/Economy/CmdPay.cs +++ b/MCGalaxy/Commands/Economy/CmdPay.cs @@ -29,6 +29,12 @@ namespace MCGalaxy.Commands.Eco { bool all = false; if (!ParseArgs(p, message, ref all, "pay", out trans)) return; + // Player can use /pay messages to bypass a mute + if (trans.Reason != null && !p.CanSpeak()) { + p.Message("%WCannot specify a payment reason, as you cannot currently speak"); + return; + } + int matches = 1; Player who = PlayerInfo.FindMatches(p, trans.TargetName, out matches); if (matches > 1) return; diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs index d12e3e143..e0abebc04 100644 --- a/MCGalaxy/Player/Player.cs +++ b/MCGalaxy/Player/Player.cs @@ -313,7 +313,9 @@ namespace MCGalaxy { #endregion /// Returns whether the player is currently allowed to talk. - public bool CanSpeak() { return !muted && (voice || !Server.chatmod); } + public bool CanSpeak() { + return IsConsole || (!muted && (voice || !Server.chatmod)); + } /// Blocks calling thread until all 'new map loaded' packets have been sent. public void BlockUntilLoad(int sleep) {