Add a CanSpeak method to player class that returns whether player can currently speak

This commit is contained in:
UnknownShadow200 2020-05-21 20:49:35 +10:00
parent 659c25eee0
commit 3b78863c79
2 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Chatting {
TabList.Update(p, true);
p.LastAction = DateTime.UtcNow;
bool cantSend = p.muted || (Server.chatmod && !p.voice);
bool cantSend = !p.CanSpeak();
if (p.IsAfk) {
if (cantSend) {
p.Message("You are now marked as being AFK.");

View File

@ -312,11 +312,16 @@ namespace MCGalaxy {
#endregion
/// <summary> Returns whether the player is currently allowed to talk. </summary>
public bool CanSpeak() { return !muted && (voice || !Server.chatmod); }
/// <summary> Blocks calling thread until all 'new map loaded' packets have been sent. </summary>
public void BlockUntilLoad(int sleep) {
while (Loading)
Thread.Sleep(sleep);
}
/// <summary> Checks if player is currently unverified, and if so, sends a message informing them </summary>
public void CheckIsUnverified() {
if (verifiedPass) return;
Unverified = Server.Config.verifyadmins && Rank >= Server.Config.VerifyAdminsRank;