+ Added first-pass leaderboard command and all requirements

This commit is contained in:
Matthew Cech
2019-06-02 21:36:42 -07:00
parent 2fbb74198c
commit 31f9689140
17 changed files with 240 additions and 30 deletions
+5 -6
View File
@@ -6,6 +6,7 @@ import core.benchmark.BenchmarkManager;
import core.lua.PluginManager;
import core.lua.PluginUser;
import dataStructures.KittyChannel;
import dataStructures.KittyCore;
import dataStructures.KittyGuild;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
@@ -27,7 +28,7 @@ import java.util.*;
public class Main extends ListenerAdapter
{
// Variables and bot specific objects
private static JDA kitty; // TODO: Wrap
private static KittyCore kittyCore;
private static DatabaseManager databaseManager;
private static CommandEnabler commandEnabler;
private static CommandManager commandManager;
@@ -48,9 +49,7 @@ public class Main extends ListenerAdapter
pluginManager = ObjectBuilderFactory.ConstructPluginManager();
// Bot startup
kitty = new JDABuilder(AccountType.BOT).setToken(Ref.TestToken).buildBlocking();
kitty.getPresence().setGame(Game.playing("with digital yarn"));
kitty.addEventListener(new Main());
kittyCore = ObjectBuilderFactory.ConstructKittyCore();
}
// When a message is sent in a server that kitty is in, this is what's called.
@@ -67,7 +66,7 @@ public class Main extends ListenerAdapter
KittyChannel channel = ObjectBuilderFactory.ExtractChannel(event);
// Specialized uncached objects
Response response = new Response(event, kitty);
Response response = new Response(event, kittyCore);
UserInput input = new UserInput(event, guild);
// Tweak object construction as necessary
@@ -106,6 +105,6 @@ public class Main extends ListenerAdapter
}
// Run any upkeep in post we need to
Superintendent.PerCommandUpkeepPost(kitty, databaseManager);
Superintendent.PerCommandUpkeepPost(kittyCore, databaseManager);
}
}
+3 -3
View File
@@ -8,12 +8,12 @@ import core.LocStrings;
import core.RPManager;
import core.Stats;
import dataStructures.KittyChannel;
import dataStructures.KittyCore;
import dataStructures.KittyGuild;
import dataStructures.KittyRole;
import dataStructures.KittyUser;
import dataStructures.Response;
import dataStructures.UserInput;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import offline.Ref;
@@ -87,7 +87,7 @@ public class Superintendent
// This is for stuff that we need to do on a regular basis, but don't
// necessarily want running at all points in time.
// Happens just after the command / plugin runs.
public static boolean PerCommandUpkeepPost(JDA bot, DatabaseManager databaseManager)
public static boolean PerCommandUpkeepPost(KittyCore kittyCore, DatabaseManager databaseManager)
{
// Upkeep database lazily on occasion
if(delayTimerCurrent.decrementAndGet() < 0)
@@ -97,7 +97,7 @@ public class Superintendent
}
// Update command-specific
RPManager.Upkeep(bot);
RPManager.Upkeep(kittyCore);
return true;
}