diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb index 52f4f9a..8e1e05b 100644 --- a/.idea/sonarlint/issuestore/index.pb +++ b/.idea/sonarlint/issuestore/index.pb @@ -133,4 +133,12 @@ Iplugin/src/main/java/fr/euphyllia/skyllia/cache/PlayersInIslandCache.java,3\e\ x Hplugin/src/main/java/fr/euphyllia/skyllia/cache/PositionIslandCache.java,c\f\cf2b2a23d9c3002a72b6a75e4927dc79309c93de „ -Tplugin/src/main/java/fr/euphyllia/skyllia/commands/subcommands/DeleteSubCommand.java,3\6\366be589277425a5ecfb5e630e65f1247263aca3 \ No newline at end of file +Tplugin/src/main/java/fr/euphyllia/skyllia/commands/subcommands/DeleteSubCommand.java,3\6\366be589277425a5ecfb5e630e65f1247263aca3 +p +@plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java,9\1\916463c60d0ae8d2c97da6b32e3417f47a105c62 +t +Dapi/src/main/java/fr/euphyllia/skyllia/api/utils/PositionsUtils.java,e\0\e095586531a61c3ac56a676f8b44a3027da5b661 +m +=plugin/src/main/java/fr/euphyllia/skyllia/api/InterneAPI.java,2\f\2f61143f201d1b5b0223c753fea6faf653a38450 +y +Iplugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java,b\7\b72133bcde33d3b8d28d9030735a580437d5134f \ No newline at end of file diff --git a/.idea/sonarlint/securityhotspotstore/index.pb b/.idea/sonarlint/securityhotspotstore/index.pb index 52f4f9a..8e1e05b 100644 --- a/.idea/sonarlint/securityhotspotstore/index.pb +++ b/.idea/sonarlint/securityhotspotstore/index.pb @@ -133,4 +133,12 @@ Iplugin/src/main/java/fr/euphyllia/skyllia/cache/PlayersInIslandCache.java,3\e\ x Hplugin/src/main/java/fr/euphyllia/skyllia/cache/PositionIslandCache.java,c\f\cf2b2a23d9c3002a72b6a75e4927dc79309c93de „ -Tplugin/src/main/java/fr/euphyllia/skyllia/commands/subcommands/DeleteSubCommand.java,3\6\366be589277425a5ecfb5e630e65f1247263aca3 \ No newline at end of file +Tplugin/src/main/java/fr/euphyllia/skyllia/commands/subcommands/DeleteSubCommand.java,3\6\366be589277425a5ecfb5e630e65f1247263aca3 +p +@plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java,9\1\916463c60d0ae8d2c97da6b32e3417f47a105c62 +t +Dapi/src/main/java/fr/euphyllia/skyllia/api/utils/PositionsUtils.java,e\0\e095586531a61c3ac56a676f8b44a3027da5b661 +m +=plugin/src/main/java/fr/euphyllia/skyllia/api/InterneAPI.java,2\f\2f61143f201d1b5b0223c753fea6faf653a38450 +y +Iplugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java,b\7\b72133bcde33d3b8d28d9030735a580437d5134f \ No newline at end of file diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/ConfigToml.java b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/ConfigToml.java index fb52064..591ebed 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/ConfigToml.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/ConfigToml.java @@ -36,6 +36,7 @@ public class ConfigToml { public static Map schematicWorldMap = new HashMap<>(); public static String defaultSchematicKey = "example-schem"; public static int updateCacheTimer = 60; + public static int dbVersion = 1; private static boolean verbose; public static void init(File configFile) { @@ -45,7 +46,9 @@ public static void init(File configFile) { version = getInt("config-version", 1); set("config-version", 1); - logger.log(Level.FATAL, "Lecture des config"); + if (verbose) { + logger.log(Level.INFO, "Lecture des config"); + } try { readConfig(ConfigToml.class, null); } catch (Exception e) { @@ -99,7 +102,7 @@ private static Double getDouble(@NotNull String path, Double def) { } if (tryIt instanceof Double) { // Fix issue https://github.com/Euphillya/skyllia/issues/9 return config.get(path); - } else if (tryIt instanceof Integer){ + } else if (tryIt instanceof Integer) { return (double) config.getInt(path); } else { String value = String.valueOf(config.get(path)); @@ -153,8 +156,6 @@ private static Long getLong(@NotNull String path, Long def) { return builder.build(); } - public static int dbVersion = 1; - private static void initMariaDB() { String path = "sgbd.mariadb.%s"; String hostname = getString(path.formatted("hostname"), "127.0.0.1"); diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java index 2842e01..7f30ba8 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java @@ -101,7 +101,9 @@ public static void init(File configFile) { version = getInt("config-version", 1); set("config-version", 1); - logger.log(Level.FATAL, "Lecture des config"); + if (verbose) { + logger.log(Level.INFO, "Lecture du fichier langue"); + } try { readConfig(LanguageToml.class, null); } catch (Exception e) { diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/utils/PlayerUtils.java b/plugin/src/main/java/fr/euphyllia/skyllia/utils/PlayerUtils.java index f04ec6b..3523d3b 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/utils/PlayerUtils.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/utils/PlayerUtils.java @@ -34,8 +34,7 @@ public static void teleportPlayerSpawn(Main main, Player player) { public static void updateChunk(Main main, Player player, int chunkX, int chunkZ) throws UnsupportedMinecraftVersionException { final String versionMC = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; switch (versionMC) { - case "v1_19_R3" -> - PlayerNMS.refreshPlayerChunk(main, player, chunkX, chunkZ); + case "v1_19_R3" -> PlayerNMS.refreshPlayerChunk(main, player, chunkX, chunkZ); case "v1_20_R1" -> fr.euphyllia.skyllia.utils.nms.v1_20_R1.PlayerNMS.refreshPlayerChunk(main, player, chunkX, chunkZ); case "v1_20_R2" -> diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java b/plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java index 08cf54b..fd660de 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/utils/RegionUtils.java @@ -114,6 +114,7 @@ public static Vector getMaxXRegion(World world, int regionX, int regionZ) { public static Position getRegionWithLocation(int locX, int locZ) { return getRegionInChunk(locX >> 4, locZ >> 4); } + public static Position getRegionInChunk(Position chunk) { return getRegionInChunk(chunk.regionX(), chunk.regionZ()); }