Properly disable plugin, throw custom exception when plugin is incompatible

This commit is contained in:
Shevchik
2014-03-23 01:49:12 +04:00
parent 185b70cf54
commit 8232518abb
3 changed files with 20 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ public class NMSAccess {
private Class<?> nmsArrowClass;
public void setupVehicleArrow() throws Exception {
public void setupVehicleArrow() throws NMSAccessException, ClassNotFoundException {
String pkgname = getClass().getPackage().getName();
String packageName = Bukkit.getServer().getClass().getPackage().getName();
String nmspackageversion = packageName.substring(packageName.lastIndexOf('.') + 1);
@@ -26,7 +26,7 @@ public class NMSAccess {
return;
}
}
throw new Exception("ChairsReloaded is not compatible with your server version");
throw new NMSAccessException("ChairsReloaded is not compatible with your server version");
}
public Arrow spawnArrow(Location location) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {

View File

@@ -0,0 +1,11 @@
package com.cnaude.chairs.vehiclearrow;
public class NMSAccessException extends Exception {
private static final long serialVersionUID = -839103433400420225L;
public NMSAccessException(String message) {
super(message);
}
}