fix(project): various optimizations
This commit is contained in:
parent
dd5aff034d
commit
3949113dee
7 changed files with 17 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
|||
package xyz.ineanto.nicko.anvil;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.wesjd.anvilgui.AnvilGUI;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -120,7 +121,7 @@ public class AnvilManager {
|
|||
private ItemStack getLeftItem(boolean skin) {
|
||||
final ItemStack item = new ItemStack(Material.PAPER);
|
||||
final ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) meta.setDisplayName("§0New " + (skin ? "skin" : "name") + "...");
|
||||
if (meta != null) meta.displayName(Component.text("§0New " + (skin ? "skin" : "name") + "..."));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class I18N {
|
|||
|
||||
if (name == null) {
|
||||
logger.warning(nameKey + " doesn't exists! Please translate this entry.");
|
||||
return new ItemTranslation(nameKey, new ArrayList<>() {{
|
||||
return new ItemTranslation(nameKey, new ArrayList<String>() {{
|
||||
add(loreKey);
|
||||
}});
|
||||
}
|
||||
|
|
|
@ -6,22 +6,14 @@ import xyz.xenondevs.invui.util.IOUtils;
|
|||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class LocaleFileManager {
|
||||
private final Logger logger = Logger.getLogger("LocaleFileManager");
|
||||
private final File folder = new File(NickoBukkit.getInstance().getDataFolder() + "/lang/");
|
||||
private final File file = new File(folder, "lang.yml");
|
||||
private YamlConfig yamlFile;
|
||||
|
||||
public String getString(String key) {
|
||||
if (!file.exists()) return key;
|
||||
try (BufferedInputStream inputStream = new BufferedInputStream(Files.newInputStream(file.toPath()))) {
|
||||
final YamlConfig yamlConfig = new YamlConfig(inputStream);
|
||||
return yamlConfig.getString(key);
|
||||
} catch (IOException e) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean dumpFromLocale(Locale locale) {
|
||||
if (locale == Locale.CUSTOM) return true;
|
||||
if (file.exists()) return true;
|
||||
|
@ -36,7 +28,7 @@ public class LocaleFileManager {
|
|||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.severe("Unable to dump Locale: " + locale.getCode() + "!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test;
|
|||
import xyz.ineanto.nicko.NickoBukkit;
|
||||
import xyz.ineanto.nicko.config.Configuration;
|
||||
import xyz.ineanto.nicko.config.DefaultDataSources;
|
||||
import xyz.ineanto.nicko.config.SQLDataSourceConfiguration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue