Skip to content

Commit

Permalink
fix version check for 3 digits
Browse files Browse the repository at this point in the history
  • Loading branch information
LordTuxn committed Oct 3, 2022
1 parent 41f238a commit 0bc53bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.alpsbte</groupId>
<artifactId>PlotSystem</artifactId>
<version>3.0</version>
<version>3.0.2</version>

<repositories>
<!-- Spigot & Bukkit -->
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/alpsbte/plotsystem/PlotSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import java.util.logging.Level;

public class PlotSystem extends JavaPlugin {
private static final String VERSION = "3.0";
private static final String VERSION = "3.0.2";

private static PlotSystem plugin;
private ConfigUtil configManager;
Expand Down Expand Up @@ -168,7 +168,7 @@ public void onEnable() {
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "Update-Checker:");

UpdateChecker.getVersion(version -> {
if (Double.parseDouble(VERSION) >= version) {
if (version.equals(VERSION)) {
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "You are using the latest stable version.");
} else {
UpdateChecker.isUpdateAvailable = true;
Expand Down Expand Up @@ -353,10 +353,10 @@ public static class UpdateChecker {
* Get latest plugin version from SpigotMC
* @param version Returns latest stable version
*/
public static void getVersion(final Consumer<Double> version) {
public static void getVersion(final Consumer<String> version) {
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openStream(); Scanner scanner = new Scanner(inputStream)) {
if (scanner.hasNext()) {
version.accept(Double.parseDouble(scanner.next()));
version.accept(scanner.next());
}
} catch (IOException ex) {
Bukkit.getLogger().log(Level.WARNING, "Cannot look for new updates: " + ex.getMessage());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
main: com.alpsbte.plotsystem.PlotSystem
version: 3.0
version: 3.0.2
api-version: 1.12.2
name: Plot-System
author: R3tuxn & Cinnazeyy
Expand Down

0 comments on commit 0bc53bb

Please sign in to comment.