mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 23:43:45 -04:00
Cleanup /xban.
This commit is contained in:
parent
063c8794f5
commit
32e500d63f
@ -63,14 +63,14 @@ namespace MCGalaxy.Commands {
|
|||||||
char code2 = code;
|
char code2 = code;
|
||||||
if (Colors.MapColor(ref code2)) {
|
if (Colors.MapColor(ref code2)) {
|
||||||
Player.SendMessage(p, "There is already a custom or server defined color with the code " + code +
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string name = args[2];
|
string name = args[2];
|
||||||
if (Colors.Parse(name) != "") {
|
if (Colors.Parse(name) != "") {
|
||||||
Player.SendMessage(p, "There is already an existing standard or " +
|
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];
|
char fallback = args[3][0];
|
||||||
|
@ -1,69 +1,44 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2011 MCGalaxy
|
Copyright 2011 MCGalaxy
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
not use this file except in compliance with the Licenses. You may
|
not use this file except in compliance with the Licenses. You may
|
||||||
obtain a copy of the Licenses at
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
http://www.opensource.org/licenses/ecl2.php
|
http://www.opensource.org/licenses/ecl2.php
|
||||||
http://www.gnu.org/licenses/gpl-3.0.html
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the Licenses are distributed on an "AS IS"
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands {
|
||||||
{
|
|
||||||
public sealed class CmdXban : Command
|
public sealed class CmdXban : Command {
|
||||||
{
|
|
||||||
public override string name { get { return "xban"; } }
|
public override string name { get { return "xban"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
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 bool museumUsable { get { return false; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public CmdXban() { }
|
public CmdXban() { }
|
||||||
public override void Use(Player p, string message)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public override void Use(Player p, string message) {
|
||||||
if (message == "") { Help(p); return; }
|
if (message == "") { Help(p); return; }
|
||||||
|
|
||||||
Player who = Player.Find(message.Split(' ')[0]);
|
string name = message.Split(' ')[0];
|
||||||
string msg = message.Split(' ')[0];
|
Player who = Player.Find(name);
|
||||||
if (p != null)
|
Command.all.Find("ban").Use(p, message);
|
||||||
{
|
Command.all.Find("banip").Use(p, "@" + name);
|
||||||
p.ignorePermission = true;
|
if (who != null)
|
||||||
}
|
Command.all.Find("kick").Use(p, message);
|
||||||
try
|
Command.all.Find("xundo").Use(p, name);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.");
|
Player.SendMessage(p, "/xban [name] [message]- Bans, banips, undoes, and kicks [name] with [message], if specified.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System.IO;
|
using System.IO;
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands {
|
||||||
{
|
|
||||||
public sealed class CmdReload : Command
|
public sealed class CmdReload : Command {
|
||||||
{
|
|
||||||
public override string name { get { return "reload"; } }
|
public override string name { get { return "reload"; } }
|
||||||
public override string shortcut { get { return "rd"; } }
|
public override string shortcut { get { return "rd"; } }
|
||||||
public override string type { get { return CommandTypes.World; } }
|
public override string type { get { return CommandTypes.World; } }
|
||||||
@ -27,21 +27,17 @@ namespace MCGalaxy.Commands
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public CmdReload() { }
|
public CmdReload() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message)
|
public override void Use(Player p, string message) {
|
||||||
{
|
|
||||||
if (p == null && message == "") {
|
if (p == null && message == "") {
|
||||||
Player.SendMessage(p, "You must give a level name when running the command from console.");
|
Player.SendMessage(p, "You must give a level name when running the command from console."); return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string name = message == "" ? p.level.name : message;
|
string name = message == "" ? p.level.name : message;
|
||||||
if (!File.Exists("levels/" + name + ".lvl")) {
|
if (!File.Exists("levels/" + name + ".lvl")) {
|
||||||
Player.SendMessage(p, "The given level \"" + name + "\" does not exist.");
|
Player.SendMessage(p, "The given level \"" + name + "\" does not exist."); return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (Server.mainLevel.name == name) {
|
if (Server.mainLevel.name == name) {
|
||||||
Player.SendMessage(p, "You cannot reload the main level.");
|
Player.SendMessage(p, "You cannot reload the main level."); return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Player pl in Player.players) {
|
foreach (Player pl in Player.players) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user