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
This commit is contained in:
Pim van der Loos 2020-05-25 17:28:16 +02:00
parent 93bc2a3072
commit 1053e17b1d
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8
4 changed files with 7 additions and 19 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.pim16aap2</groupId>
<artifactId>ArmoredElytra</artifactId>
<version>2.4.12</version>
<version>2.4.13</version>
<repositories>
<repository>
@ -65,12 +65,6 @@
<finalName>${project.name}</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>

View File

@ -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 =
{

View File

@ -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()

View File

@ -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 +