Cleanup /xban.

This commit is contained in:
UnknownShadow200 2016-01-30 07:37:32 +11:00
parent 063c8794f5
commit 32e500d63f
3 changed files with 40 additions and 69 deletions

View File

@ -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];

View File

@ -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.");
}
}

View File

@ -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) {