public override void Execute(string commandArgs) { string playerName; string reason; CommandSystemHelperMethods.SplitCommand(commandArgs, out playerName, out reason); reason = string.IsNullOrEmpty(reason) ? "No reason specified" : reason; if (!string.IsNullOrEmpty(playerName)) { var player = ClientRetriever.GetClientByName(playerName); if (player != null) { MessageQueuer.SendConnectionEnd(player, $"You were banned from the server: {reason}"); } Add(playerName); LunaLog.Normal($"Player '{playerName}' was banned from the server: {reason}"); } else { LunaLog.Normal($"Player: {playerName} not found"); } }
public override bool Execute(string commandArgs) { CommandSystemHelperMethods.SplitCommand(commandArgs, out var playerName, out var reason); reason = string.IsNullOrEmpty(reason) ? "No reason specified" : reason; if (!string.IsNullOrEmpty(playerName)) { var player = ClientRetriever.GetClientByName(playerName); if (player != null) { MessageQueuer.SendConnectionEnd(player, $"You were banned from the server: {reason}"); Add(player.UniqueIdentifier); LunaLog.Normal($"Player '{playerName}' was banned from the server: {reason}"); return(true); } else { LunaLog.Normal($"Player '{playerName}' not found"); } } else { LunaLog.Normal("Undefined function. Usage: /ban [username] [reason]"); } return(false); }
public override void Execute(string commandArgs) { string playerName; string reason; CommandSystemHelperMethods.SplitCommand(commandArgs, out playerName, out reason); reason = string.IsNullOrEmpty(reason) ? "No reason specified" : reason; if (playerName != "") { var player = ClientRetriever.GetClientByName(playerName); if (player != null) { LunaLog.Normal($"Kicking {playerName} from the server"); MessageQueuer.SendConnectionEnd(player, $"Kicked from the server: {reason}"); } else { LunaLog.Normal($"Player: {playerName} not found"); } } else { LunaLog.Error("Syntax error. Usage: /kick playername [reason]"); } }
public override void Execute(string commandArgs) { string ip; string reason; CommandSystemHelperMethods.SplitCommand(commandArgs, out ip, out reason); reason = string.IsNullOrEmpty(reason) ? "No reason specified" : reason; IPAddress ipAddress; if (IPAddress.TryParse(ip, out ipAddress)) { var player = ClientRetriever.GetClientByIp(ipAddress); if (player != null) { MessageQueuer.SendConnectionEnd(player, $"You were banned from the server: {reason}"); } Add(ipAddress.ToString()); LunaLog.Normal($"IP Address '{ip}' was banned from the server: {reason}"); } else { LunaLog.Normal($"{ip} is not a valid IP address"); } }
public override void Execute(string commandArgs) { CommandSystemHelperMethods.SplitCommand(commandArgs, out var publicKey, out var reason); reason = string.IsNullOrEmpty(reason) ? "No reason specified" : reason; var player = ClientRetriever.GetClientByPublicKey(publicKey); if (player != null) { MessageQueuer.SendConnectionEnd(player, $"You were banned from the server: {reason}"); } Add(publicKey); LunaLog.Normal($"Public key '{publicKey}' was banned from the server: {reason}"); }