Fix some errors related to disabling modules - #890

This commit is contained in:
md_5 2014-03-11 15:16:52 +11:00
parent 5beafed279
commit 575a6b6ea0

View File

@ -32,6 +32,8 @@ public class ModuleManager
public void load(ProxyServer proxy, File moduleDirectory) throws Exception public void load(ProxyServer proxy, File moduleDirectory) throws Exception
{ {
moduleDirectory.mkdir();
ModuleVersion bungeeVersion = ModuleVersion.parse( proxy.getVersion() ); ModuleVersion bungeeVersion = ModuleVersion.parse( proxy.getVersion() );
if ( bungeeVersion == null ) if ( bungeeVersion == null )
{ {
@ -39,8 +41,6 @@ public class ModuleManager
return; return;
} }
moduleDirectory.mkdir();
List<ModuleSpec> modules = new ArrayList<>(); List<ModuleSpec> modules = new ArrayList<>();
File configFile = new File( "modules.yml" ); File configFile = new File( "modules.yml" );
// Start Yaml // Start Yaml
@ -66,9 +66,10 @@ public class ModuleManager
// End yaml // End yaml
List<String> defaults = new ArrayList<>(); List<String> defaults = new ArrayList<>();
if ( config.containsKey( "modules" ) ) Object readModules = config.get( "modules" );
if ( readModules != null )
{ {
defaults.addAll( (Collection) config.get( "modules" ) ); defaults.addAll( (Collection) readModules );
} }
int version = ( config.containsKey( "version" ) ) ? (int) config.get( "version" ) : 0; int version = ( config.containsKey( "version" ) ) ? (int) config.get( "version" ) : 0;
switch ( version ) switch ( version )