=Added array input to AllowedGuildRole

Users can now enter in multiple roles by separating them with a comma in the command
This commit is contained in:
Alex Stewart
2019-04-15 14:57:11 -07:00
parent 9f4aac3e21
commit 469fe0922e
2 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ WolframInfo=Will query wolframalpha with your question and give a full image out
WolframNoArgs=You need to provide some arguments! WolframNoArgs=You need to provide some arguments!
[CommandAddGuildRole] [CommandAddGuildRole]
AddGuildRoleInfo= AddGuildRoleInfo=Add a role to yourself!
AddGuildRoleNotAllowed=You are not allowed to add %s! AddGuildRoleNotAllowed=You are not allowed to add %s!
AddGuildRoleSuccess=Added %s to %s AddGuildRoleSuccess=Added %s to %s
AddGuildRoleFailure=Failed to add %s to %s AddGuildRoleFailure=Failed to add %s to %s
+6 -1
View File
@@ -20,7 +20,11 @@ public class CommandAllowedGuildRole extends Command
@Override @Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{ {
String role = input.args.split(" ")[0]; String [] roles = input.args.split(",");
String role;
for(int i = 0; i < roles.length; i++)
{
role = roles[i].trim();
if(guild.allowedRole.contains(role)) if(guild.allowedRole.contains(role))
{ {
res.Call(LocStrings.Stub("AllowedGuildRoleDuplicate")); res.Call(LocStrings.Stub("AllowedGuildRoleDuplicate"));
@@ -32,3 +36,4 @@ public class CommandAllowedGuildRole extends Command
} }
} }
} }
}