Fix version usage in hook selection

This commit is contained in:
Phoenix616 2019-10-06 17:52:00 +01:00
parent 1c15f42a09
commit a41bf653fb

View File

@ -56,7 +56,7 @@ public class HookManager implements Listener, ProtectionHook, WorldborderHook {
private void registerHook(Plugin plugin) {
String path = getClass().getPackage().getName() + ".plugin." + plugin.getName();
String version = plugin.getDescription().getVersion();
String version = plugin.getDescription().getVersion().replace('.', '_').replace('-', '_');
Class<?> hookClass = null;
do {
try {
@ -65,8 +65,8 @@ public class HookManager implements Listener, ProtectionHook, WorldborderHook {
hookClass = null;
}
} catch (ClassNotFoundException ignored) {}
if (version.contains(".")) {
version = version.substring(0, version.lastIndexOf('.'));
if (version.contains("_")) {
version = version.substring(0, version.lastIndexOf('_'));
} else {
try {
hookClass = Class.forName(path + "Hook");