From 32e500d63fd74522da61b9ca08a606a5384cdb42 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 30 Jan 2016 07:37:32 +1100 Subject: [PATCH] Cleanup /xban. --- Commands/CPE/CmdCustomColors.cs | 4 +- Commands/Moderation/CmdXban.cs | 85 ++++++++++++--------------------- Commands/World/CmdReload.cs | 20 ++++---- 3 files changed, 40 insertions(+), 69 deletions(-) diff --git a/Commands/CPE/CmdCustomColors.cs b/Commands/CPE/CmdCustomColors.cs index dec23177e..576682d93 100644 --- a/Commands/CPE/CmdCustomColors.cs +++ b/Commands/CPE/CmdCustomColors.cs @@ -63,14 +63,14 @@ namespace MCGalaxy.Commands { char code2 = code; if (Colors.MapColor(ref code2)) { Player.SendMessage(p, "There is already a custom or server defined color with the code " + code + - ", you must either use a different code or use \"/ccols remove " + code + "\""); + ", you must either use a different code or use \"%T/ccols remove " + code + "%S\""); return; } string name = args[2]; if (Colors.Parse(name) != "") { Player.SendMessage(p, "There is already an existing standard or " + - "custom color with the name\"" + name + "\"."); return; + "custom color with the name \"" + name + "\"."); return; } char fallback = args[3][0]; diff --git a/Commands/Moderation/CmdXban.cs b/Commands/Moderation/CmdXban.cs index dd110528d..02ad06773 100644 --- a/Commands/Moderation/CmdXban.cs +++ b/Commands/Moderation/CmdXban.cs @@ -1,69 +1,44 @@ /* - Copyright 2011 MCGalaxy - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. + Copyright 2011 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. */ -namespace MCGalaxy.Commands -{ - public sealed class CmdXban : Command - { +namespace MCGalaxy.Commands { + + public sealed class CmdXban : Command { + public override string name { get { return "xban"; } } public override string shortcut { get { return ""; } } - public override string type { get { return CommandTypes.Moderation; } } + public override string type { get { return CommandTypes.Moderation; } } public override bool museumUsable { get { return false; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public CmdXban() { } - public override void Use(Player p, string message) - { - + + public override void Use(Player p, string message) { if (message == "") { Help(p); return; } - Player who = Player.Find(message.Split(' ')[0]); - string msg = message.Split(' ')[0]; - if (p != null) - { - p.ignorePermission = true; - } - try - { - if (who != null) - { - Command.all.Find("xundo").Use(p, msg); - Command.all.Find("ban").Use(p, msg); - Command.all.Find("banip").Use(p, "@" + msg); - Command.all.Find("kick").Use(p, message); - Command.all.Find("xundo").Use(p, msg); - - } - else - { - Command.all.Find("ban").Use(p, msg); - Command.all.Find("banip").Use(p, "@" + msg); - Command.all.Find("xundo").Use(p, msg); - } - - } - finally - { - if (p != null) p.ignorePermission = false; - } + string name = message.Split(' ')[0]; + Player who = Player.Find(name); + Command.all.Find("ban").Use(p, message); + Command.all.Find("banip").Use(p, "@" + name); + if (who != null) + Command.all.Find("kick").Use(p, message); + Command.all.Find("xundo").Use(p, name); } - - public override void Help(Player p) - { + public override void Help(Player p) { Player.SendMessage(p, "/xban [name] [message]- Bans, banips, undoes, and kicks [name] with [message], if specified."); } } diff --git a/Commands/World/CmdReload.cs b/Commands/World/CmdReload.cs index b11776e78..26223c51c 100644 --- a/Commands/World/CmdReload.cs +++ b/Commands/World/CmdReload.cs @@ -16,10 +16,10 @@ permissions and limitations under the Licenses. */ using System.IO; -namespace MCGalaxy.Commands -{ - public sealed class CmdReload : Command - { +namespace MCGalaxy.Commands { + + public sealed class CmdReload : Command { + public override string name { get { return "reload"; } } public override string shortcut { get { return "rd"; } } public override string type { get { return CommandTypes.World; } } @@ -27,21 +27,17 @@ namespace MCGalaxy.Commands public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public CmdReload() { } - public override void Use(Player p, string message) - { + public override void Use(Player p, string message) { if (p == null && message == "") { - Player.SendMessage(p, "You must give a level name when running the command from console."); - return; + Player.SendMessage(p, "You must give a level name when running the command from console."); return; } string name = message == "" ? p.level.name : message; if (!File.Exists("levels/" + name + ".lvl")) { - Player.SendMessage(p, "The given level \"" + name + "\" does not exist."); - return; + Player.SendMessage(p, "The given level \"" + name + "\" does not exist."); return; } if (Server.mainLevel.name == name) { - Player.SendMessage(p, "You cannot reload the main level."); - return; + Player.SendMessage(p, "You cannot reload the main level."); return; } foreach (Player pl in Player.players) {