fix(project): various optimizations

This commit is contained in:
ineanto 2023-12-11 13:21:30 +01:00
parent dd5aff034d
commit 3949113dee
7 changed files with 17 additions and 15 deletions

View file

@ -5,7 +5,7 @@
<option name="description" value="" /> <option name="description" value="" />
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

4
CHANGELOG.log Normal file
View file

@ -0,0 +1,4 @@
Update n°4 (11/12/23):
[OTHER]
• Various optimizations and improvements.

View file

@ -12,6 +12,12 @@ val shadowImplementation: Configuration by configurations.creating
configurations["implementation"].extendsFrom(shadowImplementation) configurations["implementation"].extendsFrom(shadowImplementation)
configurations["testImplementation"].extendsFrom(shadowImplementation) configurations["testImplementation"].extendsFrom(shadowImplementation)
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal() mavenLocal()

View file

@ -1,5 +1,6 @@
package xyz.ineanto.nicko.anvil; package xyz.ineanto.nicko.anvil;
import net.kyori.adventure.text.Component;
import net.wesjd.anvilgui.AnvilGUI; import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -120,7 +121,7 @@ public class AnvilManager {
private ItemStack getLeftItem(boolean skin) { private ItemStack getLeftItem(boolean skin) {
final ItemStack item = new ItemStack(Material.PAPER); final ItemStack item = new ItemStack(Material.PAPER);
final ItemMeta meta = item.getItemMeta(); 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); item.setItemMeta(meta);
return item; return item;
} }

View file

@ -51,7 +51,7 @@ public class I18N {
if (name == null) { if (name == null) {
logger.warning(nameKey + " doesn't exists! Please translate this entry."); 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); add(loreKey);
}}); }});
} }

View file

@ -6,22 +6,14 @@ import xyz.xenondevs.invui.util.IOUtils;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.logging.Logger;
public class LocaleFileManager { public class LocaleFileManager {
private final Logger logger = Logger.getLogger("LocaleFileManager");
private final File folder = new File(NickoBukkit.getInstance().getDataFolder() + "/lang/"); private final File folder = new File(NickoBukkit.getInstance().getDataFolder() + "/lang/");
private final File file = new File(folder, "lang.yml"); private final File file = new File(folder, "lang.yml");
private YamlConfig yamlFile; 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) { public boolean dumpFromLocale(Locale locale) {
if (locale == Locale.CUSTOM) return true; if (locale == Locale.CUSTOM) return true;
if (file.exists()) return true; if (file.exists()) return true;
@ -36,7 +28,7 @@ public class LocaleFileManager {
} }
return true; return true;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.severe("Unable to dump Locale: " + locale.getCode() + "!");
return false; return false;
} }
} }

View file

@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test;
import xyz.ineanto.nicko.NickoBukkit; import xyz.ineanto.nicko.NickoBukkit;
import xyz.ineanto.nicko.config.Configuration; import xyz.ineanto.nicko.config.Configuration;
import xyz.ineanto.nicko.config.DefaultDataSources; import xyz.ineanto.nicko.config.DefaultDataSources;
import xyz.ineanto.nicko.config.SQLDataSourceConfiguration;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;