From 442db0f11bec6f70298491cd8854875c2183aadb Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 9 Apr 2020 11:42:43 +1000 Subject: [PATCH] Add -unverified to /who, simplify checking for unverified --- MCGalaxy/Commands/Information/CmdPlayers.cs | 1 + MCGalaxy/Commands/Moderation/CmdPass.cs | 8 ++++---- MCGalaxy/Player/Player.Fields.cs | 2 +- MCGalaxy/Player/Player.Handlers.cs | 4 ++-- MCGalaxy/Player/Player.Login.cs | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/MCGalaxy/Commands/Information/CmdPlayers.cs b/MCGalaxy/Commands/Information/CmdPlayers.cs index fa1cd4c85..5d62dc609 100644 --- a/MCGalaxy/Commands/Information/CmdPlayers.cs +++ b/MCGalaxy/Commands/Information/CmdPlayers.cs @@ -84,6 +84,7 @@ namespace MCGalaxy.Commands.Info { if (pl.frozen) data.Append("-frozen"); if (pl.Game.Referee) data.Append("-ref"); if (pl.IsAfk) data.Append("-afk"); + if (pl.Unverified) data.Append("-unverified"); string lvlName = Colors.Strip(pl.level.name); // for museums data.Append(" (").Append(lvlName).Append("),"); diff --git a/MCGalaxy/Commands/Moderation/CmdPass.cs b/MCGalaxy/Commands/Moderation/CmdPass.cs index f876d5d6f..221f8ccb1 100644 --- a/MCGalaxy/Commands/Moderation/CmdPass.cs +++ b/MCGalaxy/Commands/Moderation/CmdPass.cs @@ -53,7 +53,7 @@ namespace MCGalaxy.Commands.Moderation { } void VerifyPassword(Player p, string password) { - if (!p.adminpen) { p.Message("%WYou are already verified."); return; } + if (!p.Unverified) { p.Message("%WYou are already verified."); return; } if (p.passtries >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; } if (password.IndexOf(' ') >= 0) { p.Message("Your password must be %Wone %Sword!"); return; } @@ -63,7 +63,7 @@ namespace MCGalaxy.Commands.Moderation { if (CheckHash(p.name, password)) { p.Message("You are now &averified %Sand have &aaccess to admin commands and features."); - p.adminpen = false; + p.Unverified = false; } else { p.passtries++; p.Message("%WWrong Password. %SRemember your password is %Wcase sensitive."); @@ -73,7 +73,7 @@ namespace MCGalaxy.Commands.Moderation { void SetPassword(Player p, string password) { string path = HashPath(p.name); - if (p.adminpen && File.Exists(path)) { + if (p.Unverified && File.Exists(path)) { p.Message("%WYou must first verify with %T/pass [Password] %Wbefore you can change your password."); p.Message("Forgot your password? Contact %W{0} %Sto %Wreset it.", Server.Config.OwnerName); return; @@ -90,7 +90,7 @@ namespace MCGalaxy.Commands.Moderation { Player who = PlayerInfo.FindMatches(p, target); if (who == null) return; - if (!p.IsConsole && p.adminpen) { + if (!p.IsConsole && p.Unverified) { p.Message("%WYou must first verify with %T/Pass [Password]"); return; } if (!p.IsConsole && !Server.Config.OwnerName.CaselessEq(p.name)) { diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index b92349c43..b66344e0c 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -129,7 +129,7 @@ namespace MCGalaxy { public bool isFlying; public bool joker; - public bool adminpen; + public bool Unverified; public bool voice; public CommandData DefaultCmdData { diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index 71df4115a..a95b95824 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -61,7 +61,7 @@ namespace MCGalaxy { if (level.IsMuseum && Blockchange == null) return; bool deletingBlock = !painting && !placing; - if (Server.Config.verifyadmins && adminpen) { + if (Unverified) { Message("%WYou must first verify with %T/Pass [Password]"); RevertBlock(x, y, z); return; } @@ -612,7 +612,7 @@ namespace MCGalaxy { if (jailed) { Message("You cannot use any commands while jailed."); return false; } - if (Server.Config.verifyadmins && adminpen && !(cmd == "pass" || cmd == "setpass")) { + if (Unverified && !(cmd == "pass" || cmd == "setpass")) { Message("%WYou must verify first with %T/Pass [Password]"); return false; } diff --git a/MCGalaxy/Player/Player.Login.cs b/MCGalaxy/Player/Player.Login.cs index bb6f99249..5a0f64bcd 100644 --- a/MCGalaxy/Player/Player.Login.cs +++ b/MCGalaxy/Player/Player.Login.cs @@ -107,7 +107,7 @@ namespace MCGalaxy { SetPrefix(); LoadCpeData(); - if (Server.Config.verifyadmins && Rank >= Server.Config.VerifyAdminsRank) adminpen = true; + if (Server.Config.verifyadmins && Rank >= Server.Config.VerifyAdminsRank) Unverified = true; if (Server.noEmotes.Contains(name)) { parseEmotes = !Server.Config.ParseEmotes; } hideRank = Rank;