= Core subsystem formatting update

This commit is contained in:
Matthew Cech
2019-06-19 21:48:37 -07:00
parent ba843ca645
commit feca9e542a
21 changed files with 230 additions and 229 deletions
+7 -7
View File
@@ -57,7 +57,7 @@ public class Main extends ListenerAdapter
pluginManager = ObjectBuilderFactory.constructPluginManager();
// Bot startup
kittyCore = ObjectBuilderFactory.ConstructKittyCore();
kittyCore = ObjectBuilderFactory.constructKittyCore();
}
// When a message is sent in a server that kitty is in, this is what's called.
@@ -65,7 +65,7 @@ public class Main extends ListenerAdapter
public void onGuildMessageReceived(GuildMessageReceivedEvent event)
{
// Tweak the event as necessary
if(!Superintendent.PreProcessSetup(event, stats))
if(!Superintendent.preProcessSetup(event, stats))
return;
// Factory objects
@@ -78,7 +78,7 @@ public class Main extends ListenerAdapter
UserInput input = new UserInput(event, guild);
// Tweak object construction as necessary
if(!Superintendent.PostProcessSetup(event, user, guild, channel, response, input))
if(!Superintendent.postProcessSetup(event, user, guild, channel, response, input))
return;
// Track beans!
@@ -88,11 +88,11 @@ public class Main extends ListenerAdapter
RPManager.instance.addLine(channel, user, input);
// Run any pre-emptive upkeep we need to
Superintendent.PerCommandUpkeepPre();
Superintendent.perCommandUpkeepPre();
// Attempt to spin up a command. If the command doesn't exist.
// Run plugins right before invoking the commands but after all other setup.
if(commandManager.InvokeOnNewThread(guild, channel, user, input, response) == false)
if(commandManager.invokeOnNewThread(guild, channel, user, input, response) == false)
{
List<String> pluginOutput = pluginManager.runAll(input.message, user);
@@ -102,7 +102,7 @@ public class Main extends ListenerAdapter
{
if(pluginOutput.get(i).startsWith("!"))
{
commandManager.InvokeOnNewThread(guild, channel, user, new UserInput(pluginOutput.get(i).substring(1), guild), response);
commandManager.invokeOnNewThread(guild, channel, user, new UserInput(pluginOutput.get(i).substring(1), guild), response);
}
else
{
@@ -113,6 +113,6 @@ public class Main extends ListenerAdapter
}
// Run any upkeep in post we need to
Superintendent.PerCommandUpkeepPost(kittyCore, databaseManager);
Superintendent.perCommandUpkeepPost(kittyCore, databaseManager);
}
}
+9 -9
View File
@@ -21,17 +21,17 @@ import offline.Ref;
public class Superintendent
{
// This is run on the JDA GuildMessageReceivedEvent before anything else happens.
public static boolean PreProcessSetup(GuildMessageReceivedEvent event, Stats stats)
public static boolean preProcessSetup(GuildMessageReceivedEvent event, Stats stats)
{
// Verify we have an event
if(event == null)
return false;
// Track number of messages seen
stats.NoteMessageEvent();
stats.noteMessageEvent();
// If we're mid-shutdown, no more commands.
if(stats.GetIsShuttingDown())
if(stats.getIsShuttingDown())
return false;
// Swat down highest ban level immediately before even hitting command parsing.
@@ -47,7 +47,7 @@ public class Superintendent
// This runs after all the objects have been constructed!
// Modifications to objects here stick!
public static boolean PostProcessSetup(GuildMessageReceivedEvent event, KittyUser user, KittyGuild guild, KittyChannel channel, Response res, UserInput input)
public static boolean postProcessSetup(GuildMessageReceivedEvent event, KittyUser user, KittyGuild guild, KittyChannel channel, Response res, UserInput input)
{
// Verify we have everything. From here out, we promise we have that all.
if(event == null || user == null || guild == null || channel == null || res == null || input == null)
@@ -72,11 +72,11 @@ public class Superintendent
// Only called once per command. Good for lazily updating.
// Happens just before the command / plugin runs.
public static boolean PerCommandUpkeepPre()
public static boolean perCommandUpkeepPre()
{
// Upkeep localization system's file monitoring
LocStrings.Upkeep();
LocCommands.Upkeep();
LocStrings.upkeep();
LocCommands.upkeep();
return true;
}
@@ -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(KittyCore kittyCore, 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(kittyCore);
RPManager.upkeep(kittyCore);
return true;
}