= Saving allowed roles per guild
This commit is contained in:
@@ -21,7 +21,14 @@ public class CommandChangeIndicator extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
guild.SetCommandIndicator(arg.substring(0, 1));
|
||||
String indicator = arg.substring(0, 1);
|
||||
if(indicator.charAt(0) == '\n' || indicator.charAt(0) == '\t' || indicator.charAt(0) == '\r')
|
||||
{
|
||||
res.Call(LocStrings.Lookup("ChangeIndicatorError"));
|
||||
return;
|
||||
}
|
||||
|
||||
guild.SetCommandIndicator(indicator);
|
||||
res.Call(String.format(LocStrings.Stub("ChangeIndicatorChanged"), guild.GetCommandIndicator()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CommandGuildRoleAdd extends Command
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
String role = input.args.split(" ")[0];
|
||||
if(guild.allowedRole.contains(role))
|
||||
if(guild.roleList.contains(role))
|
||||
{
|
||||
if(guild.control.addRole(user.discordID, role))
|
||||
{
|
||||
|
||||
@@ -25,13 +25,13 @@ public class CommandGuildRoleAllowed extends Command
|
||||
for(int i = 0; i < roles.length; i++)
|
||||
{
|
||||
role = roles[i].trim();
|
||||
if(guild.allowedRole.contains(role))
|
||||
if(guild.roleList.contains(role))
|
||||
{
|
||||
res.Call(LocStrings.Stub("GuildRoleAllowedDuplicate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.allowedRole.add(role);
|
||||
guild.roleList.add(role);
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleAllowedSuccess"), role));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ public class CommandGuildRoleList extends Command
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
String roles = "";
|
||||
if(guild.allowedRole.isEmpty())
|
||||
if(guild.roleList.isEmpty())
|
||||
{
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleListEmpty")));
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < guild.allowedRole.size(); i++)
|
||||
for(int i = 0; i < guild.roleList.size(); i++)
|
||||
{
|
||||
if(i > 0)
|
||||
roles += " and ";
|
||||
roles += guild.allowedRole.get(i);
|
||||
roles += guild.roleList.get(i);
|
||||
}
|
||||
res.Call(String.format(LocStrings.Stub("GuildRoleListOutput"), roles));
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public class CommandGuildRoleNotAllowed extends Command
|
||||
for(int i = 0; i < roles.length; i++)
|
||||
{
|
||||
role = roles[i].trim();
|
||||
if(guild.allowedRole.contains(role))
|
||||
if(guild.roleList.contains(role))
|
||||
{
|
||||
guild.allowedRole.remove(role);
|
||||
guild.roleList.remove(role);
|
||||
res.Call(LocStrings.Stub("GuildRoleNotAllowedSuccess"));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CommandGuildRoleRemove extends Command
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
String role = input.args.split(" ")[0];
|
||||
if(guild.allowedRole.contains(role))
|
||||
if(guild.roleList.contains(role))
|
||||
{
|
||||
if(guild.control.removeRole(user.discordID, role))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user