diff --git a/MCGalaxy/Commands/Bots/CmdBotSet.cs b/MCGalaxy/Commands/Bots/CmdBotSet.cs index d1b0b35f4..b4915d325 100644 --- a/MCGalaxy/Commands/Bots/CmdBotSet.cs +++ b/MCGalaxy/Commands/Bots/CmdBotSet.cs @@ -60,7 +60,7 @@ namespace MCGalaxy.Commands.Bots { UpdateBot(p, bot, "'s hunt instinct: " + bot.hunt); return; } else if (ai.CaselessEq("kill")) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; bot.kill = !bot.kill; UpdateBot(p, bot, "'s kill instinct: " + bot.kill); return; diff --git a/MCGalaxy/Commands/CPE/CmdPing.cs b/MCGalaxy/Commands/CPE/CmdPing.cs index 0879911dc..2850cea65 100644 --- a/MCGalaxy/Commands/CPE/CmdPing.cs +++ b/MCGalaxy/Commands/CPE/CmdPing.cs @@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Chatting { Player.Message(p, p.Ping.Format()); } } else { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p); return; } + if (!CheckExtraPerm(p, 1)) return; Player[] players = PlayerInfo.Online.Items; Player.Message(p, "Ping/latency list for online players:"); diff --git a/MCGalaxy/Commands/Chat/CmdChatRoom.cs b/MCGalaxy/Commands/Chat/CmdChatRoom.cs index 1115fd8b0..3906888f7 100644 --- a/MCGalaxy/Commands/Chat/CmdChatRoom.cs +++ b/MCGalaxy/Commands/Chat/CmdChatRoom.cs @@ -107,7 +107,7 @@ namespace MCGalaxy.Commands.Chatting { } void HandleCreate(Player p, string[] parts) { - if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (parts.Length <= 1) { Player.Message(p, "You need to provide a new chatroom name."); return; } @@ -127,8 +127,8 @@ namespace MCGalaxy.Commands.Chatting { return; } string room = parts[1]; - bool canDeleteForce = CheckExtraPerm(p, 3); - bool canDelete = CheckExtraPerm(p, 2); + bool canDeleteForce = HasExtraPerm(p, 3); + bool canDelete = HasExtraPerm(p, 2); if (!canDelete && !canDeleteForce) { Player.Message(p, "You aren't a high enough rank to delete a chatroon."); return; @@ -169,7 +169,7 @@ namespace MCGalaxy.Commands.Chatting { } void HandleSpy(Player p, string[] parts) { - if (!CheckExtraPerm(p, 4)) { MessageNeedExtra(p, 4); return; } + if (!CheckExtraPerm(p, 4)) return; if (parts.Length <= 1) { Player.Message(p, "You need to provide a chatroom name to spy on."); return; } @@ -192,7 +192,7 @@ namespace MCGalaxy.Commands.Chatting { } void HandleForceJoin(Player p, string[] parts) { - if (!CheckExtraPerm(p, 5)) { MessageNeedExtra(p, 5); return; } + if (!CheckExtraPerm(p, 5)) return; if (parts.Length <= 2) { Player.Message(p, "You need to provide a player name, then a chatroom name."); return; } @@ -219,7 +219,7 @@ namespace MCGalaxy.Commands.Chatting { } void HandleKick(Player p, string[] parts) { - if (!CheckExtraPerm(p, 6)) { MessageNeedExtra(p, 6); return; } + if (!CheckExtraPerm(p, 6)) return; if (parts.Length <= 1) { Player.Message(p, "You need to provide a player name."); return; @@ -241,7 +241,7 @@ namespace MCGalaxy.Commands.Chatting { void HandleAll(Player p, string[] parts, string message) { int length = parts.Length > 1 ? parts[0].Length + 1 : parts[0].Length; message = message.Substring( length ); - if (CheckExtraPerm(p, 7)) { + if (HasExtraPerm(p, 7)) { Chat.MessageAllChatRooms(p, message, true); return; } @@ -276,21 +276,21 @@ namespace MCGalaxy.Commands.Chatting { Player.Message(p, "/chatroom join [room] - joins a room"); Player.Message(p, "/chatroom leave [room] - leaves a room"); - if (CheckExtraPerm(p, 1)) + if (HasExtraPerm(p, 1)) Player.Message(p, "/chatroom create [room] - creates a new room"); - if (CheckExtraPerm(p, 3)) + if (HasExtraPerm(p, 3)) Player.Message(p, "/chatroom delete [room] - deletes a room"); - else if (CheckExtraPerm(p, 2)) + else if (HasExtraPerm(p, 2)) Player.Message(p, "/chatroom delete [room] - deletes a room only if all people have left"); - if (CheckExtraPerm(p, 4)) + if (HasExtraPerm(p, 4)) Player.Message(p, "/chatroom spy [room] - spy on a chatroom"); - if (CheckExtraPerm(p, 5)) + if (HasExtraPerm(p, 5)) Player.Message(p, "/chatroom forcejoin [player] [room] - forces a player to join a room"); - if (CheckExtraPerm(p, 6)) + if (HasExtraPerm(p, 6)) Player.Message(p, "/chatroom kick [player] - kicks the player from their current room"); - if (CheckExtraPerm(p, 7)) + if (HasExtraPerm(p, 7)) Player.Message(p, "/chatroom all [message] - sends a global message to all rooms"); else Player.Message(p, "/chatroom all [message] - sends a global message to all rooms " + diff --git a/MCGalaxy/Commands/Chat/CmdClear.cs b/MCGalaxy/Commands/Chat/CmdClear.cs index 18cb32a8f..54433c5c0 100644 --- a/MCGalaxy/Commands/Chat/CmdClear.cs +++ b/MCGalaxy/Commands/Chat/CmdClear.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Chatting { ClearChat(p); Player.Message(p, "%4Chat cleared."); } else { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p); return; } + if (!CheckExtraPerm(p, 1)) return; Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { diff --git a/MCGalaxy/Commands/Chat/CmdHug.cs b/MCGalaxy/Commands/Chat/CmdHug.cs index 91f400b4c..2340c61d5 100644 --- a/MCGalaxy/Commands/Chat/CmdHug.cs +++ b/MCGalaxy/Commands/Chat/CmdHug.cs @@ -39,7 +39,7 @@ namespace MCGalaxy.Commands.Chatting { if (hugType == null) { TryMessageAction(p, args[0], "{0} %Shugged {1}.", false); return; } if (hugType == "deadly") { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (p != null && who.Rank > p.Rank) { MessageTooHighRank(p, "&cdeath-hug%S", true); return; } diff --git a/MCGalaxy/Commands/Command.Helpers.cs b/MCGalaxy/Commands/Command.Helpers.cs index fce0d9915..bd68dae23 100644 --- a/MCGalaxy/Commands/Command.Helpers.cs +++ b/MCGalaxy/Commands/Command.Helpers.cs @@ -41,7 +41,7 @@ namespace MCGalaxy { protected bool CheckSuper(Player p, string message, string type) { if (message.Length > 0 || !Player.IsSuper(p)) return false; - SuperRequiresArgs(name, p, type); + SuperRequiresArgs(name, p, type); return true; } @@ -52,14 +52,17 @@ namespace MCGalaxy { Player.Message(p, "When using /{0} from {2}, you must provide a {1}.", cmd, type, src); } - protected bool CheckExtraPerm(Player p, int num = 1) { + protected bool HasExtraPerm(Player p, int num) { return p == null || p.Rank >= CommandExtraPerms.MinPerm(name, num); } - protected void MessageNeedExtra(Player p, int num = 1) { + protected bool CheckExtraPerm(Player p, int num) { + if (HasExtraPerm(p, num)) return true; + LevelPermission perm = CommandExtraPerms.MinPerm(name, num); string action = ExtraPerms[num - 1].Description; Formatter.MessageNeedMinPerm(p, action, perm); + return false; } protected static void MessageTooHighRank(Player p, string action, bool canAffectOwnRank) { diff --git a/MCGalaxy/Commands/Economy/CmdEconomy.cs b/MCGalaxy/Commands/Economy/CmdEconomy.cs index 5532bd097..7ca18f1cd 100644 --- a/MCGalaxy/Commands/Economy/CmdEconomy.cs +++ b/MCGalaxy/Commands/Economy/CmdEconomy.cs @@ -34,7 +34,7 @@ namespace MCGalaxy.Commands.Eco { string[] args = new string[] { "", "", "", "", "", "", "", "" }; for (int i = 0; i < Math.Min(args.Length, raw.Length); i++) args[i] = raw[i]; - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (args[0].CaselessEq("apply")) { Economy.Load(); diff --git a/MCGalaxy/Commands/EntityPropertyCmd.cs b/MCGalaxy/Commands/EntityPropertyCmd.cs index 8440e5fcc..dad903f2f 100644 --- a/MCGalaxy/Commands/EntityPropertyCmd.cs +++ b/MCGalaxy/Commands/EntityPropertyCmd.cs @@ -33,9 +33,7 @@ namespace MCGalaxy.Commands { if (bot == null && who == null) return; if (isBot) { - if (!CheckExtraPerm(p, 2)) { - MessageNeedExtra(p, 2); return; - } + if (!CheckExtraPerm(p, 2)) return; if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { Player.Message(p, "Hence, you cannot change the " + type + " of that bot."); @@ -43,9 +41,7 @@ namespace MCGalaxy.Commands { } SetBotData(p, bot, args.Length > 2 ? args[2] : ""); } else { - if (p != who && !CheckExtraPerm(p, 1)) { - MessageNeedExtra(p, 1); return; - } + if (p != who && !CheckExtraPerm(p, 1)) return; if (p != null && who.Rank > p.Rank) { MessageTooHighRank(p, "change the " + type + " of", true); return; @@ -65,7 +61,7 @@ namespace MCGalaxy.Commands { if (p != null && who.Rank > p.Rank) { MessageTooHighRank(p, "change the " + type + " of", true); return; } - if (p != who && !CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (p != who && !CheckExtraPerm(p, 1)) return; SetPlayerData(p, who, args.Length > 1 ? args[1] : ""); } diff --git a/MCGalaxy/Commands/Fun/CmdCountdown.cs b/MCGalaxy/Commands/Fun/CmdCountdown.cs index 305e330c1..9dbc2f879 100644 --- a/MCGalaxy/Commands/Fun/CmdCountdown.cs +++ b/MCGalaxy/Commands/Fun/CmdCountdown.cs @@ -155,7 +155,7 @@ namespace MCGalaxy.Commands.Fun { void HandleRules(Player p, string target) { Player who = p; - if (target.Length > 0 && CheckExtraPerm(p, 1)) { + if (target.Length > 0 && HasExtraPerm(p, 1)) { who = PlayerInfo.FindMatches(p, target); if (who == null) return; @@ -177,7 +177,7 @@ namespace MCGalaxy.Commands.Fun { void HandleGenerate(Player p, CountdownGame game, string x, string y, string z) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; int width, height, length; if(!int.TryParse(x, out width) || !int.TryParse(y, out height) || !int.TryParse(z, out length)) { @@ -192,7 +192,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleEnable(Player p, CountdownGame game) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; if (game.Status == CountdownGameStatus.Disabled) { game.Enable(p); @@ -202,7 +202,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleDisable(Player p, CountdownGame game) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; if (game.Status == CountdownGameStatus.Disabled) { Player.Message(p, "Countdown is not running."); return; @@ -212,7 +212,7 @@ namespace MCGalaxy.Commands.Fun { void HandleStart(Player p, CountdownGame game, string speed, string mode) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; switch (game.Status) { case CountdownGameStatus.Disabled: @@ -245,7 +245,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleEnd(Player p, CountdownGame game) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; switch (game.Status) { case CountdownGameStatus.Disabled: @@ -258,7 +258,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleReset(Player p, CountdownGame game, string type) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; switch (game.Status) { case CountdownGameStatus.Disabled: @@ -278,11 +278,11 @@ namespace MCGalaxy.Commands.Fun { Player.Message(p, "%T/CD join/leave %H- joins/leaves the game"); Player.Message(p, "%T/CD players %H- lists players currently playing"); Player.Message(p, "%T/CD rules %H- view the rules of countdown"); - if (CheckExtraPerm(p, 1)) { + if (HasExtraPerm(p, 1)) { Player.Message(p, "%T/CD rules [player] %H- sends rules to that player."); } - if (!CheckExtraPerm(p, 2)) return; + if (!HasExtraPerm(p, 2)) return; Player.Message(p, "%T/CD generate [width] [height] [length] %H- generates the countdown map (default is 32x32x32)"); Player.Message(p, "%T/CD enable/disable %H- enables/disables countdown"); Player.Message(p, "%T/CD start %H- starts a round of countdown"); diff --git a/MCGalaxy/Commands/Fun/CmdLavaSurvival.cs b/MCGalaxy/Commands/Fun/CmdLavaSurvival.cs index 1063922b6..8aba8150f 100644 --- a/MCGalaxy/Commands/Fun/CmdLavaSurvival.cs +++ b/MCGalaxy/Commands/Fun/CmdLavaSurvival.cs @@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleStart(Player p, string[] args) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; string map = args.Length > 1 ? args[1] : ""; switch (Server.lava.Start(map)) { @@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleStop(Player p, string[] args) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; switch (Server.lava.Stop()) { case 0: Chat.MessageGlobal("Lava Survival has ended! We hope you had fun!"); return; @@ -84,7 +84,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleEnd(Player p, string[] args) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; if (!Server.lava.active) { Player.Message(p, "There isn't an active Lava Survival game."); return; } if (Server.lava.roundActive) Server.lava.EndRound(); @@ -93,7 +93,8 @@ namespace MCGalaxy.Commands.Fun { } void HandleSetup(Player p, string[] args) { - if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; + if (p == null) { Player.Message(p, "/{0} setup can only be used in-game.", name); return; } if (args.Length < 2) { SetupHelp(p); return; } if (Server.lava.active) { Player.Message(p, "You cannot configure Lava Survival while a game is active."); return; } @@ -263,12 +264,12 @@ namespace MCGalaxy.Commands.Fun { Player.Message(p, "%T/LS go %H- Join the fun!"); Player.Message(p, "%T/LS info %H- View current round info and time."); - if (CheckExtraPerm(p, 1)) { + if (HasExtraPerm(p, 1)) { Player.Message(p, "%T/LS start %H- Starts Lava Survival, optionally on the given map."); Player.Message(p, "%T/LS stop %H- Stops the current Lava Survival game."); Player.Message(p, "%T/LS end %H- End the current round or vote."); } - if (CheckExtraPerm(p, 2)) { + if (HasExtraPerm(p, 2)) { Player.Message(p, "%T/LS setup %H- Setup lava survival, use it for more info."); } } diff --git a/MCGalaxy/Commands/Fun/CmdTeam.cs b/MCGalaxy/Commands/Fun/CmdTeam.cs index 1ba01f4b6..4671870f7 100644 --- a/MCGalaxy/Commands/Fun/CmdTeam.cs +++ b/MCGalaxy/Commands/Fun/CmdTeam.cs @@ -112,7 +112,7 @@ namespace MCGalaxy.Commands.Fun { } void HandleCreate(Player p, string[] args) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; Team team = p.Game.Team; if (team != null) { Player.Message(p, "You need to leave your current team before you can create one."); return; } if (args.Length == 1) { diff --git a/MCGalaxy/Commands/Fun/CmdTntWars.cs b/MCGalaxy/Commands/Fun/CmdTntWars.cs index f4e57c53f..32b267e1c 100644 --- a/MCGalaxy/Commands/Fun/CmdTntWars.cs +++ b/MCGalaxy/Commands/Fun/CmdTntWars.cs @@ -190,7 +190,7 @@ namespace MCGalaxy.Commands.Fun { Player.Message(p, "TNT Wars Rules:"); SendRules(p); return; } - if (!CheckExtraPerm(p)) return; + if (!HasExtraPerm(p, 1)) return; switch (text[1]) { case "all": @@ -329,7 +329,7 @@ namespace MCGalaxy.Commands.Fun { } void DoSetup(Player p, string[] text) { - if (!CheckExtraPerm(p)) { + if (!HasExtraPerm(p, 1)) { Player.Message(p, "Sorry, you aren't a high enough rank for that!"); return; } @@ -1138,7 +1138,7 @@ namespace MCGalaxy.Commands.Fun { Player.Message(p, "/tw players {p} - view the current players in your game"); Player.Message(p, "/tw health {hp} - view your currrent amount of health left"); - if (CheckExtraPerm(p)) { + if (HasExtraPerm(p, 1)) { Player.Message(p, "/tw rules > - send the rules to yourself, all, your map, all players in your game or to one person!"); Player.Message(p, "/tw setup {s} - setup the game (do '/tntwars setup help' for more info!"); } else { diff --git a/MCGalaxy/Commands/Information/CmdRules.cs b/MCGalaxy/Commands/Information/CmdRules.cs index dedb29386..8610c12fc 100644 --- a/MCGalaxy/Commands/Information/CmdRules.cs +++ b/MCGalaxy/Commands/Information/CmdRules.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.Info { Player who = p; if (message.Length > 0) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; who = PlayerInfo.FindMatches(p, message); if (who == null) return; } @@ -79,7 +79,7 @@ namespace MCGalaxy.Commands.Info { } public override void Help(Player p) { - if (CheckExtraPerm(p)) { + if (HasExtraPerm(p, 1)) { Player.Message(p, "%T/Rules "); Player.Message(p, "%HDisplays server rules to ."); Player.Message(p, "%HIf is not given, the rules are displayed to you."); diff --git a/MCGalaxy/Commands/Information/CmdServerInfo.cs b/MCGalaxy/Commands/Information/CmdServerInfo.cs index 4eae10973..aafc18d80 100644 --- a/MCGalaxy/Commands/Information/CmdServerInfo.cs +++ b/MCGalaxy/Commands/Information/CmdServerInfo.cs @@ -58,8 +58,7 @@ namespace MCGalaxy.Commands.Info { else Player.Message(p, "Console state: &3{0}", ServerConfig.ConsoleName); - if (CheckExtraPerm(p)) - ShowServerStats(p); + if (HasExtraPerm(p, 1)) ShowServerStats(p); } static int GetPlayerCount() { diff --git a/MCGalaxy/Commands/Moderation/CmdHide.cs b/MCGalaxy/Commands/Moderation/CmdHide.cs index 8610baac1..a03069351 100644 --- a/MCGalaxy/Commands/Moderation/CmdHide.cs +++ b/MCGalaxy/Commands/Moderation/CmdHide.cs @@ -42,7 +42,7 @@ namespace MCGalaxy.Commands.Moderation { } bool messageOps = true; if (message.CaselessEq("silent")) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; messageOps = false; } diff --git a/MCGalaxy/Commands/Moderation/CmdReport.cs b/MCGalaxy/Commands/Moderation/CmdReport.cs index 093bf6ae0..e4f60e3b1 100644 --- a/MCGalaxy/Commands/Moderation/CmdReport.cs +++ b/MCGalaxy/Commands/Moderation/CmdReport.cs @@ -57,7 +57,7 @@ namespace MCGalaxy.Commands.Moderation { } void HandleList(Player p, string[] args) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; bool foundone = false; string[] files = Directory.GetFiles("extra/reported", "*.txt"); @@ -79,7 +79,7 @@ namespace MCGalaxy.Commands.Moderation { if (args.Length != 2) { Player.Message(p, "You need to provide a player's name."); return; } - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (!Formatter.ValidName(p, args[1], "player")) return; if (!File.Exists("extra/reported/" + args[1] + ".txt")) { @@ -93,7 +93,7 @@ namespace MCGalaxy.Commands.Moderation { if (args.Length != 2) { Player.Message(p, "You need to provide a player's name."); return; } - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (!Formatter.ValidName(p, args[1], "player")) return; if (!File.Exists("extra/reported/" + args[1] + ".txt")) { @@ -111,7 +111,7 @@ namespace MCGalaxy.Commands.Moderation { } void HandleClear(Player p, string[] args) { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (!Directory.Exists("extra/reportedbackups")) Directory.CreateDirectory("extra/reportedbackups"); string[] files = Directory.GetFiles("extra/reported", "*.txt"); @@ -151,7 +151,7 @@ namespace MCGalaxy.Commands.Moderation { public override void Help(Player p) { Player.Message(p, "%T/Report [Player] [Reason] %H- Reports that player for the given reason."); - if (!CheckExtraPerm(p)) return; + if (!HasExtraPerm(p, 1)) return; Player.Message(p, "%T/Report list %H- Outputs the list of reported players."); Player.Message(p, "%T/Report check [Player] %H- Views report for that player."); Player.Message(p, "%T/Report delete [Player] %H- Deletes report for that player."); diff --git a/MCGalaxy/Commands/Moderation/CmdReview.cs b/MCGalaxy/Commands/Moderation/CmdReview.cs index 9eded2fd6..624c62945 100644 --- a/MCGalaxy/Commands/Moderation/CmdReview.cs +++ b/MCGalaxy/Commands/Moderation/CmdReview.cs @@ -95,7 +95,7 @@ namespace MCGalaxy.Commands.Moderation { } void HandleView(Player p) { - if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (Server.reviewlist.Count == 0) { Player.Message(p, "There are no players in the review queue."); return; @@ -128,7 +128,7 @@ namespace MCGalaxy.Commands.Moderation { void HandleNext(Player p) { if (p == null) { Player.Message(p, "Console cannot answer the review queue."); return; } - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; if (Server.reviewlist.Count == 0) { Player.Message(p, "There are no players in the review queue."); return; } @@ -153,7 +153,7 @@ namespace MCGalaxy.Commands.Moderation { } void HandleClear(Player p) { - if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return; } + if (!CheckExtraPerm(p, 3)) return; Server.reviewlist.Clear(); Player.Message(p, "The review queue has been cleared"); } diff --git a/MCGalaxy/Commands/Moderation/CmdZone.cs b/MCGalaxy/Commands/Moderation/CmdZone.cs index e1f4e3311..38ba145f7 100644 --- a/MCGalaxy/Commands/Moderation/CmdZone.cs +++ b/MCGalaxy/Commands/Moderation/CmdZone.cs @@ -53,10 +53,10 @@ namespace MCGalaxy.Commands.Moderation { ZoneAll(p.level, args[1]); Player.Message(p, "Added zone for &b" + args[1]); } else if (args[0].CaselessEq("del") && args.Length > 1 && args[1].CaselessEq("all")) { - if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (!CheckExtraPerm(p, 2)) return; DeleteAll(p); } else if (args[0].CaselessEq("del")) { - if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (p.canBuild) { //Checks if player can build there Player.Message(p, "Place a block where you would like to delete a zone."); @@ -109,7 +109,7 @@ namespace MCGalaxy.Commands.Moderation { } bool CheckAdd(Player p, string[] args, string cmd) { - if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return false; } + if (!CheckExtraPerm(p, 3)) return false; if (args.Length == 1) { Help(p); return false; } if (!Formatter.ValidName(p, args[1], "player or rank")) return false; diff --git a/MCGalaxy/Commands/World/CmdMain.cs b/MCGalaxy/Commands/World/CmdMain.cs index 440b2fd0d..88ec02483 100644 --- a/MCGalaxy/Commands/World/CmdMain.cs +++ b/MCGalaxy/Commands/World/CmdMain.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.World { PlayerActions.ChangeMap(p, Server.mainLevel); } } else { - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (!Formatter.ValidName(p, message, "level")) return; string map = Matcher.FindMaps(p, message); diff --git a/MCGalaxy/Commands/World/CmdMap.cs b/MCGalaxy/Commands/World/CmdMap.cs index 27211178f..96f93b21a 100644 --- a/MCGalaxy/Commands/World/CmdMap.cs +++ b/MCGalaxy/Commands/World/CmdMap.cs @@ -60,10 +60,8 @@ namespace MCGalaxy.Commands.World { value = args.Length > 2 ? args[2] : ""; } - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; } - if (opt.CaselessEq("realmowner") && !CheckExtraPerm(p, 2)) { - MessageNeedExtra(p, 2); return; - } + if (!CheckExtraPerm(p, 1)) return; + if (opt.CaselessEq("realmowner") && !CheckExtraPerm(p, 2)) return; if (SetMapOption(p, lvl, opt, value)) return; Player.Message(p, "Could not find option entered."); diff --git a/MCGalaxy/Commands/World/CmdNewLvl.cs b/MCGalaxy/Commands/World/CmdNewLvl.cs index 215a21822..043066bc2 100644 --- a/MCGalaxy/Commands/World/CmdNewLvl.cs +++ b/MCGalaxy/Commands/World/CmdNewLvl.cs @@ -62,9 +62,7 @@ namespace MCGalaxy.Commands.World { if (LevelInfo.MapExists(name)) { Player.Message(p, "Level \"{0}\" already exists", name); return null; } - if (!MapGen.IsSimpleTheme(args[4]) && !CheckExtraPerm(p)) { - MessageNeedExtra(p, 1); return null; - } + if (!MapGen.IsSimpleTheme(args[4]) && !CheckExtraPerm(p, 1)) return null; if (p != null && Interlocked.CompareExchange(ref p.GeneratingMap, 1, 0) == 1) { Player.Message(p, "You are already generating a map, please wait until that map has finished generating first."); diff --git a/MCGalaxy/Commands/World/CmdReload.cs b/MCGalaxy/Commands/World/CmdReload.cs index 2e8fa15dd..0b9c3fa66 100644 --- a/MCGalaxy/Commands/World/CmdReload.cs +++ b/MCGalaxy/Commands/World/CmdReload.cs @@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.World { SuperRequiresArgs(name + " all", p, "level name"); return false; } - if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return false; } + if (!CheckExtraPerm(p, 1)) return false; Player[] players = PlayerInfo.Online.Items; foreach (Player who in players) { if (who.level == lvl) diff --git a/MCGalaxy/Commands/building/CmdMessageBlock.cs b/MCGalaxy/Commands/building/CmdMessageBlock.cs index e5199a963..3b1f72c05 100644 --- a/MCGalaxy/Commands/building/CmdMessageBlock.cs +++ b/MCGalaxy/Commands/building/CmdMessageBlock.cs @@ -86,7 +86,7 @@ namespace MCGalaxy.Commands.Building { } bool CheckCommand(Player p, string message) { - bool allCmds = CheckExtraPerm(p); + bool allCmds = HasExtraPerm(p, 1); string[] parts = message.SplitSpaces(2); string alias = parts[0], cmdArgs = ""; Command.Search(ref alias, ref cmdArgs); diff --git a/MCGalaxy/Commands/building/CmdUndo.cs b/MCGalaxy/Commands/building/CmdUndo.cs index 58aa9933b..15bc15eab 100644 --- a/MCGalaxy/Commands/building/CmdUndo.cs +++ b/MCGalaxy/Commands/building/CmdUndo.cs @@ -76,7 +76,7 @@ namespace MCGalaxy.Commands.Building { } void UndoPhysics(Player p, TimeSpan delta) { - if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (!CheckExtraPerm(p, 1)) return; if (p != null && !p.group.CanExecute("physics")) { Player.Message(p, "You can only undo physics if you can use %T/Physics."); return; } diff --git a/MCGalaxy/Commands/other/CmdSummon.cs b/MCGalaxy/Commands/other/CmdSummon.cs index bf52aebf9..7a6d9942f 100644 --- a/MCGalaxy/Commands/other/CmdSummon.cs +++ b/MCGalaxy/Commands/other/CmdSummon.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Misc { public override void Use(Player p, string message) { if (message.Length == 0) { Help(p); return; } if (message.CaselessEq("all")) { - if (CheckExtraPerm(p)) SummonAll(p); + if (HasExtraPerm(p, 1)) SummonAll(p); } else { SummonPlayer(p, message); } diff --git a/MCGalaxy/Commands/other/CmdWarp.cs b/MCGalaxy/Commands/other/CmdWarp.cs index 5b9c9f729..e311022ed 100644 --- a/MCGalaxy/Commands/other/CmdWarp.cs +++ b/MCGalaxy/Commands/other/CmdWarp.cs @@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.Misc { string name = args[1]; if (cmd == "create" || cmd == "add") { - if (CheckExtraPerms && !CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; } + if (CheckExtraPerms && !CheckExtraPerm(p, 1)) return; if (warps.Exists(name)) { Player.Message(p, "{0} already exists", group); return; } Player who = args.Length == 2 ? p : PlayerInfo.FindMatches(p, args[2]); @@ -67,14 +67,14 @@ namespace MCGalaxy.Commands.Misc { warps.Create(name, who); Player.Message(p, "{0} {1} created.", group, name); } else if (cmd == "delete" || cmd == "remove") { - if (CheckExtraPerms && !CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; } + if (CheckExtraPerms && !CheckExtraPerm(p, 2)) return; Warp warp = Matcher.FindWarps(p, warps, name); if (warp == null) return; warps.Remove(warp, p); Player.Message(p, "{0} {1} deleted.", group, warp.Name); } else if (cmd == "move" || cmd == "update") { - if (CheckExtraPerms && !CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return; } + if (CheckExtraPerms && !CheckExtraPerm(p, 3)) return; Warp warp = Matcher.FindWarps(p, warps, name); if (warp == null) return; @@ -94,11 +94,11 @@ namespace MCGalaxy.Commands.Misc { public override void Help(Player p) { Player.Message(p, "%T/Warp [name] %H- Move to that warp"); Player.Message(p, "%T/Warp list %H- List all the warps"); - if (CheckExtraPerm(p, 1)) + if (HasExtraPerm(p, 1)) Player.Message(p, "%T/Warp create [name] %H- Create a warp, if a is given, it will be created where they are"); - if (CheckExtraPerm(p, 2)) + if (HasExtraPerm(p, 2)) Player.Message(p, "%T/Warp delete [name] %H- Deletes a warp"); - if (CheckExtraPerm(p, 3)) + if (HasExtraPerm(p, 3)) Player.Message(p, "%T/Warp move [name] %H- Moves a warp, if a is given, it will be created where they are"); } } diff --git a/MCGalaxy/Commands/other/CmdWaypoint.cs b/MCGalaxy/Commands/other/CmdWaypoint.cs index ebd99cd82..bb9087ab6 100644 --- a/MCGalaxy/Commands/other/CmdWaypoint.cs +++ b/MCGalaxy/Commands/other/CmdWaypoint.cs @@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Misc { protected override bool CheckExtraPerms { get { return false; } } public override void Use(Player p, string message) { - UseCore(p, message, p.Waypoints, "Waypoint"); + UseCore(p, message, p.Waypoints, "Waypoint"); } public override void Help(Player p) {