= Merge cleanup

This commit is contained in:
Matthew Cech
2019-06-19 19:56:43 -07:00
parent aa01198d24
commit 2a2b46a507
9 changed files with 79 additions and 80 deletions
+5 -5
View File
@@ -16,22 +16,22 @@ public class CommandCharacterCreate extends Command
public CommandCharacterCreate(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("CharacterCreateInfo"); }
public String getHelpText() { return LocStrings.stub("CharacterCreateInfo"); }
@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 [] info = input.args.split(",");
if(info.length < 3)
{
res.Call(LocStrings.Stub("CharacterCreateNullInfo"));
res.Call(LocStrings.stub("CharacterCreateNullInfo"));
return;
}
if(CharacterManager.instance.addCharacter(user, info[0], info[1], info[2]))
{
res.Call(LocStrings.Stub("CharacterCreateSuccess"));
res.Call(LocStrings.stub("CharacterCreateSuccess"));
return;
}
res.Call(LocStrings.Stub("CharacterCreateDuplicate"));
res.Call(LocStrings.stub("CharacterCreateDuplicate"));
}
}
+5 -5
View File
@@ -10,10 +10,10 @@ public class CommandCharacterEditBio extends Command
public CommandCharacterEditBio(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("CharacterEditBioInfo"); }
public String getHelpText() { return LocStrings.stub("CharacterEditBioInfo"); }
@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)
{
try
{
@@ -21,18 +21,18 @@ public class CommandCharacterEditBio extends Command
}
catch(Exception e)
{
res.Call(LocStrings.Stub("CharacterEditBioNotValid"));
res.Call(LocStrings.stub("CharacterEditBioNotValid"));
return;
}
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
if(character.getOwner().equals(user))
{
CharacterManager.instance.editBio(character, input.args.substring(input.args.indexOf(' ')));
res.Call(LocStrings.Stub("CharacterEditBioSuccess"));
res.Call(LocStrings.stub("CharacterEditBioSuccess"));
}
else
{
res.Call(LocStrings.Stub("CharacterEditBioNotAuth"));
res.Call(LocStrings.stub("CharacterEditBioNotAuth"));
}
}
}
+5 -5
View File
@@ -10,10 +10,10 @@ public class CommandCharacterEditName extends Command
public CommandCharacterEditName(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("CharacterEditNameInfo"); }
public String getHelpText() { return LocStrings.stub("CharacterEditNameInfo"); }
@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)
{
try
{
@@ -21,18 +21,18 @@ public class CommandCharacterEditName extends Command
}
catch(Exception e)
{
res.Call(LocStrings.Stub("CharacterEditNameNotValid"));
res.Call(LocStrings.stub("CharacterEditNameNotValid"));
return;
}
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
if(character.getOwner().equals(user))
{
CharacterManager.instance.editName(character, input.args.substring(input.args.indexOf(' ')));
res.Call(LocStrings.Stub("CharacterEditNameSuccess"));
res.Call(LocStrings.stub("CharacterEditNameSuccess"));
}
else
{
res.Call(LocStrings.Stub("CharacterEditNameNotAuth"));
res.Call(LocStrings.stub("CharacterEditNameNotAuth"));
}
}
}
+5 -5
View File
@@ -10,10 +10,10 @@ public class CommandCharacterEditURL extends Command
public CommandCharacterEditURL(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("CharacterEditURLInfo"); }
public String getHelpText() { return LocStrings.stub("CharacterEditURLInfo"); }
@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)
{
try
{
@@ -21,18 +21,18 @@ public class CommandCharacterEditURL extends Command
}
catch(Exception e)
{
res.Call(LocStrings.Stub("CharacterEditURLNotValid"));
res.Call(LocStrings.stub("CharacterEditURLNotValid"));
return;
}
KittyCharacter character = CharacterManager.instance.searchCharacter(input.args.split(" ")[0]).get(0);
if(character.getOwner().equals(user))
{
CharacterManager.instance.editRefImage(character, input.args.substring(input.args.indexOf(' ')));
res.Call(LocStrings.Stub("CharacterEditURLSuccess"));
res.Call(LocStrings.stub("CharacterEditURLSuccess"));
}
else
{
res.Call(LocStrings.Stub("CharacterEditURLNotAuth"));
res.Call(LocStrings.stub("CharacterEditURLNotAuth"));
}
}
}
+6 -6
View File
@@ -12,29 +12,29 @@ public class CommandCharacterSearch extends Command
public CommandCharacterSearch(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("CharacterSearchInfo"); }
public String getHelpText() { return LocStrings.stub("CharacterSearchInfo"); }
@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)
{
ArrayList <KittyCharacter> characters = CharacterManager.instance.searchCharacter(input.args);
if(characters.size() < 1)
{
res.Call(LocStrings.Stub("CharacterSearchNoCharacterFound"));
res.Call(LocStrings.stub("CharacterSearchNoCharacterFound"));
return;
}
if(characters.size() > 1)
{
res.Call(LocStrings.Stub("CharacterSearchMultipleCharacterHeader"));
res.Call(LocStrings.stub("CharacterSearchMultipleCharacterHeader"));
for(KittyCharacter character:characters)
{
res.Call(String.format(LocStrings.Stub("CharacterSearchMultipleCharacter"), character.getName(), character.getOwner().name, character.getUID()));
res.Call(String.format(LocStrings.stub("CharacterSearchMultipleCharacter"), character.getName(), character.getOwner().name, character.getUID()));
}
return;
}
else
{
res.Call(String.format(LocStrings.Stub("CharacterSearchOneCharacter"), characters.get(0).getOwner().name, characters.get(0).getName(), characters.get(0).getBio(), characters.get(0).getRefImage(), characters.get(0).getUID()));
res.Call(String.format(LocStrings.stub("CharacterSearchOneCharacter"), characters.get(0).getOwner().name, characters.get(0).getName(), characters.get(0).getBio(), characters.get(0).getRefImage(), characters.get(0).getUID()));
}
}
}
+3 -4
View File
@@ -4,7 +4,6 @@ import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.text.DecimalFormat;
import core.Command;
import core.LocStrings;
@@ -27,10 +26,10 @@ public class CommandColor extends Command
public CommandColor(KittyRole level, KittyRating rating) { super(level, rating); }
@Override
public String HelpText() { return LocStrings.Stub("ColorInfo"); }
public String getHelpText() { return LocStrings.stub("ColorInfo"); }
@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)
{
// First, try and parse out the color to make sure we can even get it.
ColorData colorData = theColorAPI.LookupHex(input.args.trim());
@@ -38,7 +37,7 @@ public class CommandColor extends Command
// Verify the color was even found
if(colorData == null)
{
res.Call(LocStrings.Stub("ColorNotSearchable"));
res.Call(LocStrings.stub("ColorNotSearchable"));
return;
}
+3 -3
View File
@@ -25,11 +25,11 @@ public class CommandLeaderboard extends Command
public CommandLeaderboard(KittyRole roleLevel, KittyRating contentRating) { super(roleLevel, contentRating); }
@Override
public String HelpText() { return LocStrings.Stub("LeaderboardInfo"); }
public String getHelpText() { return LocStrings.stub("LeaderboardInfo"); }
// Called when the command is run!
@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)
{
// Start by force-flushing. We need to be up-to-date.
GlobalLog.Log("Flushed database for " + DatabaseManager.instance.upkeep() + " items.");
@@ -80,7 +80,7 @@ public class CommandLeaderboard extends Command
final int listSize = 10;
KittyEmbed embed = new KittyEmbed();
embed.color = Config.ColorDefault;
embed.title = LocStrings.Stub("LeaderboardTitle");
embed.title = LocStrings.stub("LeaderboardTitle");
embed.descriptionText = "";
for(int i = 0; i < listSize && i < users.size(); ++i)
+41 -41
View File
@@ -325,7 +325,7 @@ public class ObjectBuilderFactory
Member jdaMember = jdaGuild.getMemberById(userID);
User jdaUser = jdaMember.getUser();
user = ExtractUserByJDAUser(guildID, jdaMember.getNickname(), jdaUser.getId(), jdaUser.getAvatarUrl(), jdaUser.getId());
user = extractUserByJDAUser(guildID, jdaMember.getNickname(), jdaUser.getId(), jdaUser.getAvatarUrl(), jdaUser.getId());
updateUser(user, jdaMember);
}
@@ -397,46 +397,46 @@ public class ObjectBuilderFactory
manager.Register(LocCommands.stub("raffleend"), new CommandRaffleEnd(KittyRole.Mod, KittyRating.Safe));
// General
manager.Register(LocCommands.Stub("fetch"), new CommandFetch(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("guildroleadd"), new CommandGuildRoleAdd(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("guildroleremove"), new CommandGuildRoleRemove(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("teey"), new CommandTeey(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("perish, thenperish"), new CommandPerish(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("yeet"), new CommandYeet(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("ping"), new CommandPing(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("boop"), new CommandBoop(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("roll"), new CommandRoll(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("choose"), new CommandChoose(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("help"), new CommandHelp(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("info, about"), new CommandInfo(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("vote"), new CommandPollVote(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("results"), new CommandPollResults(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("showpoll"), new CommandPollShow(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("wolfram"), new CommandWolfram(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("c++, g++, cplus, cpp"), new CommandColiru(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("java, jdoodle"), new CommandJDoodle(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("beans"), new CommandBeansShow(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("role"), new CommandRole(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("bet"), new CommandBetBeans(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("map"), new CommandMap(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("rpstart"), new CommandRPStart(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("rpend"), new CommandRPEnd(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("tony, stark, dontfeelgood, dontfeelsogood"), new CommandStark(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("blur"), new CommandBlurry(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("eightball, 8ball"), new CommandEightBall(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("catch"), new CommandCatch(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("guildrolelist"), new CommandGuildRoleList(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("bethistory"), new CommandBetHistory(KittyRole.General, KittyRating.Safe));
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));
manager.Register(LocCommands.Stub("charactereditURL"), new CommandCharacterEditURL(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("leaderboard"), new CommandLeaderboard(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.Stub("color, colour"), new CommandColor(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("fetch"), new CommandFetch(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("guildroleadd"), new CommandGuildRoleAdd(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("guildroleremove"), new CommandGuildRoleRemove(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("teey"), new CommandTeey(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("perish, thenperish"), new CommandPerish(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("yeet"), new CommandYeet(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("ping"), new CommandPing(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("boop"), new CommandBoop(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("roll"), new CommandRoll(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("choose"), new CommandChoose(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("help"), new CommandHelp(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("info, about"), new CommandInfo(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("vote"), new CommandPollVote(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("results"), new CommandPollResults(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("showpoll"), new CommandPollShow(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("wolfram"), new CommandWolfram(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("c++, g++, cplus, cpp"), new CommandColiru(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("java, jdoodle"), new CommandJDoodle(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("beans"), new CommandBeansShow(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("role"), new CommandRole(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("bet"), new CommandBetBeans(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("map"), new CommandMap(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("rpstart"), new CommandRPStart(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("rpend"), new CommandRPEnd(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("tony, stark, dontfeelgood, dontfeelsogood"), new CommandStark(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("blur"), new CommandBlurry(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("eightball, 8ball"), new CommandEightBall(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("catch"), new CommandCatch(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("guildrolelist"), new CommandGuildRoleList(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("bethistory"), new CommandBetHistory(KittyRole.General, KittyRating.Safe));
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));
manager.Register(LocCommands.stub("charactereditURL"), new CommandCharacterEditURL(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("leaderboard"), new CommandLeaderboard(KittyRole.General, KittyRating.Safe));
manager.Register(LocCommands.stub("color, colour"), new CommandColor(KittyRole.General, KittyRating.Safe));
return manager;
}
+6 -6
View File
@@ -48,13 +48,13 @@ public class Main extends ListenerAdapter
{
// Factory startup. The ordering is intentional.
GlobalLog.initialize();
databaseManager = ObjectBuilderFactory.ConstructDatabaseManager();
commandEnabler = ObjectBuilderFactory.ConstructCommandEnabler();
commandManager = ObjectBuilderFactory.ConstructCommandManager(commandEnabler);
stats = ObjectBuilderFactory.ConstructStats(commandManager);
databaseManager = ObjectBuilderFactory.constructDatabaseManager();
commandEnabler = ObjectBuilderFactory.constructCommandEnabler();
commandManager = ObjectBuilderFactory.constructCommandManager(commandEnabler);
stats = ObjectBuilderFactory.constructStats(commandManager);
charManager = new CharacterManager();
rpManager = ObjectBuilderFactory.ConstructRPManager();
pluginManager = ObjectBuilderFactory.ConstructPluginManager();
rpManager = ObjectBuilderFactory.constructRPManager();
pluginManager = ObjectBuilderFactory.constructPluginManager();
// Bot startup
kittyCore = ObjectBuilderFactory.ConstructKittyCore();