Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit 99c2c32

Browse files
cmds variable in Data uses CommandHandler; Build 2
- cmds variable will now use the CommandHandler.ALL_COMMANDS to initialize its list. Not every command is in the guildData.json (about and help), which gives flexibility when adding new commands.
1 parent 5517135 commit 99c2c32

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Project-Lynx/src/main/java/data/Data.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Data {
2727
*/
2828
public static volatile Map<Guild, List<Command>> command_cache;
2929
public static volatile Map<Guild, JSONObject> srvr_cache;
30-
public static volatile ArrayList<Command> cmds;
30+
public static volatile ArrayList<Command> cmds = (ArrayList<Command>) CommandHandler.ALL_COMMANDS;
3131
public static volatile JSONObject rawJSON;
3232

3333
//TODO: Clean this up
@@ -429,12 +429,13 @@ public static void initCache() throws InstantiationException, IllegalAccessExcep
429429
* @param key
430430
* @param obj
431431
*/
432+
@SuppressWarnings("unchecked")
432433
public static void loadCache(String key, JSONObject obj) {
433434

434435
System.out.println("[Data.java] Loading cache for " + Launcher.api.getGuildById(key));
435436

436437
JSONObject cmds_config = obj.getJSONObject(key).getJSONObject("cmds_config"), srvr_config = obj.getJSONObject(key).getJSONObject("srvr_config");
437-
ArrayList<Command> modifyCmds = new ArrayList<Command>();
438+
ArrayList<Command> modifyCmds = (ArrayList<Command>) cmds.clone();
438439

439440
//System.out.println("DEBUG CRITICAL (TOP) [Data.java] " + cmds_config);
440441

0 commit comments

Comments
 (0)