diff --git a/Blocks/Block.CoreProps.cs b/Blocks/Block.CoreProps.cs index 296b63da7..6b78ddd29 100644 --- a/Blocks/Block.CoreProps.cs +++ b/Blocks/Block.CoreProps.cs @@ -56,7 +56,14 @@ namespace MCGalaxy { if (i >= red && i <= white) Properties[i].KilledByLava = true; + if (i == air || i == shrub || (i >= yellowflower && i <= redmushroom) { + Properties[i].KilledByLava = true; + Properties[i].KilledByWater = true; + } } + // Block specific properties + Properties[wood].KilledByLava = true; Properties[trunk].KilledByLava = true; + Properties[sponge].KilledByLava = true; Properties[bookcase].KilledByLava = true; SetupDefaultNames(); } diff --git a/Blocks/Block.cs b/Blocks/Block.cs index fe9bc7d30..6b454563f 100644 --- a/Blocks/Block.cs +++ b/Blocks/Block.cs @@ -21,23 +21,9 @@ namespace MCGalaxy { public sealed partial class Block { - public static bool Walkthrough(byte type) - { - switch (type) - { - case air: - case water: - case waterstill: - case lava: - case lavastill: - case yellowflower: - case redflower: - case mushroom: - case redmushroom: - case shrub: - return true; - } - return false; + public static bool Walkthrough(byte type) { + return type == air || type == shrub || (type >= water && type <= lavastill) + && (type >= yelllowflower && type <= redmushroom); } public static bool AllowBreak(byte type) @@ -98,35 +84,14 @@ namespace MCGalaxy return false; } - public static bool Placable(byte type) - { - switch (type) - { - // case Block.air: - // case Block.grass: - case Block.blackrock: - case Block.water: - case Block.waterstill: - case Block.lava: - case Block.lavastill: - return false; - } - return type < Block.CpeCount; + public static bool Placable(byte type) { + return !(type == blackrock || (type >= water && type <= lavstill) + && type < Block.CpeCount; } - public static bool RightClick(byte type, bool countAir = false) - { + public static bool RightClick(byte type, bool countAir = false) { if (countAir && type == Block.air) return true; - - switch (type) - { - case Block.water: - case Block.lava: - case Block.waterstill: - case Block.lavastill: - return true; - } - return false; + return type >= water && type <= lavastill; } public static bool OPBlocks(byte type) { return Properties[type].OPBlock; } @@ -169,60 +134,17 @@ namespace MCGalaxy public static bool BuildIn(byte type) { if (type == op_water || type == op_lava || Block.portal(type) || Block.mb(type)) return false; - - switch (Block.Convert(type)) - { - case water: - case lava: - case waterstill: - case lavastill: - return true; - } - return false; + type = Block.Convert(type); + return type >= water && type <= lavastill; } - public static bool Mover(byte type) { - return walkthroughHandlers[type] != null; - } + public static bool Mover(byte type) { return walkthroughHandlers[type] != null; } - public static bool FireKill(byte type) { - return type != Block.air && LavaKill(type); - } + public static bool FireKill(byte type) { return type != air && Properties[type].KilledByLava; } - public static bool LavaKill(byte type) - { - switch (type) - { - case Block.air: - case Block.wood: - case Block.shrub: - case Block.trunk: - case Block.leaf: - case Block.sponge: - case Block.yellowflower: - case Block.redflower: - case Block.mushroom: - case Block.redmushroom: - case Block.bookcase: - return true; - } - return Properties[type].KilledByLava; - } - public static bool WaterKill(byte type) - { - switch (type) - { - case Block.air: - case Block.shrub: - case Block.leaf: - case Block.yellowflower: - case Block.redflower: - case Block.mushroom: - case Block.redmushroom: - return true; - } - return Properties[type].KilledByWater; - } + public static bool LavaKill(byte type) { return Properties[type].KilledByLava; } + + public static bool WaterKill(byte type) { return Properties[type].KilledByWater; } public static bool LightPass(byte type, byte extType, BlockDefinition[] defs) { switch (Convert(type)) { diff --git a/Commands/Chat/CmdChatRoom.cs b/Commands/Chat/CmdChatRoom.cs index 8251bd652..593ade662 100644 --- a/Commands/Chat/CmdChatRoom.cs +++ b/Commands/Chat/CmdChatRoom.cs @@ -208,8 +208,7 @@ namespace MCGalaxy.Commands { return; } if (pl.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "You can't force someone of a higher or equal rank to join a chatroom."); - return; + MessageTooHighRank(p, "force-join", false); return; } if (pl.spyChatRooms.Contains(room)) { @@ -234,8 +233,7 @@ namespace MCGalaxy.Commands { Player pl = PlayerInfo.FindOrShowMatches(p, name); if (pl == null) return; if (pl.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "You can't kick someone of a higher or equal rank from a chatroom."); - return; + MessageTooHighRank(p, "kick from a chatroom", false); return; } Player.SendMessage(pl, "You were kicked from the chat room '" + pl.Chatroom + "'"); diff --git a/Commands/Chat/CmdHug.cs b/Commands/Chat/CmdHug.cs index 31aae3165..39a0d896b 100644 --- a/Commands/Chat/CmdHug.cs +++ b/Commands/Chat/CmdHug.cs @@ -51,7 +51,7 @@ namespace MCGalaxy.Commands { Player.SendMessage(p, "You cannot %cdeath-hug %Sat your current rank."); return; } if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "You can't %cdeath-hug %Ssomeone of greater rank."); return; + MessageTooHighRank(p, "&cdeath-hug%S", true); return; } who.HandleDeath(Block.rock, " died from a %cdeadly hug."); } diff --git a/Commands/Command.cs b/Commands/Command.cs index 002da5913..19bf37b3e 100644 --- a/Commands/Command.cs +++ b/Commands/Command.cs @@ -70,6 +70,17 @@ namespace MCGalaxy else Player.SendMessage(p, "Only " + grp.color + grp.name + "%s+ can " + action); } + + protected void MessageTooHighRank(Player p, string action, bool canAffectOwnRank) { + MessageTooHighRank(p, action, p.group, canAffectOwnRank); + } + + protected void MessageTooHighRank(Player p, string action, Group grp, bool canAffectGroup) { + if (canAffectGroup) + Player.SendMessage(p, "Can only " + action + " players ranked " + grp.color + grp.name + " %Sor below"); + else + Player.SendMessage(p, "Can only " + action + " players ranked below " + grp.color + grp.name); + } } public struct CommandPerm { diff --git a/Commands/Fun/CmdCountdown.cs b/Commands/Fun/CmdCountdown.cs index be736e345..5885f01d5 100644 --- a/Commands/Fun/CmdCountdown.cs +++ b/Commands/Fun/CmdCountdown.cs @@ -204,7 +204,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, target); if (who == null) return; if (p.group.Permission < who.group.Permission) { - Player.SendMessage(p, "You can't send rules to someone of a higher rank than yourself!!"); return; + MessageTooHighRank(p, "send countdown rules", true); return; } else { Player.SendMessage(who, "Countdown rules sent to you by " + p.color + p.name); Player.SendMessage(who, "The aim of the game is to stay alive the longest."); diff --git a/Commands/Fun/CmdSlap.cs b/Commands/Fun/CmdSlap.cs index 3f3f11664..b55233a2f 100644 --- a/Commands/Fun/CmdSlap.cs +++ b/Commands/Fun/CmdSlap.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Commands { return; } if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "You cannot slap someone ranked higher than you!"); return; + MessageTooHighRank(p, "slap", true); return; } ushort curX = (ushort)(who.pos[0] / 32), curY = (ushort)(who.pos[1] / 32), curZ = (ushort)(who.pos[2] / 32); diff --git a/Commands/Information/CmdOpRules.cs b/Commands/Information/CmdOpRules.cs index 09c89ba32..872a7d7b4 100644 --- a/Commands/Information/CmdOpRules.cs +++ b/Commands/Information/CmdOpRules.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands who = PlayerInfo.FindOrShowMatches(p, message); if (who == null) return; if (p != null && p.group.Permission < who.group.Permission) { - Player.SendMessage(p, "You cannot send /oprules to a higher or same ranked player."); return; + MessageTooHighRank(p, "send /oprules", false); return; } } diff --git a/Commands/Moderation/CmdBan.cs b/Commands/Moderation/CmdBan.cs index 389942080..9e7595a36 100644 --- a/Commands/Moderation/CmdBan.cs +++ b/Commands/Moderation/CmdBan.cs @@ -95,14 +95,14 @@ namespace MCGalaxy.Commands { bool CheckPerms(string name, Group group, Player p) { if ((int)group.Permission >= CommandOtherPerms.GetPerm(this)) { - string highest = Group.findPermInt(CommandOtherPerms.GetPerm(this)).name; - Player.SendMessage(p, "You can't ban players ranked " + highest + " or higher!"); return false; + Group grp = Group.findPermInt(CommandOtherPerms.GetPerm(this)); + MessageTooHighRank(p, "ban", grp, false); return false; } if (group.Permission == LevelPermission.Banned) { Player.SendMessage(p, name + " is already banned."); return false; } if (p != null && group.Permission >= p.group.Permission) { - Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you."); return false; + MessageTooHighRank(p, "ban", false); return false; } group.playerList.Remove(name); diff --git a/Commands/Moderation/CmdFollow.cs b/Commands/Moderation/CmdFollow.cs index 71bb6763e..40b59ca02 100644 --- a/Commands/Moderation/CmdFollow.cs +++ b/Commands/Moderation/CmdFollow.cs @@ -95,7 +95,7 @@ namespace MCGalaxy.Commands } if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who == p) { Player.SendMessage(p, "Cannot follow yourself."); return; } - else if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot follow someone of equal or greater rank."); return; } + else if (who.group.Permission >= p.group.Permission) { MessageTooHighRank(p, "follow", false); return;} else if (who.following != "") { Player.SendMessage(p, who.DisplayName + " is already following " + who.following); return; } if (!p.hidden) Command.all.Find("hide").Use(p, ""); diff --git a/Commands/Moderation/CmdFreeze.cs b/Commands/Moderation/CmdFreeze.cs index 502245a6b..5125de0f2 100644 --- a/Commands/Moderation/CmdFreeze.cs +++ b/Commands/Moderation/CmdFreeze.cs @@ -32,7 +32,7 @@ namespace MCGalaxy.Commands if (who == null) return; if (p == who) { Player.SendMessage(p, "Cannot freeze yourself."); return; } if (p != null && who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot freeze someone of equal or greater rank."); return; + MessageTooHighRank(p, "freeze", false); return; } string frozenby = (p == null) ? "(console)" : p.ColoredName; diff --git a/Commands/Moderation/CmdJail.cs b/Commands/Moderation/CmdJail.cs index 67300ed59..322b97081 100644 --- a/Commands/Moderation/CmdJail.cs +++ b/Commands/Moderation/CmdJail.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands if (!who.jailed) { if (p != null &&who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; + MessageTooHighRank(p, "jail", false); return; } Player.SendMessage(p, "You jailed " + who.DisplayName); Player.GlobalDespawn(who, false); diff --git a/Commands/Moderation/CmdJoker.cs b/Commands/Moderation/CmdJoker.cs index 7b15cf904..f2abd0c6b 100644 --- a/Commands/Moderation/CmdJoker.cs +++ b/Commands/Moderation/CmdJoker.cs @@ -37,7 +37,9 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, message); if (who == null) return; - if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot joker someone of equal or greater rank."); return; } + if (p != null && who.group.Permission > p.group.Permission) { + MessageTooHighRank(p, "joker", true); return; + } if (!who.joker) { if (stealth) { diff --git a/Commands/Moderation/CmdMute.cs b/Commands/Moderation/CmdMute.cs index dcc31fde4..fe13a78d9 100644 --- a/Commands/Moderation/CmdMute.cs +++ b/Commands/Moderation/CmdMute.cs @@ -48,7 +48,7 @@ namespace MCGalaxy.Commands Extensions.DeleteLineWord("ranks/muted.txt", who.name.ToLower()); } else { if (p != null && who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot mute someone of a higher or equal rank."); return; + MessageTooHighRank(p, "mute", false); return; } who.muted = true; Player.SendChatFrom(who, who.color + who.DisplayName + " %Shas been &8muted", false); diff --git a/Commands/Moderation/CmdOhide.cs b/Commands/Moderation/CmdOhide.cs index 9abc37141..ada36a7d1 100644 --- a/Commands/Moderation/CmdOhide.cs +++ b/Commands/Moderation/CmdOhide.cs @@ -39,7 +39,7 @@ namespace MCGalaxy.Commands } if (who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot use this on someone of equal or greater rank."); return; + MessageTooHighRank(p, "hide", false); return; } Command.all.Find("hide").Use(who, ""); Player.SendMessage(p, "Used /hide on " + who.color + who.name + "%S."); diff --git a/Commands/Moderation/CmdP2P.cs b/Commands/Moderation/CmdP2P.cs index 8af2dd2af..3591b8867 100644 --- a/Commands/Moderation/CmdP2P.cs +++ b/Commands/Moderation/CmdP2P.cs @@ -37,7 +37,7 @@ namespace MCGalaxy.Commands { if (source == null || target == null) return; if (p.group.Permission < source.group.Permission) { - Player.SendMessage(p, "You cannot force a player of higher rank to tp to another player."); return; + MessageTooHighRank(p, "teleport", true); return; } Player.SendMessage(p, "Attempting to teleport " + source.name + " to " + target.name + "."); Command.all.Find("tp").Use(source, target.name); diff --git a/Commands/Moderation/CmdPossess.cs b/Commands/Moderation/CmdPossess.cs index c1dac0d9c..27a4f3e76 100644 --- a/Commands/Moderation/CmdPossess.cs +++ b/Commands/Moderation/CmdPossess.cs @@ -57,7 +57,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, message); if (who == null) return; if (who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot possess someone of equal or greater rank."); return; + MessageTooHighRank(p, "possess", false); return; } if (who.possess != "") { diff --git a/Commands/Moderation/CmdReveal.cs b/Commands/Moderation/CmdReveal.cs index 2115170dc..2340a4975 100644 --- a/Commands/Moderation/CmdReveal.cs +++ b/Commands/Moderation/CmdReveal.cs @@ -55,8 +55,8 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, parts[0]); if (who == null) { return; - } else if (who.group.Permission > p.group.Permission && p != who) { - Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; + } else if (who.group.Permission > p.group.Permission && p != who) { + MessageTooHighRank(p, "reload the map for", true); return; } ReloadMap(p, who, true); } diff --git a/Commands/Moderation/CmdSetRank.cs b/Commands/Moderation/CmdSetRank.cs index e7fed7d3b..c85528e58 100644 --- a/Commands/Moderation/CmdSetRank.cs +++ b/Commands/Moderation/CmdSetRank.cs @@ -76,8 +76,11 @@ namespace MCGalaxy.Commands Player.SendMessage(p, "Cannot change the rank to or from \"" + banned.name + "\"."); return false; } if (p != null && (group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission)) { - Player.SendMessage(p, "Cannot change the rank of someone of or to a rank equal or higher to yours."); return false; + MessageTooHighRank(p, "change the rank of", false); return false; } + if (p != null && (newRank.Permission >= p.group.Permission)) { + Player.SendMessage(p, "Cannot change the rank of a player to a rank equal or higher to yours."); return false; + } if (who != null) { Group.because(who, newRank); diff --git a/Commands/Moderation/CmdTempBan.cs b/Commands/Moderation/CmdTempBan.cs index 1de7bcc2f..5381ca5c1 100644 --- a/Commands/Moderation/CmdTempBan.cs +++ b/Commands/Moderation/CmdTempBan.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands { if (!Player.ValidName(target)) { Player.SendMessage(p, "Invalid name \"" + target + "\"."); return; } Group grp = who == null ? PlayerInfo.GetGroup(target) : who.group; if (p != null && grp.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot temp ban someone of the same or higher rank."); return; + MessageTooHighRank(p, "temp ban", false); return; } int minutes = 60; diff --git a/Commands/Moderation/CmdUndoArea.cs b/Commands/Moderation/CmdUndoArea.cs index 7ac086521..3e6f9bf34 100644 --- a/Commands/Moderation/CmdUndoArea.cs +++ b/Commands/Moderation/CmdUndoArea.cs @@ -66,7 +66,7 @@ namespace MCGalaxy.Commands { void UndoOnlinePlayer(Player p, Player who, CatchPos cpos, ushort x, ushort y, ushort z) { if (p != who && who.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot undo a user of higher or equal rank"); return; + MessageTooHighRank(p, "undo", false); return; } UndoOnlineDrawOp op = new UndoOnlineDrawOp(); @@ -84,7 +84,7 @@ namespace MCGalaxy.Commands { void UndoOfflinePlayer(Player p, string whoName, CatchPos cpos, ushort x, ushort y, ushort z) { Group group = Group.findPlayerGroup(whoName); if (group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot undo a user of higher or equal rank"); return; + MessageTooHighRank(p, "undo", false); return; } UndoOfflineDrawOp op = new UndoOfflineDrawOp(); diff --git a/Commands/Moderation/CmdWarn.cs b/Commands/Moderation/CmdWarn.cs index 523966773..468f06435 100644 --- a/Commands/Moderation/CmdWarn.cs +++ b/Commands/Moderation/CmdWarn.cs @@ -34,7 +34,7 @@ namespace MCGalaxy.Commands { if (who == null) return; if (who == p) { Player.SendMessage(p, "you can't warn yourself"); return; } if (p != null && p.group.Permission <= who.group.Permission) { - Player.SendMessage(p, "Cannot warn a player of equal or higher rank."); return; + MessageTooHighRank(p, "warn", false); return; } string reason = args.Length == 1 ? "you know why." : args[1]; diff --git a/Commands/Moderation/CmdXmute.cs b/Commands/Moderation/CmdXmute.cs index 48d756e02..df859db95 100644 --- a/Commands/Moderation/CmdXmute.cs +++ b/Commands/Moderation/CmdXmute.cs @@ -40,8 +40,7 @@ namespace MCGalaxy.Commands if (p != null && muter.group.Permission > p.group.Permission) { - Player.SendMessage(p, "You cannot xmute someone ranked higher than you!"); - return; + MessageTooHighRank(p, "xmute", true); return; } if (p == muter) { diff --git a/Commands/building/CmdUndo.cs b/Commands/building/CmdUndo.cs index 945d2ec81..4d588b4ce 100644 --- a/Commands/building/CmdUndo.cs +++ b/Commands/building/CmdUndo.cs @@ -87,7 +87,7 @@ namespace MCGalaxy.Commands void UndoOnlinePlayer(Player p, long seconds, Player who) { if (p != null && p != who) { if (who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "Cannot undo a user of higher or equal rank"); return; + MessageTooHighRank(p, "undo", true); return; } if (!CheckAdditionalPerm(p)) { MessageNeedPerms(p, "can undo other players."); return; } } diff --git a/Commands/other/CmdColor.cs b/Commands/other/CmdColor.cs index a65e24ecb..69c39c58e 100644 --- a/Commands/other/CmdColor.cs +++ b/Commands/other/CmdColor.cs @@ -34,7 +34,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, args[0]); if (who == null) return; if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "Cannot change the color of someone of greater rank"); return; + MessageTooHighRank(p, "change the color of", true); return; } ParameterisedQuery query = ParameterisedQuery.Create(); diff --git a/Commands/other/CmdImpersonate.cs b/Commands/other/CmdImpersonate.cs index 7591e9114..2f8b430b5 100644 --- a/Commands/other/CmdImpersonate.cs +++ b/Commands/other/CmdImpersonate.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands { if (p == null || p == who || p.group.Permission > who.group.Permission) { Player.SendChatFrom(who, args[1]); } else { - Player.SendMessage(p, "You cannot impersonate a player of equal or greater rank."); + MessageTooHighRank(p, "impersonate", false); return; } } diff --git a/Commands/other/CmdInvincible.cs b/Commands/other/CmdInvincible.cs index ecb9e3157..9424cbe2c 100644 --- a/Commands/other/CmdInvincible.cs +++ b/Commands/other/CmdInvincible.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands if (who == null) return; if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "Cannot toggle invincibility for someone of higher rank");return; + MessageTooHighRank(p, "toggle invinciblity", true); return; } if (who.invincible) diff --git a/Commands/other/CmdKill.cs b/Commands/other/CmdKill.cs index 59c189c33..a45a3adc2 100644 --- a/Commands/other/CmdKill.cs +++ b/Commands/other/CmdKill.cs @@ -54,7 +54,7 @@ namespace MCGalaxy.Commands if (p != null && who.group.Permission > p.group.Permission) { p.HandleDeath(Block.rock, " was killed by " + who.color + who.DisplayName); - Player.SendMessage(p, "Cannot kill someone of higher rank"); return; + MessageTooHighRank(p, "kill", true); return; } who.HandleDeath(Block.rock, deathMessage, explode); } diff --git a/Commands/other/CmdMove.cs b/Commands/other/CmdMove.cs index fada81097..b98a8fa66 100644 --- a/Commands/other/CmdMove.cs +++ b/Commands/other/CmdMove.cs @@ -51,7 +51,9 @@ namespace MCGalaxy.Commands Level where = LevelInfo.Find(param[1]); if (who == null) return; if (where == null) { Player.SendMessage(p, "Could not find level specified"); return; } - if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot move someone of greater rank"); return; } + if (p != null && who.group.Permission > p.group.Permission) { + MessageTooHighRank(p, "move", true); return; + } Command.all.Find("goto").Use(who, where.name); if (who.level == where) @@ -70,7 +72,9 @@ namespace MCGalaxy.Commands { who = PlayerInfo.FindOrShowMatches(p, param[0]); if (who == null) return; - if (p != null && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot move someone of greater rank"); return; } + if (p != null && who.group.Permission > p.group.Permission) { + MessageTooHighRank(p, "move", true); return; + } message = message.Substring(message.IndexOf(' ') + 1); } else diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs index 30a5b7e1c..8183f5a4b 100644 --- a/Commands/other/CmdNick.cs +++ b/Commands/other/CmdNick.cs @@ -37,7 +37,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, parts[0]); if (who == null) return; if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "Cannot change the nick of someone of greater rank"); return; + MessageTooHighRank(p, "change the nick of", true); return; } string newName = parts.Length > 1 ? parts[1] : ""; diff --git a/Commands/other/CmdSendCmd.cs b/Commands/other/CmdSendCmd.cs index e426b2068..2e5b9fab3 100644 --- a/Commands/other/CmdSendCmd.cs +++ b/Commands/other/CmdSendCmd.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands { Player target = PlayerInfo.FindOrShowMatches(p, parts[0]); if (target == null) return; if (p != null && p.group.Permission < target.group.Permission) { - Player.SendMessage(p, "Cannot use this on someone of equal or greater rank."); return; + MessageTooHighRank(p, "send commands for", true); return; } if (parts.Length == 1) { Player.SendMessage(p, "No command name given."); return; diff --git a/Commands/other/CmdSummon.cs b/Commands/other/CmdSummon.cs index e1599b077..8c2a99a37 100644 --- a/Commands/other/CmdSummon.cs +++ b/Commands/other/CmdSummon.cs @@ -48,7 +48,7 @@ namespace MCGalaxy.Commands Player who = PlayerInfo.FindOrShowMatches(p, message); if (who == null) return; if (p.group.Permission < who.group.Permission) { - Player.SendMessage(p, "You cannot summon someone ranked higher than you!"); return; + MessageTooHighRank(p, "summon", true); return; } if (p.level != who.level) diff --git a/Commands/other/CmdTitle.cs b/Commands/other/CmdTitle.cs index 443be9a7c..054d5a8b3 100644 --- a/Commands/other/CmdTitle.cs +++ b/Commands/other/CmdTitle.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, parts[0]); if (who == null) return; if (p != null && who.group.Permission > p.group.Permission) { - Player.SendMessage(p, "Cannot change the title of someone of greater rank"); return; + MessageTooHighRank(p, "change the title of", true); return; } string newTitle = parts.Length > 1 ? parts[1] : ""; diff --git a/Commands/other/CmdTp.cs b/Commands/other/CmdTp.cs index 5914bd534..78d7588e0 100644 --- a/Commands/other/CmdTp.cs +++ b/Commands/other/CmdTp.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands { } if (!Server.higherranktp && p.group.Permission < target.group.Permission) { - Player.SendMessage(p, "You cannot teleport to a player of higher rank!"); return; + MessageTooHighRank(p, "teleport to", true); return; } p.beforeTeleportMap = p.level.name; p.beforeTeleportPos = p.pos; diff --git a/Commands/other/CmdXspawn.cs b/Commands/other/CmdXspawn.cs index 910e29a24..eb60587b0 100644 --- a/Commands/other/CmdXspawn.cs +++ b/Commands/other/CmdXspawn.cs @@ -34,7 +34,7 @@ namespace MCGalaxy.Commands { Player.SendMessage(p, "Use /spawn to respawn yourself."); return; } if (p != null && pl.group.Permission >= p.group.Permission) { - Player.SendMessage(p, "Cannot respawn someone of greater or same rank"); return; + MessageTooHighRank(p, "respawn", false); return; } Command.all.Find("spawn").Use(pl, "");