Fix version usage in hook selection

This commit is contained in:
Phoenix616 2019-10-06 17:52:00 +01:00
parent 1c15f42a09
commit a41bf653fb
1 changed files with 3 additions and 3 deletions

View File

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