diff --git a/MCGalaxy/Commands/CPE/CmdModel.cs b/MCGalaxy/Commands/CPE/CmdModel.cs index ec65fdc0e..ea17124c8 100644 --- a/MCGalaxy/Commands/CPE/CmdModel.cs +++ b/MCGalaxy/Commands/CPE/CmdModel.cs @@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.CPE { public override string type { get { return CommandTypes.Other; } } public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the model of others") }; } + get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the model of others"), + new CommandPerm(LevelPermission.Operator, "+ can change the model of bots") }; } } public override CommandAlias[] Aliases { get { return new[] { new CommandAlias("xmodel", "-own") }; } @@ -40,11 +41,6 @@ namespace MCGalaxy.Commands.CPE { } protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { - Player.Message(p, "Hence, you cannot the model of that bot."); - return; - } - string model = GetModel(p, args, 2); bot.model = model; Entities.UpdateModel(bot.id, model, bot.level, null); diff --git a/MCGalaxy/Commands/CPE/CmdSkin.cs b/MCGalaxy/Commands/CPE/CmdSkin.cs index 799cdd5f5..1bc6a74a7 100644 --- a/MCGalaxy/Commands/CPE/CmdSkin.cs +++ b/MCGalaxy/Commands/CPE/CmdSkin.cs @@ -25,7 +25,8 @@ namespace MCGalaxy.Commands.CPE { public override string type { get { return CommandTypes.Other; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the skin of others") }; } + get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the skin of others"), + new CommandPerm(LevelPermission.Operator, "+ can change the skin of bots") }; } } public override void Use(Player p, string message) { @@ -34,14 +35,9 @@ namespace MCGalaxy.Commands.CPE { message = message.TrimEnd(); } UseBotOrPlayer(p, message, "skin"); - } + } protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { - Player.Message(p, "Hence, you cannot the skin of that bot."); - return; - } - string skin = GetSkin(p, args, 2, bot.name); if (skin == null) return; bot.SkinName = skin; diff --git a/MCGalaxy/Commands/Chat/CmdColor.cs b/MCGalaxy/Commands/Chat/CmdColor.cs index d8b0e211c..e17362307 100644 --- a/MCGalaxy/Commands/Chat/CmdColor.cs +++ b/MCGalaxy/Commands/Chat/CmdColor.cs @@ -25,7 +25,8 @@ namespace MCGalaxy.Commands { public override string type { get { return CommandTypes.Chat; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the color of others") }; } + get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the color of others"), + new CommandPerm(LevelPermission.Operator, "+ can change the color of bots") }; } } public override CommandAlias[] Aliases { get { return new[] { new CommandAlias("colour"), new CommandAlias("xcolor", "-own") }; } @@ -33,6 +34,11 @@ namespace MCGalaxy.Commands { public override void Use(Player p, string message) { UseBotOrPlayer(p, message, "color"); } protected override void SetBotData(Player p, PlayerBot bot, string[] args) { + if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { + Player.Message(p, "Hence, you cannot change the color of that bot."); + return; + } + string color = args.Length > 2 ? Colors.Parse(args[2]) : "&1"; if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; } Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to " diff --git a/MCGalaxy/Commands/Chat/CmdNick.cs b/MCGalaxy/Commands/Chat/CmdNick.cs index 55fb1e3b5..2876b4306 100644 --- a/MCGalaxy/Commands/Chat/CmdNick.cs +++ b/MCGalaxy/Commands/Chat/CmdNick.cs @@ -26,19 +26,15 @@ namespace MCGalaxy.Commands { public override string type { get { return CommandTypes.Chat; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the nick of other players") }; } + get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can change the nick of others"), + new CommandPerm(LevelPermission.Operator, "+ can change the nick of bots") }; } } public override CommandAlias[] Aliases { get { return new[] { new CommandAlias("xnick", "-own") }; } } - public override void Use(Player p, string message) { UseBotOrPlayer(p, message, "nick"); } + public override void Use(Player p, string message) { UseBotOrPlayer(p, message, "nick"); } protected override void SetBotData(Player p, PlayerBot bot, string[] args) { - if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { - Player.Message(p, "Hence, you cannot change that bot's nickname."); - return; - } - string newName = args.Length > 2 ? args[2] : ""; if (newName == "") { bot.DisplayName = bot.name; diff --git a/MCGalaxy/Commands/EntityPropertyCmd.cs b/MCGalaxy/Commands/EntityPropertyCmd.cs index 2b322b7f8..14e0177b5 100644 --- a/MCGalaxy/Commands/EntityPropertyCmd.cs +++ b/MCGalaxy/Commands/EntityPropertyCmd.cs @@ -16,28 +16,42 @@ permissions and limitations under the Licenses. */ -namespace MCGalaxy.Commands { - public abstract class EntityPropertyCmd : Command { +namespace MCGalaxy.Commands { + public abstract class EntityPropertyCmd : Command { public override bool museumUsable { get { return true; } } protected void UseBotOrPlayer(Player p, string message, string type) { if (message == "") { Help(p); return; } - bool isBot = message.CaselessStarts("bot "); + bool isBot = message.CaselessStarts("bot "); string[] args = message.SplitSpaces(isBot ? 3 : 2); if (!CheckOwn(p, args, "player or bot name")) return; Player who = null; - PlayerBot bot = null; + PlayerBot bot = null; if (isBot) bot = PlayerBot.FindMatchesPreferLevel(p, args[1]); else who = PlayerInfo.FindMatches(p, args[0]); if (bot == null && who == null) return; - - if (p != null && who != null && who.Rank > p.Rank) { - MessageTooHighRank(p, "change the " + type + " of", true); return; + + if (isBot) { + if (!CheckExtraPerm(p, 2)) { + MessageNeedExtra(p, "change the " + type + " of bots.", 2); return; + } + + if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) { + Player.Message(p, "Hence, you cannot change the " + type + " of that bot."); + return; + } + SetBotData(p, bot, args); + } else { + if (p != who && !CheckExtraPerm(p, 1)) { + MessageNeedExtra(p, "change the " + type + " of others.", 1); return; + } + + if (p != null && who.Rank > p.Rank) { + MessageTooHighRank(p, "change the " + type + " of", true); return; + } + SetPlayerData(p, who, args); } - if ((isBot || p != who) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "change the " + type + " of others."); return; } - if (isBot) SetBotData(p, bot, args); - else SetPlayerData(p, who, args); } protected void UsePlayer(Player p, string message, string type) {