diff --git a/Commands/Moderation/CmdReview.cs b/Commands/Moderation/CmdReview.cs index 970d10e14..6da3d81c9 100644 --- a/Commands/Moderation/CmdReview.cs +++ b/Commands/Moderation/CmdReview.cs @@ -77,21 +77,20 @@ namespace MCGalaxy.Commands } } - if (opsOn) { - Server.reviewlist.Add(p.name); - int pos = Server.reviewlist.IndexOf(p.name); - if (pos > 1) { Player.Message(p, "You entered the &creview %Squeue. You have &c" + pos + " %Speople in front of you in the queue"); } - if (pos == 1) { Player.Message(p, "You entered the &creview %Squeue. There is &c1 %Sperson in front of you in the queue"); } - if (pos == 0) { Player.Message(p, "You entered the &creview %Squeue. You are &cfirst %Sin line!"); } - Player.Message(p, "The Online Operators have been notified. Someone should be with you shortly."); - - string start = pos > 0 ? "There are now &c" + (pos + 1) + " %Speople" : "There is now &c1 %Sperson"; - Chat.GlobalMessageMinPerms(p.color + p.name + " %Sentered the review queue", Server.reviewnext); - Chat.GlobalMessageMinPerms(start + " waiting for a &creview!", Server.reviewnext); - p.NextReviewTime = DateTime.UtcNow.AddSeconds(Server.reviewcooldown); - } else { - Player.Message(p, "&cThere are no operators on to review your build. Please wait for one to come on and try again."); - } + Server.reviewlist.Add(p.name); + int pos = Server.reviewlist.IndexOf(p.name); + if (pos > 1) { Player.Message(p, "You entered the &creview %Squeue. You have &c" + pos + " %Speople in front of you in the queue"); } + if (pos == 1) { Player.Message(p, "You entered the &creview %Squeue. There is &c1 %Sperson in front of you in the queue"); } + if (pos == 0) { Player.Message(p, "You entered the &creview %Squeue. You are &cfirst %Sin line!"); } + + string msg = opsOn ? "The Online staff have been notified. Someone should be with you shortly." : + "There are currently no staff online. Staff will be notified when they join the server."; + Player.Message(p, msg); + + string start = pos > 0 ? "There are now &c" + (pos + 1) + " %Speople" : "There is now &c1 %Sperson"; + Chat.GlobalMessageMinPerms(p.color + p.name + " %Sentered the review queue", Server.reviewnext); + Chat.GlobalMessageMinPerms(start + " waiting for a &creview!", Server.reviewnext); + p.NextReviewTime = DateTime.UtcNow.AddSeconds(Server.reviewcooldown); Player.RaisePlayerAction(p, PlayerAction.Review, null, true); } diff --git a/Commands/Moderation/CmdSetRank.cs b/Commands/Moderation/CmdSetRank.cs index 530f8fd0b..b7bbdaff1 100644 --- a/Commands/Moderation/CmdSetRank.cs +++ b/Commands/Moderation/CmdSetRank.cs @@ -98,6 +98,7 @@ namespace MCGalaxy.Commands.Moderation { } } + Server.reviewlist.Remove(name); group.playerList.Remove(name); group.playerList.Save(); newRank.playerList.Add(name); diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index f508dae14..5b7293abb 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -355,28 +355,8 @@ namespace MCGalaxy { } } - //server maxplayer check - if (!VIP.Find(this)) - { - // Check to see how many guests we have - Player[] online = PlayerInfo.Online.Items; - if (online.Length >= Server.players && !IPInPrivateRange(ip)) { Leave("Server full!", true); return; } - // Code for limiting no. of guests - if (foundGrp == Group.findPerm(LevelPermission.Guest)) - { - // Check to see how many guests we have - online = PlayerInfo.Online.Items; - int currentNumOfGuests = online.Count(pl => pl.group.Permission <= LevelPermission.Guest); - if (currentNumOfGuests >= Server.maxGuests) - { - if (Server.guestLimitNotify) Chat.GlobalMessageOps("Guest " + this.DisplayName + " couldn't log in - too many guests."); - Server.s.Log("Guest " + this.name + " couldn't log in - too many guests."); - Leave("Server has reached max number of guests", true); - return; - } - } - } - + // maxplayer check + if (!CheckPlayersCount(foundGrp)) return; if (version != Server.version) { Leave("Wrong version!", true); return; } Player[] players = PlayerInfo.Online.Items; @@ -412,6 +392,23 @@ namespace MCGalaxy { } } + bool CheckPlayersCount(Group foundGrp) { + if (VIP.Find(this)) return true; + + Player[] online = PlayerInfo.Online.Items; + if (online.Length >= Server.players && !IPInPrivateRange(ip)) { Leave("Server full!", true); return false; } + if (foundGrp.Permission > LevelPermission.Guest) return true; + + online = PlayerInfo.Online.Items; + int curGuests = online.Count(pl => pl.group.Permission <= LevelPermission.Guest); + if (curGuests < Server.maxGuests) return true; + + if (Server.guestLimitNotify) Chat.GlobalMessageOps("Guest " + DisplayName + " couldn't log in - too many guests."); + Server.s.Log("Guest " + name + " couldn't log in - too many guests."); + Leave("Server has reached max number of guests", true); + return false; + } + void SendCpeExtensions() { SendExtInfo(21); SendExtEntry(CpeExt.ClickDistance, 1); @@ -554,6 +551,7 @@ namespace MCGalaxy { OnPlayerConnectEvent.Call(this); CheckLoginJailed(); + CheckReviewList(); if (Server.agreetorulesonentry) { if (!File.Exists("ranks/agreed.txt")) File.WriteAllText("ranks/agreed.txt", ""); @@ -600,6 +598,15 @@ namespace MCGalaxy { Loading = false; } + void CheckReviewList() { + if (group.Permission < Server.reviewview || !group.CanExecute("review")) return; + int count = Server.reviewlist.Count; + if (count == 0) return; + + string suffix = count == 1 ? " player is " : " players are "; + SendMessage(count + suffix + "waiting for a review, type %T/review view"); + } + void LoadCpeData() { string line = Server.skins.Find(name); if (line != null) {