some try/catch blocks for frequent wrong configs

This commit is contained in:
Boosik 2014-08-08 21:45:45 +02:00
parent ec956f8368
commit 3d594f2c03
2 changed files with 16 additions and 4 deletions

View File

@ -238,9 +238,14 @@ public class BoosCoolDownListener implements Listener {
break;
}
}
this.checkRestrictions(event, player, regexCommad, originalCommand,
warmupTime, cooldownTime, price, item, count, limit,
xpPrice);
try {
this.checkRestrictions(event, player, regexCommad, originalCommand,
warmupTime, cooldownTime, price, item, count, limit,
xpPrice);
} catch (Exception e) {
BoosCoolDown.getLog().warning("[boosCooldowns] Looks like you have deleted some important part of config file (like default group or aliases section. To get rid of this message, you have to restore it.");
return;
}
}
}

View File

@ -35,6 +35,8 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
import cz.boosik.boosCooldown.BoosCoolDown;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -307,7 +309,12 @@ public class MetricsLite {
// enabled
String pluginVersion = description.getVersion();
String serverVersion = Bukkit.getVersion();
int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
int playersOnline = 0;
try {
playersOnline = Bukkit.getServer().getOnlinePlayers().size();
} catch (Exception e) {
BoosCoolDown.getLog().warning("[boosCooldowns] This error was caused because you are using old CraftBukkit version. Please update to 1.7.10 (1.7.9-R0.3).");
}
// END server software specific section -- all code below does not use
// any code outside of this class / Java