Merge remote-tracking branch 'origin/develop' into feature/collapsed_configs

This commit is contained in:
Matthew Cech
2019-06-30 00:36:37 -07:00
15 changed files with 88 additions and 61 deletions
@@ -0,0 +1,28 @@
package commands.characters;
import core.CharacterManager;
import core.LocStrings;
import core.SubCommand;
import core.SubCommandFormattable;
import dataStructures.*;
public class CommandCharacterCreate extends SubCommand
{
public CommandCharacterCreate(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
{
String [] info = input.split(",");
if(info.length < 3)
{
return new SubCommandFormattable (LocStrings.stub("CharacterCreateNullInfo"));
}
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
{
return new SubCommandFormattable (LocStrings.stub("CharacterCreateSuccess"));
}
return new SubCommandFormattable (LocStrings.stub("CharacterCreateDuplicate"));
}
}
@@ -1,4 +1,4 @@
package commands.general;
package commands.characters;
import core.CharacterManager;
import core.Command;
@@ -1,4 +1,4 @@
package commands.general;
package commands.characters;
import core.CharacterManager;
import core.Command;
@@ -1,4 +1,4 @@
package commands.general;
package commands.characters;
import core.CharacterManager;
import core.Command;
@@ -0,0 +1,33 @@
package commands.characters;
import core.Command;
import core.LocStrings;
import core.SubCommandFramework;
import dataStructures.KittyChannel;
import dataStructures.KittyGuild;
import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
import dataStructures.Response;
import dataStructures.UserInput;
public class CommandCharacterMain extends Command
{
SubCommandFramework framework = new SubCommandFramework();
public CommandCharacterMain(KittyRole level, KittyRating rating)
{
super(level, rating);
}
@Override
public String getHelpText() { return LocStrings.stub("CharacterInfo"); }
@Override
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
framework.run(guild, channel, user, input.args).Call(res);
}
}
@@ -1,4 +1,4 @@
package commands.general;
package commands.characters;
import java.util.ArrayList;
@@ -1,37 +0,0 @@
package commands.general;
import core.CharacterManager;
import core.Command;
import core.LocStrings;
import dataStructures.KittyChannel;
import dataStructures.KittyGuild;
import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
import dataStructures.Response;
import dataStructures.UserInput;
public class CommandCharacterCreate extends Command
{
public CommandCharacterCreate(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String getHelpText() { return LocStrings.stub("CharacterCreateInfo"); }
@Override
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
String [] info = input.args.split(",");
if(info.length < 3)
{
res.send(LocStrings.stub("CharacterCreateNullInfo"));
return;
}
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
{
res.send(LocStrings.stub("CharacterCreateSuccess"));
return;
}
res.send(LocStrings.stub("CharacterCreateDuplicate"));
}
}
@@ -17,10 +17,10 @@ public class CommandGuildRoleMain extends Command
public CommandGuildRoleMain(KittyRole level, KittyRating rating)
{
super(level, rating);
framework.addCommand("add", new CommandGuildRoleAdd (KittyRole.General, KittyRating.Safe));
framework.addCommand("remove", new CommandGuildRoleRemove(KittyRole.General, KittyRating.Safe));
framework.addCommand("allowed", new CommandGuildRoleAllowed(KittyRole.Admin, KittyRating.Safe));
framework.addCommand("unallowed", new CommandGuildRoleNotAllowed(KittyRole.Admin, KittyRating.Safe));
framework.addCommand("add", new SubCommandAdd (KittyRole.General, KittyRating.Safe));
framework.addCommand("remove", new SubCommandRemove(KittyRole.General, KittyRating.Safe));
framework.addCommand("allowed", new SubCommandAllowed(KittyRole.Admin, KittyRating.Safe));
framework.addCommand("unallowed", new SubCommandNotAllowed(KittyRole.Admin, KittyRating.Safe));
}
@Override
@@ -8,9 +8,9 @@ import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
public class CommandGuildRoleAdd extends SubCommand
public class SubCommandAdd extends SubCommand
{
public CommandGuildRoleAdd(KittyRole level, KittyRating rating) { super(level, rating); }
public SubCommandAdd(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
@@ -9,9 +9,9 @@ import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
public class CommandGuildRoleAllowed extends SubCommand
public class SubCommandAllowed extends SubCommand
{
public CommandGuildRoleAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
public SubCommandAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
@@ -9,10 +9,10 @@ import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
public class CommandGuildRoleList extends SubCommand
public class SubCommandList extends SubCommand
{
public CommandGuildRoleList(KittyRole level, KittyRating rating) { super(level, rating);}
public SubCommandList(KittyRole level, KittyRating rating) { super(level, rating);}
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
@@ -9,9 +9,9 @@ import dataStructures.KittyRating;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
public class CommandGuildRoleNotAllowed extends SubCommand
public class SubCommandNotAllowed extends SubCommand
{
public CommandGuildRoleNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
public SubCommandNotAllowed(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
@@ -5,9 +5,9 @@ import core.SubCommand;
import core.SubCommandFormattable;
import dataStructures.*;
public class CommandGuildRoleRemove extends SubCommand
public class SubCommandRemove extends SubCommand
{
public CommandGuildRoleRemove(KittyRole level, KittyRating rating) { super(level, rating); }
public SubCommandRemove(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
+5 -1
View File
@@ -2,6 +2,11 @@ package core;
import java.util.*;
import java.util.Map.Entry;
import commands.characters.CommandCharacterEditBio;
import commands.characters.CommandCharacterEditName;
import commands.characters.CommandCharacterEditURL;
import commands.characters.CommandCharacterSearch;
import commands.general.*;
import commands.guildrole.CommandGuildRoleMain;
import dataStructures.KittyChannel;
@@ -106,7 +111,6 @@ public class CommandManager
this.register(LocCommands.stub("crouton"), new CommandCrouton(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("benchmark, bench"), new CommandBenchmark(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("rafflejoin"), new CommandRaffleJoin(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("charactercreate"), new CommandCharacterCreate(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("searchcharacter"), new CommandCharacterSearch(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("charactereditbio"), new CommandCharacterEditBio(KittyRole.General, KittyRating.Safe));
this.register(LocCommands.stub("charactereditname"), new CommandCharacterEditName(KittyRole.General, KittyRating.Safe));
+4 -5
View File
@@ -7,17 +7,16 @@ import java.util.concurrent.Semaphore;
import javax.security.auth.login.LoginException;
import commands.characters.*;
import commands.general.*;
import commands.guildrole.CommandGuildRoleMain;
import core.lua.PluginManager;
import dataStructures.*;
import main.Main;
import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.entities.Emote;
import net.dv8tion.jda.core.entities.Game;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.entities.*;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import offline.Ref;
import utils.AdminControl;