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,9 +71,6 @@ 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);
@ -95,9 +92,8 @@ public class PlayerBalancer extends Plugin {
} }
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,17 +127,17 @@ 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) {
this.failed = true;
getLogger().severe("The plugin could not continue loading due to an unexpected exception");
e.printStackTrace();
}
} else { } else {
getLogger().warning("-----------------------------------------------------"); getLogger().warning("-----------------------------------------------------");
getLogger().warning("WARNING: This plugin is disabled, do not forget to set enabled on the config to true"); getLogger().warning("WARNING: This plugin is disabled, do not forget to set enabled on the config to true");
getLogger().warning("Nothing is going to work until you do that, you can reload me by using the /balancer command"); getLogger().warning("Nothing is going to work until you do that, you can reload me by using the /balancer command");
getLogger().warning("-----------------------------------------------------"); getLogger().warning("-----------------------------------------------------");
} }
} catch (Exception e) {
this.failed = true;
getLogger().severe("The plugin could not continue loading due to an unexpected exception");
e.printStackTrace();
}
} }
private void disable() { private void disable() {