public void Excecute(IRocketPlayer caller, string[] args) { if (args.Length != 2 && args.Length != 3) { LoonePermissions.Say(caller, "invalid_args", Color.red); return; } if (!MySqlManager.GroupExists(args[0].ToLower())) { LoonePermissions.Say(caller, "group_not_exists", Color.red); return; } string groupId = args[0].ToLower(); string perm = args[1].ToLower(); bool doModify; int oldCooldown = MySqlManager.GetPermission(perm, groupId); doModify = oldCooldown != -1; int cooldown; if (args.Length == 3) { if (!int.TryParse(args[2], out cooldown)) { LoonePermissions.Say(caller, "invalid_args", Color.red); return; } } else { cooldown = 0; } if (doModify) { if (oldCooldown == cooldown) { LoonePermissions.Say(caller, "perm_exists", Color.red); return; } else { MySqlManager.ModifyPermsission(groupId, perm, cooldown); LoonePermissions.Say(caller, "perm_modified", Color.green, perm, groupId, cooldown); RocketLogger.Log(string.Format("{0} has set the cooldown of {1} to {2} in {3}!", caller.DisplayName, perm, cooldown, groupId), ConsoleColor.Yellow); } } else { MySqlManager.AddPermission(groupId, perm, cooldown); LoonePermissions.Say(caller, "perm_added", Color.green, perm, groupId, cooldown); RocketLogger.Log(string.Format("{0} added the permission {1} with a cooldown of {2} to {3}!", caller.DisplayName, perm, cooldown, groupId), ConsoleColor.Yellow); } }