Ignore unknown entries in plugin description files.

Fixes #955.
This commit is contained in:
Minecrell 2014-08-16 22:45:21 +02:00 committed by md_5
parent caa562c4a1
commit 664c66fb97

View File

@ -31,6 +31,8 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.event.EventBus; import net.md_5.bungee.event.EventBus;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.introspector.PropertyUtils;
/** /**
* Class to manage bridging between plugin duties and implementation duties, for * Class to manage bridging between plugin duties and implementation duties, for
@ -44,7 +46,7 @@ public class PluginManager
/*========================================================================*/ /*========================================================================*/
private final ProxyServer proxy; private final ProxyServer proxy;
/*========================================================================*/ /*========================================================================*/
private final Yaml yaml = new Yaml(); private final Yaml yaml;
private final EventBus eventBus; private final EventBus eventBus;
private final Map<String, Plugin> plugins = new LinkedHashMap<>(); private final Map<String, Plugin> plugins = new LinkedHashMap<>();
private final Map<String, Command> commandMap = new HashMap<>(); private final Map<String, Command> commandMap = new HashMap<>();
@ -56,6 +58,14 @@ public class PluginManager
public PluginManager(ProxyServer proxy) public PluginManager(ProxyServer proxy)
{ {
this.proxy = proxy; this.proxy = proxy;
// Ignore unknown entries in the plugin descriptions
Constructor yamlConstructor = new Constructor();
PropertyUtils propertyUtils = yamlConstructor.getPropertyUtils();
propertyUtils.setSkipMissingProperties( true );
yamlConstructor.setPropertyUtils( propertyUtils );
yaml = new Yaml( yamlConstructor );
eventBus = new EventBus( proxy.getLogger() ); eventBus = new EventBus( proxy.getLogger() );
} }