From a1c7e9f7c25b20096651ce82417e1559d1fd4f63 Mon Sep 17 00:00:00 2001 From: LlmDl Date: Sun, 4 Jun 2023 11:26:06 -0500 Subject: [PATCH] - Remove usage of Version, using new Towny version checker instead. --- pom.xml | 4 ++-- resources/changelog.txt | 4 +++- src/com/palmergames/bukkit/TownyChat/Chat.java | 9 ++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 2cc7b36..01d2a63 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.palmergames.bukkit TownyChat jar - 0.106 + 0.107 @@ -26,7 +26,7 @@ 17 1.16 UTF-8 - 0.99.0.12 + 0.99.1.0 diff --git a/resources/changelog.txt b/resources/changelog.txt index 3e7f4b8..ea1d94b 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -461,4 +461,6 @@ v0.106: - towny.rankpriority.# - towny.rankprefix. - Fix version check, courtesy of Warrior with PR #48. - - Update min. Towny version to 0.99.1.0. \ No newline at end of file + - Update min. Towny version to 0.99.1.0. +v0.107: + - Remove usage of Version, using new Towny version checker instead. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/Chat.java b/src/com/palmergames/bukkit/TownyChat/Chat.java index feac32a..a4bda4a 100644 --- a/src/com/palmergames/bukkit/TownyChat/Chat.java +++ b/src/com/palmergames/bukkit/TownyChat/Chat.java @@ -16,7 +16,6 @@ import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.scheduling.TaskScheduler; import com.palmergames.bukkit.towny.scheduling.impl.BukkitTaskScheduler; import com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler; -import com.palmergames.bukkit.util.Version; import com.palmergames.util.FileMgmt; import org.bukkit.Bukkit; @@ -59,7 +58,7 @@ public class Chat extends JavaPlugin { private DynmapAPI dynMap = null; private Essentials essentials = null; - private static Version requiredTownyVersion = Version.fromString("0.99.1.0"); + private static String requiredTownyVersion = "0.99.1.0"; public static boolean usingPlaceholderAPI = false; public static boolean usingEssentialsDiscord = false; boolean chatConfigError = false; @@ -110,7 +109,11 @@ public class Chat extends JavaPlugin { } private boolean townyVersionCheck() { - return Version.fromString(Towny.getPlugin().getVersion()).compareTo(requiredTownyVersion) >= 0; + try { + return Towny.isTownyVersionSupported(requiredTownyVersion); + } catch (NoSuchMethodError e) { + return false; + } } private void loadConfigs() {