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
cd libs
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

View File

@ -1,5 +1,7 @@
#!/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
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 {
CommentedConfigurationNode node = loader.load();
settings = node.getValue(TypeToken.of(SettingsHolder.class));
} catch (Exception e) {
e.printStackTrace();
}
mainCommand = new MainCommand(this);
getProxy().getPluginManager().registerCommand(this, mainCommand);
mainCommand = new MainCommand(this);
getProxy().getPluginManager().registerCommand(this, mainCommand);
if (settings.getGeneralProps().isEnabled()) {
if (settings.getGeneralProps().isSilent()) {
getLogger().setLevel(Level.WARNING);
}
if (settings.getGeneralProps().isEnabled()) {
if (settings.getGeneralProps().isSilent()) {
getLogger().setLevel(Level.WARNING);
}
if (settings.getGeneralProps().isAutoReload()) {
reloadListener = new ProxyReloadListener(this);
getProxy().getPluginManager().registerListener(this, reloadListener);
}
if (settings.getGeneralProps().isAutoReload()) {
reloadListener = new ProxyReloadListener(this);
getProxy().getPluginManager().registerListener(this, reloadListener);
}
try {
new BungeeUpdater(this, 10788);
} catch (IOException e) {
e.printStackTrace();
}
try {
new BungeeUpdater(this, 10788);
} catch (IOException e) {
e.printStackTrace();
}
networkManager = new NetworkManager(this);
sectionManager = new SectionManager(this);
networkManager = new NetworkManager(this);
try {
sectionManager = new SectionManager(this);
sectionManager.load();
statusManager = new StatusManager(this);
@ -131,16 +127,16 @@ public class PlayerBalancer extends Plugin {
}
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 {
getLogger().warning("-----------------------------------------------------");
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("-----------------------------------------------------");
}
} else {
getLogger().warning("-----------------------------------------------------");
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("-----------------------------------------------------");
} catch (Exception e) {
this.failed = true;
getLogger().severe("The plugin could not continue loading due to an unexpected exception");
e.printStackTrace();
}
}