=Started character subcommand routine and edited guildrole class names

This commit is contained in:
Alex
2019-06-30 03:33:49 -04:00
parent 0de91ab8f6
commit 6a709942ce
14 changed files with 81 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)
+2 -6
View File
@@ -7,6 +7,7 @@ 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;
@@ -15,11 +16,7 @@ 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;
@@ -427,7 +424,6 @@ public class ObjectBuilderFactory
manager.register(LocCommands.stub("crouton"), new CommandCrouton(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("benchmark, bench"), new CommandBenchmark(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("rafflejoin"), new CommandRaffleJoin(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("charactercreate"), new CommandCharacterCreate(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("searchcharacter"), new CommandCharacterSearch(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("charactereditbio"), new CommandCharacterEditBio(KittyRole.General, KittyRating.Safe));
manager.register(LocCommands.stub("charactereditname"), new CommandCharacterEditName(KittyRole.General, KittyRating.Safe));