diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..03f1bb6 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..4acc788 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index a2e8781..b0ab504 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index b2ab24c..41bc968 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.kasun OPProtector - 1.0.4 + 1.0.5 jar OPProtector @@ -73,7 +73,7 @@ com.github.stefvanschie.inventoryframework IF - 0.10.13 + 0.10.19 org.yaml diff --git a/src/main/java/org/kasun/opprotector/MainManager.java b/src/main/java/org/kasun/opprotector/MainManager.java index d5665e9..f3a1bf0 100644 --- a/src/main/java/org/kasun/opprotector/MainManager.java +++ b/src/main/java/org/kasun/opprotector/MainManager.java @@ -11,7 +11,6 @@ import org.kasun.opprotector.Punishments.PunishmentManager; import org.kasun.opprotector.Scanner.OfflineScanResult; import org.kasun.opprotector.Utils.Log; -import org.kasun.opprotector.Utils.UpdateChecker; import org.kasun.opprotector.VerificationProcess.VerificationProcessManager; import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; @@ -29,7 +28,6 @@ public class MainManager { private LiveScanner liveScanner; private IpTable ipTable; private Log log; - private UpdateChecker updateChecker; private List offlinePlayerScanResultList; private LuckPermUpdate luckPermUpdate; OPProtector plugin = OPProtector.getInstance(); @@ -43,7 +41,6 @@ public MainManager() { liveScanner = new LiveScanner(configManager); ipTable = new IpTable(); log = new Log(); - updateChecker = new UpdateChecker(plugin, "https://raw.githubusercontent.com/ka0un/OPProtector/master/ver.txt", plugin.getDescription().getVersion()); offlinePlayerScanResultList = new ArrayList<>(); luckPermUpdate = new LuckPermUpdate(); } @@ -60,7 +57,6 @@ public void reload() { setLiveScanner(new LiveScanner(configManager)); setIpTable(new IpTable()); setLog(new Log()); - setUpdateChecker(new UpdateChecker(plugin, "https://github.com/ka0un/OPProtector/blob/master/ver.txt", plugin.getDescription().getVersion())); ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); offlinePlayerScanResultList = new ArrayList<>(); luckPermUpdate = new LuckPermUpdate(); @@ -146,7 +142,4 @@ public void setLog(Log log) { this.log = log; } - public void setUpdateChecker(UpdateChecker updateChecker) { - this.updateChecker = updateChecker; - } } diff --git a/src/main/java/org/kasun/opprotector/Utils/UpdateChecker.java b/src/main/java/org/kasun/opprotector/Utils/UpdateChecker.java deleted file mode 100644 index be348b5..0000000 --- a/src/main/java/org/kasun/opprotector/Utils/UpdateChecker.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.kasun.opprotector.Utils; - -import org.bukkit.plugin.java.JavaPlugin; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; - -public class UpdateChecker { - private final JavaPlugin plugin; - private final String textFileURL; - private final String currentVersion; - - public UpdateChecker(JavaPlugin plugin, String textFileURL, String currentVersion) { - this.plugin = plugin; - this.textFileURL = textFileURL; - this.currentVersion = currentVersion; - checkForUpdates(); - } - - public void checkForUpdates() { - try { - URL url = new URL(textFileURL); - URLConnection connection = url.openConnection(); - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { - String line; - while ((line = reader.readLine()) != null) { - // Check if the line contains version information - if (line.startsWith("Version: ")) { - String latestVersion = line.substring("Version: ".length()).trim(); - - if (!latestVersion.equals(currentVersion)) { - plugin.getLogger().warning("=============================================================="); - plugin.getLogger().warning("A new version of the plugin is available: " + latestVersion); - plugin.getLogger().warning("Please update from: https://github.com/ka0un/OPProtector"); - plugin.getLogger().warning("=============================================================="); - } else { - plugin.getLogger().info("Your plugin is up to date! : " + latestVersion); - } - - return; // Exit the loop after finding version information - } - } - } - } catch (IOException e) { - plugin.getLogger().warning("Failed to check for updates: " + e.getMessage()); - } - } -}