Prevent errors when the full config is not set

This commit is contained in:
md_5 2012-10-21 18:30:14 +11:00
parent a6007ec6cf
commit 372b3c231c
2 changed files with 8 additions and 4 deletions

View File

@ -118,7 +118,7 @@ public class BungeeCord
String[] split = commandLine.trim().split(" "); String[] split = commandLine.trim().split(" ");
String commandName = split[0].toLowerCase(); String commandName = split[0].toLowerCase();
Command command = commandMap.get(commandName); Command command = commandMap.get(commandName);
if (command != null && !config.disabledCommands.contains(commandName)) if (command != null && (config.disabledCommands == null || !config.disabledCommands.contains(commandName)))
{ {
String[] args = Arrays.copyOfRange(split, 1, split.length); String[] args = Arrays.copyOfRange(split, 1, split.length);
try try

View File

@ -174,11 +174,15 @@ public class Configuration
{ {
throw new IllegalArgumentException("Server '" + defaultServerName + "' not defined"); throw new IllegalArgumentException("Server '" + defaultServerName + "' not defined");
} }
for (String server : forcedServers.values())
if (forcedServers != null)
{ {
if (!servers.containsKey(server)) for (String server : forcedServers.values())
{ {
throw new IllegalArgumentException("Forced server " + server + " is not defined in servers"); if (!servers.containsKey(server))
{
throw new IllegalArgumentException("Forced server " + server + " is not defined in servers");
}
} }
} }