Bring reconnect yaml handler setting in line with what we had before (only create if needed)

This commit is contained in:
md_5 2014-01-17 09:35:29 +11:00
parent 71e64bf532
commit 05f4e69afd

View File

@ -1,5 +1,6 @@
package net.md_5.bungee.module.reconnect.yaml; package net.md_5.bungee.module.reconnect.yaml;
import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
public class PluginYaml extends Plugin public class PluginYaml extends Plugin
@ -7,7 +8,15 @@ public class PluginYaml extends Plugin
@Override @Override
public void onEnable() public void onEnable()
{
// TODO: Abstract this for other reconnect modules
for ( ListenerInfo info : getProxy().getConfig().getListeners() )
{
if ( !info.isForceDefault() && getProxy().getReconnectHandler() == null )
{ {
getProxy().setReconnectHandler( new YamlReconnectHandler() ); getProxy().setReconnectHandler( new YamlReconnectHandler() );
break;
}
}
} }
} }