= Covered leaderboard to prevent bad parses and condensed command manager
This commit is contained in:
@@ -49,16 +49,26 @@ public class CommandLeaderboard extends Command
|
|||||||
if(userID.length() < 1)
|
if(userID.length() < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
String dbUserData = null;
|
||||||
|
Long parsedBeans = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Look up in the database the user beans
|
// Look up in the database the user beans
|
||||||
String dbUserData = DatabaseManager.instance.globalGetRemoteValue(guildID + userID);
|
dbUserData = DatabaseManager.instance.globalGetRemoteValue(guildID + userID);
|
||||||
|
|
||||||
// Leverage the fact that the user is automatically read and parsed when constructed.
|
// Leverage the fact that the user is automatically read and parsed when constructed.
|
||||||
Long parsedBeans = KittyUser.parseBeans(KittyUser.prepareFromString(dbUserData));
|
parsedBeans = KittyUser.parseBeans(KittyUser.prepareFromString(dbUserData));
|
||||||
|
|
||||||
// If we were only using cached users, we would use this. However, we're not.
|
// If we were only using cached users, we would use this. However, we're not.
|
||||||
// KittyUser cachedUser = ObjectBuilderFactory.getCachedUser(guildID, userID);
|
// KittyUser cachedUser = ObjectBuilderFactory.getCachedUser(guildID, userID);
|
||||||
users.add(new Pair<Long, String>(parsedBeans, userID));
|
users.add(new Pair<Long, String>(parsedBeans, userID));
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
GlobalLog.error(LogFilter.Command, "Issue parsing for leaderboard,\ndbUserData:" + dbUserData + "\nparsedBeans:" + parsedBeans);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort users by beans
|
// Sort users by beans
|
||||||
|
|||||||
@@ -11,14 +11,7 @@ import commands.mod.CommandModMain;
|
|||||||
import commands.music.CommandMusicMain;
|
import commands.music.CommandMusicMain;
|
||||||
import commands.poll.CommandPollMain;
|
import commands.poll.CommandPollMain;
|
||||||
import commands.raffle.CommandRaffleMain;
|
import commands.raffle.CommandRaffleMain;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.*;
|
||||||
import dataStructures.KittyGuild;
|
|
||||||
import dataStructures.KittyRating;
|
|
||||||
import dataStructures.KittyRole;
|
|
||||||
import dataStructures.KittyUser;
|
|
||||||
import dataStructures.Pair;
|
|
||||||
import dataStructures.Response;
|
|
||||||
import dataStructures.UserInput;
|
|
||||||
import utils.GlobalLog;
|
import utils.GlobalLog;
|
||||||
import utils.LogFilter;
|
import utils.LogFilter;
|
||||||
|
|
||||||
@@ -113,6 +106,7 @@ public class CommandManager
|
|||||||
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("music"), new CommandMusicMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("music"), new CommandMusicMain(KittyRole.General, KittyRating.Safe));
|
||||||
|
this.register(LocCommands.stub("defaultdance"), new CommandDefaultDance(KittyRole.General, KittyRating.Safe));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows the command manager to keep track of a command. Takes a pair (the un-localized and localzied commands)
|
// Allows the command manager to keep track of a command. Takes a pair (the un-localized and localzied commands)
|
||||||
|
|||||||
Reference in New Issue
Block a user