Fixed a small code smell in LocalesManager

This commit is contained in:
Florian CUNY 2020-05-13 16:44:22 +02:00
parent ee06a55d02
commit 32e174daed
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,7 @@ public class LocalesManager {
// We cannot use Bukkit's saveResource, because we want it to go into a specific folder, so...
// Get the last part of the name
int lastIndex = name.lastIndexOf('/');
File targetFile = new File(localeDir, name.substring(lastIndex >= 0 ? lastIndex : 0));
File targetFile = new File(localeDir, name.substring(Math.max(lastIndex, 0)));
copyFile(name, targetFile);
// Update the locale file if it exists already
try (InputStreamReader in = new InputStreamReader(plugin.getResource(name))) {