Put aliases inside an "aliases"-block
This commit is contained in:
@@ -46,8 +46,9 @@ public class BotConfig
|
||||
private long owner, maxSeconds;
|
||||
private OnlineStatus status;
|
||||
private Game game;
|
||||
private Config aliases;
|
||||
|
||||
|
||||
private Config config;
|
||||
private boolean valid = false;
|
||||
|
||||
public BotConfig(Prompt prompt)
|
||||
@@ -73,7 +74,7 @@ public class BotConfig
|
||||
|
||||
// load in the config file, plus the default values
|
||||
//Config config = ConfigFactory.parseFile(path.toFile()).withFallback(ConfigFactory.load());
|
||||
config = ConfigFactory.load();
|
||||
Config config = ConfigFactory.load();
|
||||
|
||||
// set values
|
||||
token = config.getString("token");
|
||||
@@ -95,6 +96,7 @@ public class BotConfig
|
||||
useEval = config.getBoolean("eval");
|
||||
maxSeconds = config.getLong("maxtime");
|
||||
playlistsFolder = config.getString("playlistsfolder");
|
||||
aliases = config.getConfig("aliases");
|
||||
dbots = owner == 113156185389092864L;
|
||||
|
||||
// we may need to write a new config file
|
||||
@@ -304,9 +306,13 @@ public class BotConfig
|
||||
|
||||
public String[] getAliases(String command)
|
||||
{
|
||||
String aliases = config.getString("alias."+command);
|
||||
if(aliases == null || aliases.length() <= 0)
|
||||
return new String[]{};
|
||||
return aliases.split(" ");
|
||||
try
|
||||
{
|
||||
return aliases.getStringList(command).toArray(new String[0]);
|
||||
}
|
||||
catch(NullPointerException e)
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user