private static bool GetCharacterStuff(ref ConsoleSystem.Arg args, out Character character, out CameraMount camera, out ItemRepresentation itemRep, out ArmorModelRenderer armor) { character = null; itemRep = null; armor = null; camera = CameraMount.current; if (!camera) { args.ReplyWith("Theres no active camera mount."); return false; } character = IDBase.GetMain(camera) as Character; if (!character) { args.ReplyWith("theres no character for the current mounted camera"); return false; } armor = character.GetLocal<ArmorModelRenderer>(); InventoryHolder local = character.GetLocal<InventoryHolder>(); if (local) { itemRep = local.itemRepresentation; } return true; }
public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments) { string displayName; string str2 = ""; for (int i = 0; i < ChatArguments.Length; i++) { str2 = str2 + ChatArguments[i] + " "; } str2 = str2.Trim(); if (str2 == "") { displayName = Arguments.argUser.displayName; } else { if (!Administrator.IsAdmin(Arguments.argUser.userID)) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Only administrators can ask for another player's location."); return; } displayName = str2; } foreach (PlayerClient client in PlayerClient.FindAllWithString(displayName)) { string strValue = string.Concat(new object[] { "Location: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z }); Arguments.ReplyWith(strValue); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Concat(new object[] { (str2 == "") ? "Your" : (displayName + "'s"), " Location Is: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z })); } }
public static void reload(ConsoleSystem.Arg arg) { if (PluginLoader.GetInstance().Plugins.ContainsKey(arg.ArgsStr)) { PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr); arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr)); } else if (arg.ArgsStr == "") { DirectoryConfig.GetInstance().Reload(); CoreConfig.GetInstance().Reload(); Config.GetInstance().Reload(); Server.GetInstance().LoadLoadouts(); if (Server.GetInstance().Loaded) Hooks.On_ServerInit(); PluginLoader.GetInstance().ReloadPlugins(); arg.ReplyWith("Pluton reloaded!"); var planes = (from plane in UnityEngine.Object.FindObjectsOfType<CargoPlane>() where plane.transform.position.x == 0f && plane.transform.position.z == 0f select plane).ToList(); planes.ForEach(p => p.SendMessage("KillMessage", UnityEngine.SendMessageOptions.DontRequireReceiver)); if (planes.Count != 0) { Pluton.Logger.LogWarning(String.Format("Destroyed {0} plane at Vector3.zero", planes.Count)); } } else { arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr)); } }
public static void kick(ConsoleSystem.Arg arg) { Player player = Player.Find(arg.ArgsStr); if (player != null) { string nameFrom; if (arg.connection != null && arg.connection.username != null) nameFrom = arg.connection.username; else nameFrom = "RCON"; player.Kick("Kicked by: " + nameFrom); Server.GetInstance().Broadcast(arg.ArgsStr + " is kicked from the server by " + nameFrom + "!"); arg.ReplyWith(arg.ArgsStr + " is kicked!"); } else { arg.ReplyWith("Couldn't find player: " + arg.ArgsStr); } }
public static void login(ConsoleSystem.Arg arg) { if (arg.connection != null && arg.ArgsStr == rcon.password) { ServerUsers.Set(arg.connection.userid, ServerUsers.UserGroup.Moderator, arg.connection.username, "Console login!"); ServerUsers.Save(); arg.ReplyWith("You are a moderator now!"); } }
public static void time(ref ConsoleSystem.Arg arg) { if (!EnvironmentControlCenter.Singleton) { return; } float time = EnvironmentControlCenter.Singleton.GetTime(); arg.ReplyWith(string.Concat("Current Time: ", time.ToString())); }
public static void save(ref ConsoleSystem.Arg arg) { if (!Directory.Exists("cfg")) { Directory.CreateDirectory("cfg"); } File.WriteAllText(config.ConfigName(), ConsoleSystem.SaveToConfigString()); arg.ReplyWith("Saved config.cfg"); }
public static void Loaded(ConsoleSystem.Arg args) { int count = PluginLoader.GetInstance().Plugins.Count; string result = String.Format("Loaded plugins({0}):" + Environment.NewLine, count); foreach (BasePlugin plugin in PluginLoader.GetInstance().Plugins.Values) { result += String.Format(" {0, -22} [{1, -10}], timers: {2, 8}, parallel: {3, 8}\r\n", plugin.Name, plugin.Type, plugin.Timers.Count + plugin.ParallelTimers.Count, plugin.ParallelTimers.Count); result += String.Format("Author: {0}, about: {1}, version: {2}" + Environment.NewLine + Environment.NewLine, plugin.Author, plugin.About, plugin.Version); } args.ReplyWith(result); }
public static void load(ref ConsoleSystem.Arg arg) { string str = config.ConfigName(); string str1 = "\r\necho default config\r\ninput.bind Left A None\r\ninput.bind Right D None\r\ninput.bind Up W None\r\ninput.bind Down S None\r\ninput.bind Jump Space None\r\ninput.bind Duck LeftControl None\r\ninput.bind Sprint LeftShift None\r\ninput.bind Fire Mouse0 None\r\ninput.bind AltFire Mouse1 None\r\ninput.bind Reload R None\r\ninput.bind Use E None\r\ninput.bind Inventory Tab None\r\ninput.bind Flashlight F None\r\ninput.bind Laser G None\r\ninput.bind Voice V None\r\ninput.bind Chat Return T\r\nrender.update\r\n"; if (File.Exists(str)) { str1 = File.ReadAllText(str); } ConsoleSystem.RunFile(str1); arg.ReplyWith(string.Concat("Loaded ", str)); }
public static void Hooks(ConsoleSystem.Arg args) { Dictionary<string, List<string>> hooks = new Dictionary<string, List<string>>(); PluginLoader.GetInstance().Plugins.Values.ToList().ForEach( p => p.Globals.ToList().ForEach( g => { if (g.StartsWith("On_")) AddPluginToHookListInDict(hooks, g, p.Name); })); string result = "The registered hooks are:" + Environment.NewLine; hooks.Keys.ToList().ForEach(k => { result += k + ": " + String.Join(", ", hooks[k].ToArray()) + Environment.NewLine; }); args.ReplyWith(result); }
private void CmdShow(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs()) { ReplyWith(arg.connection, "CommandUsageShow"); return; } var mode = arg.GetString(0); var name = arg.GetString(1); if (mode.Equals("perms")) { var result = "Permissions:\n"; result += string.Join(", ", permission.GetPermissions()); arg.ReplyWith(result); } else if (mode.Equals("user")) { var player = FindPlayer(name); if (player == null && !permission.UserExists(name)) { ReplyWith(arg.connection, "UserNotFound"); return; } var userId = name; if (player != null) { userId = player.userID.ToString(); name = player.displayName; permission.UpdateNickname(userId, name); name += $" ({userId})"; } var result = "User '" + name + "' permissions:\n"; result += string.Join(", ", permission.GetUserPermissions(userId)); result += "\nUser '" + name + "' groups:\n"; result += string.Join(", ", permission.GetUserGroups(userId)); arg.ReplyWith(result); } else if (mode.Equals("group")) { if (!permission.GroupExists(name)) { ReplyWith(arg.connection, "GroupNotFound", name); return; } var result = "Group '" + name + "' users:\n"; result += string.Join(", ", permission.GetUsersInGroup(name)); result += "\nGroup '" + name + "' permissions:\n"; result += string.Join(", ", permission.GetGroupPermissions(name)); var parent = permission.GetGroupParent(name); while (permission.GroupExists(parent)) { result = "\nParent group '" + parent + "' permissions:\n"; result += string.Join(", ", permission.GetGroupPermissions(parent)); parent = permission.GetGroupParent(parent); } arg.ReplyWith(result); } else if (mode.Equals("groups")) { var result = "Groups:\n"; result += string.Join(", ", permission.GetGroups()); arg.ReplyWith(result); } }
private void CmdPlugins(ConsoleSystem.Arg arg) { if (!IsAdmin(arg)) return; var loaded_plugins = pluginmanager.GetPlugins().Where(pl => !pl.IsCorePlugin).ToArray(); var loaded_plugin_names = new HashSet<string>(loaded_plugins.Select(pl => pl.Name)); var unloaded_plugin_errors = new Dictionary<string, string>(); foreach (var loader in Interface.Oxide.GetPluginLoaders()) { foreach (var name in loader.ScanDirectory(Interface.Oxide.PluginDirectory).Except(loaded_plugin_names)) { string msg; unloaded_plugin_errors[name] = (loader.PluginErrors.TryGetValue(name, out msg)) ? msg : "Unloaded"; } } var total_plugin_count = loaded_plugins.Length + unloaded_plugin_errors.Count; if (total_plugin_count < 1) { ReplyWith(arg.connection, "NoPluginsFound"); return; } var output = $"Listing {loaded_plugins.Length + unloaded_plugin_errors.Count} plugins:"; var number = 1; foreach (var plugin in loaded_plugins) output += $"\n {number++:00} \"{plugin.Title}\" ({plugin.Version}) by {plugin.Author} ({plugin.TotalHookTime:0.00}s)"; foreach (var plugin_name in unloaded_plugin_errors.Keys) output += $"\n {number++:00} {plugin_name} - {unloaded_plugin_errors[plugin_name]}"; arg.ReplyWith(output); }
private void cmdVersion(ConsoleSystem.Arg arg) { // Get the Rust network protocol version at runtime var protocol = typeof(Protocol).GetField("network").GetValue(null).ToString(); // Get the Oxide Core version var oxide = OxideMod.Version.ToString(); // Show the versions if (!string.IsNullOrEmpty(protocol) && !string.IsNullOrEmpty(oxide)) { arg.ReplyWith("Oxide Version: " + oxide + ", Rust Protocol: " + protocol); } }
public static void status(ConsoleSystem.Arg arg) { UnityEngine.Debug.Log(CountedInstance.InstanceReportText()); arg.ReplyWith("Finished report!"); }
public static void find(ref ConsoleSystem.Arg arg) { string str; if (!arg.HasArgs(1)) { return; } string args = arg.Args[0]; string empty = string.Empty; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < (int)assemblies.Length; i++) { Type[] types = assemblies[i].GetTypes(); for (int j = 0; j < (int)types.Length; j++) { if (types[j].IsSubclassOf(typeof(ConsoleSystem))) { MethodInfo[] methods = types[j].GetMethods(); for (int k = 0; k < (int)methods.Length; k++) { if (methods[k].IsStatic) { if (!(args != "*") || types[j].Name.Contains(args) || methods[k].Name.Contains(args)) { if (arg.CheckPermissions(methods[k].GetCustomAttributes(true))) { str = empty; empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildMethodString(ref methods[k]), "\n" }); } } } } FieldInfo[] fields = types[j].GetFields(); for (int l = 0; l < (int)fields.Length; l++) { if (fields[l].IsStatic) { if (!(args != "*") || types[j].Name.Contains(args) || fields[l].Name.Contains(args)) { if (arg.CheckPermissions(fields[l].GetCustomAttributes(true))) { str = empty; empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildFieldsString(ref fields[l]), "\n" }); } } } } PropertyInfo[] properties = types[j].GetProperties(); for (int m = 0; m < (int)properties.Length; m++) { if (!(args != "*") || types[j].Name.Contains(args) || properties[m].Name.Contains(args)) { if (arg.CheckPermissions(properties[m].GetCustomAttributes(true))) { str = empty; empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildPropertyString(ref properties[m]), "\n" }); } } } } } } arg.ReplyWith(string.Concat("Finding ", args, ":\n", empty)); }
private void cmdUserGroup(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs(3)) { arg.ReplyWith("Usage: usergroup <add|remove> <username> <groupname>"); return; } var mode = arg.GetString(0); var name = arg.GetString(1); var group = arg.GetString(2); var player = FindPlayer(name); if (player == null && !permission.UserExists(name)) { arg.ReplyWith("User '" + name + "' not found"); return; } var userId = name; if (player != null) { userId = player.userID.ToString(); name = player.displayName; permission.UpdateNickname(userId, name); } if (!permission.GroupExists(group)) { arg.ReplyWith("Group '" + group + "' doesn't exist"); return; } if (mode.Equals("add")) { permission.AddUserGroup(userId, group); if (player != null) { arg.ReplyWith("User '" + player.displayName + "' assigned group: " + @group); } } else if (mode.Equals("remove")) { permission.RemoveUserGroup(userId, group); if (player != null) { arg.ReplyWith("User '" + player.displayName + "' removed from group: " + @group); } } }
private void cmdGroup(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs(2)) { var reply = "Syntax: group <add|set> <name> [title] [rank]"; reply += "Syntax: group <remove> <name>\n"; reply += "Syntax: group <parent> <name> <parentName>"; arg.ReplyWith(reply); return; } var mode = arg.GetString(0); var name = arg.GetString(1); var title = arg.GetString(2); var rank = arg.GetInt(3); if (mode.Equals("add")) { if (permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' already exist"); return; } permission.CreateGroup(name, title, rank); arg.ReplyWith("Group '" + name + "' created"); } else if (mode.Equals("remove")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } permission.RemoveGroup(name); arg.ReplyWith("Group '" + name + "' deleted"); } else if (mode.Equals("set")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } permission.SetGroupTitle(name, title); permission.SetGroupRank(name, rank); arg.ReplyWith("Group '" + name + "' changed"); } }
private void cmdVersion(ConsoleSystem.Arg arg) { var oxide = OxideMod.Version.ToString(); var rust = Rust.Defines.Connection.protocol.ToString(); if (!string.IsNullOrEmpty(oxide) && !string.IsNullOrEmpty(rust)) arg.ReplyWith($"Oxide version: {oxide}, Rust Protocol: {rust}"); }
private void cmdReload(ConsoleSystem.Arg arg) { if (arg.argUser != null && !arg.argUser.admin) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs()) { arg.ReplyWith("Usage: reload *|<pluginname>+"); return; } if (arg.GetString(0).Equals("*")) { Interface.Oxide.ReloadAllPlugins(); return; } foreach (var name in arg.Args) if (!string.IsNullOrEmpty(name)) Interface.Oxide.ReloadPlugin(name); }
private void cmdPlugins(ConsoleSystem.Arg arg) { if (!IsAdmin(arg)) return; var loaded_plugins = pluginmanager.GetPlugins().Where(pl => !pl.IsCorePlugin).ToArray(); var loaded_plugin_names = new HashSet<string>(loaded_plugins.Select(pl => pl.Name)); var unloaded_plugin_errors = new Dictionary<string, string>(); foreach (var loader in Interface.Oxide.GetPluginLoaders()) { foreach (var name in loader.ScanDirectory(Interface.Oxide.PluginDirectory).Except(loaded_plugin_names)) { string msg; unloaded_plugin_errors[name] = (loader.PluginErrors.TryGetValue(name, out msg)) ? msg : "Unloaded"; } } var total_plugin_count = loaded_plugins.Length + unloaded_plugin_errors.Count; if (total_plugin_count < 1) { arg.ReplyWith("[Oxide] No plugins are currently available"); return; } var output = $"[Oxide] Listing {loaded_plugins.Length + unloaded_plugin_errors.Count} plugins:"; var number = 1; output = loaded_plugins.Aggregate(output, (current, plugin) => current + $"\n {number++:00} \"{plugin.Title}\" ({plugin.Version}) by {plugin.Author}"); output = unloaded_plugin_errors.Keys.Aggregate(output, (current, plugin_name) => current + $"\n {number++:00} {plugin_name} - {unloaded_plugin_errors[plugin_name]}"); arg.ReplyWith(output); }
/// <summary> /// Check if player is admin /// </summary> /// <returns></returns> private static bool IsAdmin(ConsoleSystem.Arg arg) { if (arg.argUser == null || arg.argUser.CanAdmin()) return true; arg.ReplyWith("You are not an admin."); return false; }
private object OnRunCommand(ConsoleSystem.Arg arg) { if (arg?.cmd == null) return null; if (arg.cmd.namefull != "chat.say") return null; if (arg.connection != null) { if (arg.Player() == null) return true; var rustCovalence = Libraries.Covalence.RustCovalenceProvider.Instance; var livePlayer = rustCovalence.PlayerManager.GetOnlinePlayer(arg.connection.userid.ToString()); if (rustCovalence.CommandSystem.HandleChatMessage(livePlayer, arg.GetString(0))) return true; } // Get the args var str = arg.GetString(0, "text"); if (str.Length == 0) return null; // Is it a chat command? if (str[0] == '/' || str[0] == '!') { // Get the message var message = str.Substring(1); // Parse it string cmd; string[] args; ParseChatCommand(message, out cmd, out args); if (cmd == null) return null; // Handle it var player = arg.connection.player as BasePlayer; if (player == null) Interface.Oxide.LogDebug("Player is actually a {0}!", arg.connection.player.GetType()); else if (!cmdlib.HandleChatCommand(player, cmd, args)) ReplyWith(player.net.connection, "UnknownCommand", cmd); // Handled arg.ReplyWith(string.Empty); return true; } // Default behavior return null; }
public static void saveall(ConsoleSystem.Arg arg) { Bootstrap.SaveAll(); arg.ReplyWith("Everything saved!"); }
private void cmdGroup(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (arg.Player() != null && !arg.Player().IsAdmin()) return; // Check 2 args exists if (!arg.HasArgs(2)) { var reply = "Syntax: oxide.group <add|set> <name> [title] [rank]\n"; reply += "Syntax: oxide.group <remove|show> <name>\n"; reply += "Syntax: oxide.group <parent> <name> <parentName>"; arg.ReplyWith(reply); return; } var mode = arg.GetString(0); var name = arg.GetString(1); if (mode.Equals("add")) { if (permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' already exist"); return; } permission.CreateGroup(name, arg.GetString(2), arg.GetInt(3)); arg.ReplyWith("Group '" + name + "' created"); } else if (mode.Equals("remove")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } permission.RemoveGroup(name); arg.ReplyWith("Group '" + name + "' deleted"); } else if (mode.Equals("set")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } permission.SetGroupTitle(name, arg.GetString(2)); permission.SetGroupRank(name, arg.GetInt(3)); arg.ReplyWith("Group '" + name + "' changed"); } else if (mode.Equals("parent")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } var parent = arg.GetString(2); if (!string.IsNullOrEmpty(parent) && !permission.GroupExists(parent)) { arg.ReplyWith("Parent group '" + parent + "' doesn't exist"); return; } if (permission.SetGroupParent(name, parent)) arg.ReplyWith("Group '" + name + "' changed"); else arg.ReplyWith("Group '" + name + "' failed to change"); } else if (mode.Equals("show")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } var result = "Group '" + name + "' permissions:\n"; result += string.Join(",", permission.GetGroupPermissions(name)); arg.ReplyWith(result); } }
private object OnRunCommand(ConsoleSystem.Arg arg, bool wantreply) { // Sanity checks if (arg == null) return null; string cmd = $"{arg.Class}.{arg.Function}"; // Is it chat.say? if (cmd == "chat.say") { // Get the args var str = arg.GetString(0); if (str.Length == 0) return true; // Is it a chat command? if (str[0] == '/' || str[0] == '!') { // Get the arg string var argstr = str.Substring(1); if (str.Length == 1) return true; // Parse it string chatcmd; string[] args; ParseChatCommand(argstr, out chatcmd, out args); if (chatcmd == null) return null; // Handle it var ply = arg.argUser; if (ply != null && !cmdlib.HandleChatCommand(ply, chatcmd, args)) { ConsoleNetworker.SendClientCommand(ply.networkPlayer, $"chat.add \"Server\" \" Unknown command {chatcmd}\""); return true; } // Handled arg.ReplyWith(string.Empty); return true; } return Interface.CallHook("OnPlayerChat", arg.argUser, str); } return cmdlib.HandleConsoleCommand(arg, wantreply); }
/// <summary> /// Checks if the permission system has loaded, shows an error if it failed to load /// </summary> /// <returns></returns> private bool PermissionsLoaded(ConsoleSystem.Arg arg) { if (permission.IsLoaded) return true; arg.ReplyWith("Unable to load permission files! Permissions will not work until resolved.\r\n => " + permission.LastException.Message); return false; }
private void cmdRevoke(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs(3)) { arg.ReplyWith("Usage: revoke <group|user> <name|id> <permission>"); return; } var mode = arg.GetString(0); var name = arg.GetString(1); var perm = arg.GetString(2); if (mode.Equals("group")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } permission.RevokeGroupPermission(name, perm); arg.ReplyWith("Group '" + name + "' revoked permission: " + perm); } else if (mode.Equals("user")) { var player = FindPlayer(name); if (player == null && !permission.UserExists(name)) { arg.ReplyWith("User '" + name + "' not found"); return; } var userId = name; if (player != null) { userId = player.userID.ToString(); name = player.displayName; permission.UpdateNickname(userId, name); } permission.RevokeUserPermission(userId, perm); arg.ReplyWith("User '" + name + "' revoked permission: " + perm); } }
private void cmdUnload(ConsoleSystem.Arg arg) { if (arg.Player() != null && !arg.Player().IsAdmin()) return; // Check arg 1 exists if (!arg.HasArgs()) { arg.ReplyWith("Syntax: oxide.unload *|<pluginname>+"); return; } if (arg.GetString(0).Equals("*")) { Interface.Oxide.UnloadAllPlugins(); return; } foreach (var name in arg.Args) { if (string.IsNullOrEmpty(name)) continue; // Unload Interface.Oxide.UnloadPlugin(name); } }
public static void echo(ref ConsoleSystem.Arg arg) { arg.ReplyWith(arg.ArgsStr); }
private void cmdShow(ConsoleSystem.Arg arg) { if (!PermissionsLoaded(arg)) return; if (!IsAdmin(arg)) return; if (!arg.HasArgs()) { var reply = "Syntax: show <group|user> <name>\n"; reply += "Syntax: show <groups|perms>"; arg.ReplyWith(reply); return; } var mode = arg.GetString(0); var name = arg.GetString(1); if (mode.Equals("perms")) { var result = "Permissions:\n"; result += string.Join(", ", permission.GetPermissions()); arg.ReplyWith(result); } else if (mode.Equals("user")) { var player = FindPlayer(name); if (player == null && !permission.UserExists(name)) { arg.ReplyWith("User '" + name + "' not found"); return; } var userId = name; if (player != null) { userId = player.userID.ToString(); name = player.displayName; permission.UpdateNickname(userId, name); name += $"({userId})"; } var result = "User '" + name + "' permissions:\n"; result += string.Join(", ", permission.GetUserPermissions(userId)); result += "\nUser '" + name + "' groups:\n"; result += string.Join(", ", permission.GetUserGroups(userId)); arg.ReplyWith(result); } else if (mode.Equals("group")) { if (!permission.GroupExists(name)) { arg.ReplyWith("Group '" + name + "' doesn't exist"); return; } var result = "Group '" + name + "' users:\n"; result += string.Join(", ", permission.GetUsersInGroup(name)); result += "\nGroup '" + name + "' permissions:\n"; result += string.Join(", ", permission.GetGroupPermissions(name)); var parent = permission.GetGroupParent(name); while (permission.GroupExists(parent)) { result = "\nParent group '" + parent + "' permissions:\n"; result += string.Join(", ", permission.GetGroupPermissions(parent)); parent = permission.GetGroupParent(name); } arg.ReplyWith(result); } else if (mode.Equals("groups")) { var result = "Groups:\n"; result += string.Join(", ", permission.GetGroups()); arg.ReplyWith(result); } }