Handle configuration exceptions too

This commit is contained in:
Jaime Martínez Rincón 2017-09-15 17:49:57 +02:00
parent 5dd49b4caa
commit d773800a0d
3 changed files with 30 additions and 31 deletions

View File

@ -2,5 +2,6 @@
mkdir libs mkdir libs
cd libs cd libs
powershell -Command "Invoke-WebRequest https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar -OutFile BungeeCord.jar" powershell -Command "Invoke-WebRequest https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar -OutFile BungeeCord.jar"
mvn install:install-file -Dfile=BungeeCord.jar -DgroupId=net.md-5 -DartifactId=bungeecord-proxy -Dversion=local -Dpackaging=jar mvn install:install-file -Dfile=BungeeCord.jar -DgroupId=net.md-5 -DartifactId=bungeecord-proxy -Dversion=local -Dpackaging=jar

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
mkdir libs && cd "$_" mkdir libs
cd libs
wget https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar wget https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar
mvn install:install-file -Dfile=BungeeCord.jar -DgroupId=net.md-5 -DartifactId=bungeecord-proxy -Dversion=local -Dpackaging=jar mvn install:install-file -Dfile=BungeeCord.jar -DgroupId=net.md-5 -DartifactId=bungeecord-proxy -Dversion=local -Dpackaging=jar

View File

@ -71,33 +71,29 @@ public class PlayerBalancer extends Plugin {
try { try {
CommentedConfigurationNode node = loader.load(); CommentedConfigurationNode node = loader.load();
settings = node.getValue(TypeToken.of(SettingsHolder.class)); settings = node.getValue(TypeToken.of(SettingsHolder.class));
} catch (Exception e) {
e.printStackTrace();
}
mainCommand = new MainCommand(this); mainCommand = new MainCommand(this);
getProxy().getPluginManager().registerCommand(this, mainCommand); getProxy().getPluginManager().registerCommand(this, mainCommand);
if (settings.getGeneralProps().isEnabled()) { if (settings.getGeneralProps().isEnabled()) {
if (settings.getGeneralProps().isSilent()) { if (settings.getGeneralProps().isSilent()) {
getLogger().setLevel(Level.WARNING); getLogger().setLevel(Level.WARNING);
} }
if (settings.getGeneralProps().isAutoReload()) { if (settings.getGeneralProps().isAutoReload()) {
reloadListener = new ProxyReloadListener(this); reloadListener = new ProxyReloadListener(this);
getProxy().getPluginManager().registerListener(this, reloadListener); getProxy().getPluginManager().registerListener(this, reloadListener);
} }
try { try {
new BungeeUpdater(this, 10788); new BungeeUpdater(this, 10788);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
networkManager = new NetworkManager(this); networkManager = new NetworkManager(this);
sectionManager = new SectionManager(this);
try { sectionManager = new SectionManager(this);
sectionManager.load(); sectionManager.load();
statusManager = new StatusManager(this); statusManager = new StatusManager(this);
@ -131,16 +127,16 @@ public class PlayerBalancer extends Plugin {
} }
getLogger().info("The plugin has finished loading without any problems"); getLogger().info("The plugin has finished loading without any problems");
} catch (RuntimeException e) { } else {
this.failed = true; getLogger().warning("-----------------------------------------------------");
getLogger().severe("The plugin could not continue loading due to an unexpected exception"); getLogger().warning("WARNING: This plugin is disabled, do not forget to set enabled on the config to true");
e.printStackTrace(); getLogger().warning("Nothing is going to work until you do that, you can reload me by using the /balancer command");
getLogger().warning("-----------------------------------------------------");
} }
} else { } catch (Exception e) {
getLogger().warning("-----------------------------------------------------"); this.failed = true;
getLogger().warning("WARNING: This plugin is disabled, do not forget to set enabled on the config to true"); getLogger().severe("The plugin could not continue loading due to an unexpected exception");
getLogger().warning("Nothing is going to work until you do that, you can reload me by using the /balancer command"); e.printStackTrace();
getLogger().warning("-----------------------------------------------------");
} }
} }