From 1053e17b1db0a0dd36e0cdae087683b90e49fdc8 Mon Sep 17 00:00:00 2001 From: Pim van der Loos Date: Mon, 25 May 2020 17:28:16 +0200 Subject: [PATCH] Fix updater, compilation, and improve translation - Fixed the updater thinking a result of UP_TO_DATE meant that the plugin was outdated. This happened because this system is used like this in BigDoors in case the active BD version is a dev-build. However, AE doesn't used dev-builds. - Fixed resources being placed in the jar twice. - When the provided text file includes ".txt" in the config, the plugin won't add another ".txt" to the filename (ending up as "filename.txt.txt"). This is a bit more user-friendly. - Bumped version number to 2.4.13 --- pom.xml | 8 +------- .../nl/pim16aap2/armoredElytra/util/ConfigLoader.java | 2 +- .../pim16aap2/armoredElytra/util/UpdateManager.java | 11 +---------- .../armoredElytra/util/messages/Messages.java | 5 ++++- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 8c407f5..03b6623 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 nl.pim16aap2 ArmoredElytra - 2.4.12 + 2.4.13 @@ -65,12 +65,6 @@ ${project.name} src - - src - - **/*.java - - src/main/resources true diff --git a/src/main/java/nl/pim16aap2/armoredElytra/util/ConfigLoader.java b/src/main/java/nl/pim16aap2/armoredElytra/util/ConfigLoader.java index 1b2aed9..ded2bff 100644 --- a/src/main/java/nl/pim16aap2/armoredElytra/util/ConfigLoader.java +++ b/src/main/java/nl/pim16aap2/armoredElytra/util/ConfigLoader.java @@ -99,7 +99,7 @@ public class ConfigLoader }; String[] languageFileComment = { - "Specify a language file to be used. Note that en_US.txt will get regenerated!" + "Specify a language file to be used." }; String[] allowMultipleProtectionEnchantmentsComment = { diff --git a/src/main/java/nl/pim16aap2/armoredElytra/util/UpdateManager.java b/src/main/java/nl/pim16aap2/armoredElytra/util/UpdateManager.java index 694509a..9124eb1 100644 --- a/src/main/java/nl/pim16aap2/armoredElytra/util/UpdateManager.java +++ b/src/main/java/nl/pim16aap2/armoredElytra/util/UpdateManager.java @@ -1,7 +1,6 @@ package nl.pim16aap2.armoredElytra.util; import nl.pim16aap2.armoredElytra.ArmoredElytra; -import nl.pim16aap2.armoredElytra.util.UpdateChecker.UpdateReason; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -51,15 +50,7 @@ public final class UpdateManager if (!checkForUpdates || updater.getLastResult() == null) return false; - // There's a newer version available. - if (updater.getLastResult().requiresUpdate()) - return true; - - // The plugin is "up-to-date", but this is a dev-build, so it must be newer. - if (updater.getLastResult().getReason().equals(UpdateReason.UP_TO_DATE)) - return true; - - return false; + return updater.getLastResult().requiresUpdate(); } public void checkForUpdates() diff --git a/src/main/java/nl/pim16aap2/armoredElytra/util/messages/Messages.java b/src/main/java/nl/pim16aap2/armoredElytra/util/messages/Messages.java index 16ee82c..f81f17a 100644 --- a/src/main/java/nl/pim16aap2/armoredElytra/util/messages/Messages.java +++ b/src/main/java/nl/pim16aap2/armoredElytra/util/messages/Messages.java @@ -42,7 +42,10 @@ public class Messages public Messages(final ArmoredElytra plugin) { this.plugin = plugin; - textFile = new File(plugin.getDataFolder(), plugin.getConfigLoader().languageFile() + ".txt"); + final String fileName = plugin.getConfigLoader().languageFile(); + // Only append .txt if the provided name doesn't already have it. + textFile = new File(plugin.getDataFolder(), fileName.endsWith(".txt") ? fileName : (fileName + ".txt")); + if (!textFile.exists()) { plugin.myLogger(Level.WARNING, "Failed to load language file: \"" + textFile +