Fix /clones from console

This commit is contained in:
UnknownShadow200 2018-07-11 11:56:07 +10:00
parent 87bdd2cb32
commit 1cd23d6c12
5 changed files with 6 additions and 5 deletions

View File

@ -30,7 +30,8 @@ namespace MCGalaxy.Commands.Info {
} }
public override void Use(Player p, string message, CommandData data) { public override void Use(Player p, string message, CommandData data) {
if (message.Length == 0 && p != null) { if (message.Length == 0) {
if (p.IsSuper) { SuperRequiresArgs(p, "IP address"); return; }
message = p.ip; message = p.ip;
} else { } else {
message = ModActionCmd.FindIP(p, message, "find alts of", "clones"); message = ModActionCmd.FindIP(p, message, "find alts of", "clones");

View File

@ -39,7 +39,7 @@ namespace MCGalaxy.Commands.Moderation {
IPAddress ip; IPAddress ip;
if (!IPAddress.TryParse(args[0], out ip)) { p.Message("\"{0}\" is not a valid IP.", args[0]); return; } if (!IPAddress.TryParse(args[0], out ip)) { p.Message("\"{0}\" is not a valid IP.", args[0]); return; }
if (IPAddress.IsLoopback(ip)) { p.Message("You cannot IP ban the server."); return; } if (IPAddress.IsLoopback(ip)) { p.Message("You cannot IP ban the server."); return; }
if (p != null && p.ip == args[0]) { p.Message("You cannot IP ban yourself."); return; } if (p.ip == args[0]) { p.Message("You cannot IP ban yourself."); return; }
if (Server.bannedIP.Contains(args[0])) { p.Message("{0} is already IP banned.", args[0]); return; } if (Server.bannedIP.Contains(args[0])) { p.Message("{0} is already IP banned.", args[0]); return; }
// Check if IP is shared by any other higher ranked accounts // Check if IP is shared by any other higher ranked accounts
if (!CheckIP(p, args[0])) return; if (!CheckIP(p, args[0])) return;

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Moderation {
IPAddress ip; IPAddress ip;
if (!IPAddress.TryParse(args[0], out ip)) { p.Message("\"{0}\" is not a valid IP.", args[0]); return; } if (!IPAddress.TryParse(args[0], out ip)) { p.Message("\"{0}\" is not a valid IP.", args[0]); return; }
if (p != null && p.ip == args[0]) { p.Message("You cannot un-IP ban yourself."); return; } if (p.ip == args[0]) { p.Message("You cannot un-IP ban yourself."); return; }
if (!Server.bannedIP.Contains(args[0])) { p.Message(args[0] + " is not a banned IP."); return; } if (!Server.bannedIP.Contains(args[0])) { p.Message(args[0] + " is not a banned IP."); return; }
string reason = args.Length > 1 ? args[1] : ""; string reason = args.Length > 1 ? args[1] : "";

View File

@ -239,7 +239,7 @@ namespace MCGalaxy.Games {
Command.Find("Take").Use(Player.Console, p.name + " 10 Auto fine for pillaring"); Command.Find("Take").Use(Player.Console, p.name + " 10 Auto fine for pillaring");
p.Message(" %WThe next time you pillar, you will be &4kicked!"); p.Message(" %WThe next time you pillar, you will be &4kicked!");
} else { } else {
ModAction action = new ModAction(p.name, null, ModActionType.Kicked, "Auto kick for pillaring"); ModAction action = new ModAction(p.name, Player.Console, ModActionType.Kicked, "Auto kick for pillaring");
OnModActionEvent.Call(action); OnModActionEvent.Call(action);
p.Kick("No pillaring allowed!"); p.Kick("No pillaring allowed!");
} }

View File

@ -56,7 +56,7 @@ namespace MCGalaxy.Tasks {
internal static void FreezeCalcNextRun() { CalcNextRun(freezeTask, Server.frozen); } internal static void FreezeCalcNextRun() { CalcNextRun(freezeTask, Server.frozen); }
static void FreezeCallback(string[] args) { static void FreezeCallback(string[] args) {
ModAction action = new ModAction(args[0], null, ModActionType.Unfrozen, "auto unfreeze"); ModAction action = new ModAction(args[0], Player.Console, ModActionType.Unfrozen, "auto unfreeze");
OnModActionEvent.Call(action); OnModActionEvent.Call(action);
} }