You shouldn't be able to speak while pending /pass verification, fixes #535 (Thanks MasterlazorX)

This commit is contained in:
UnknownShadow200 2020-06-02 21:31:52 +10:00
parent 3abe564c1c
commit 5c18fe940d
3 changed files with 18 additions and 11 deletions

View File

@ -43,15 +43,7 @@ namespace MCGalaxy.Commands.Chatting {
}
public static bool CanSpeak(Player p, string cmd) {
if (p.IsConsole) return true;
if (p.muted) {
p.Message("Cannot use %T/{0} %Swhile muted.", cmd); return false;
}
if (Server.chatmod && !p.voice) {
p.Message("Cannot use %T/{0} %Swhile chat moderation is on without %T/Voice%S.", cmd); return false;
}
return true;
return p.CheckCanSpeak("use %T/" + cmd);
}
}

View File

@ -442,7 +442,7 @@ namespace MCGalaxy {
if (ZSGame.Instance.HandlesChatMessage(this, text)) return;
// Put this after vote collection so that people can vote even when chat is moderated
if (Server.chatmod && !voice) { Message("Chat moderation is on, you cannot speak without %T/voice"); return; }
if (!CheckCanSpeak("speak")) return;
// Filter out bad words
if (Server.Config.ProfanityFiltering) text = ProfanityFilter.Parse(text);

View File

@ -314,7 +314,22 @@ namespace MCGalaxy {
/// <summary> Returns whether the player is currently allowed to talk. </summary>
public bool CanSpeak() {
return IsConsole || (!muted && (voice || !Server.chatmod));
return IsConsole || (!muted && !Unverified && (voice || !Server.chatmod));
}
public bool CheckCanSpeak(string action) {
if (IsConsole) return true;
if (muted) {
Message("Cannot {0} %Swhile muted", action); return false;
}
if (Server.chatmod && !voice) {
Message("Cannot {0} %Swhile chat moderation is on without %T/Voice%S", action); return false;
}
if (Unverified) {
Message("%WYou must first verify with %T/Pass [Password]"); return false;
}
return true;
}
/// <summary> Blocks calling thread until all 'new map loaded' packets have been sent. </summary>