diff --git a/pom.xml b/pom.xml index 38d7a63..0e85629 100644 --- a/pom.xml +++ b/pom.xml @@ -2,14 +2,14 @@ 4.0.0 io.github.townyadvanced TownyResources - 0.9.0 + 0.10.0 townyresources 17 1.15 UTF-8 - 0.100.1.0 + 0.100.4.0 diff --git a/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java b/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java index 970f976..9c6d33b 100644 --- a/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java +++ b/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java @@ -1,5 +1,6 @@ package io.github.townyadvanced.townyresources; +import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.TownyAPI; import com.palmergames.bukkit.towny.exceptions.TownyException; import com.palmergames.bukkit.towny.exceptions.initialization.TownyInitException; @@ -10,8 +11,6 @@ import com.palmergames.bukkit.towny.scheduling.impl.BukkitTaskScheduler; import com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler; import com.palmergames.bukkit.util.Colors; -import com.palmergames.bukkit.util.Version; - import io.github.townyadvanced.townyresources.commands.NationCollectAddon; import io.github.townyadvanced.townyresources.commands.TownResourcesAddon; import io.github.townyadvanced.townyresources.commands.TownyAdminResourcesAddon; @@ -39,7 +38,7 @@ public class TownyResources extends JavaPlugin { private static TownyResources plugin; private final TaskScheduler scheduler; - private static Version requiredTownyVersion = Version.fromString("0.99.0.6"); + private static String requiredTownyVersion = "0.100.4.0"; private static boolean siegeWarInstalled; private static boolean dynmapTownyInstalled; private static boolean mapTownyInstalled; @@ -274,13 +273,12 @@ public boolean isMMOItemsInstalled() { return mmmoItemsInstalled; } - private String getTownyVersion() { - return Bukkit.getPluginManager().getPlugin("Towny").getDescription().getVersion(); - } - private void townyVersionCheck() throws TownyException{ - if (!(Version.fromString(getTownyVersion()).compareTo(requiredTownyVersion) >= 0)) - throw new TownyException("Towny version does not meet required minimum version: " + requiredTownyVersion.toString()); + try { + if (Towny.isTownyVersionSupported(requiredTownyVersion)) + return; + } catch (NoSuchMethodError ignored) {} + throw new TownyException("Towny version does not meet required minimum version: " + requiredTownyVersion.toString()); } private void setupIntegrationsWithOtherPlugins() {