diff --git a/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/commands/BungeeBrigadierCommand.java b/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/commands/BungeeBrigadierCommand.java index 1cb1e50..6cd030d 100644 --- a/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/commands/BungeeBrigadierCommand.java +++ b/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/commands/BungeeBrigadierCommand.java @@ -7,7 +7,7 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.tree.LiteralCommandNode; import fr.pandacube.lib.commands.BrigadierCommand; import fr.pandacube.lib.commands.SuggestionsSupplier; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; diff --git a/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/util/BungeeDailyLogRotateFileHandler.java b/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/util/BungeeDailyLogRotateFileHandler.java index e98bf66..9a2b666 100644 --- a/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/util/BungeeDailyLogRotateFileHandler.java +++ b/pandalib-bungee/src/main/java/fr/pandacube/lib/bungee/util/BungeeDailyLogRotateFileHandler.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.bungee.util; -import fr.pandacube.lib.util.logs.DailyLogRotateFileHandler; +import fr.pandacube.lib.util.log.DailyLogRotateFileHandler; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.log.ConciseFormatter; diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLI.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLI.java index b7e38f9..280735e 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLI.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLI.java @@ -8,7 +8,7 @@ import fr.pandacube.lib.cli.log.CLILogger; import jline.console.ConsoleReader; import org.fusesource.jansi.AnsiConsole; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Class to handle general standard IO operation for a CLI application. It uses Jline’s {@link ConsoleReader} for the diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLIApplication.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLIApplication.java index 58f1fcd..aea1206 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLIApplication.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/CLIApplication.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.cli; import fr.pandacube.lib.cli.commands.CommandAdmin; import fr.pandacube.lib.cli.commands.CommandStop; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Logger; diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CLIConsoleCommandSender.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CLIConsoleCommandSender.java index 213f1d2..bb491a5 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CLIConsoleCommandSender.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CLIConsoleCommandSender.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.cli.commands; import fr.pandacube.lib.chat.Chat; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.text.Component; diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CommandAdmin.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CommandAdmin.java index aae23bc..aa9706d 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CommandAdmin.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/commands/CommandAdmin.java @@ -17,7 +17,7 @@ import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.chat.Chat.FormatableChat; import fr.pandacube.lib.chat.ChatTreeNode; import fr.pandacube.lib.cli.CLIApplication; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.chat.BaseComponent; import java.util.ArrayList; diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/log/CLILogger.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/log/CLILogger.java index 82f350e..96356f1 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/log/CLILogger.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/log/CLILogger.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.cli.log; import fr.pandacube.lib.cli.CLI; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.ThrowableUtil; -import fr.pandacube.lib.util.logs.DailyLogRotateFileHandler; +import fr.pandacube.lib.util.log.DailyLogRotateFileHandler; import net.md_5.bungee.log.ColouredWriter; import net.md_5.bungee.log.ConciseFormatter; diff --git a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierCommand.java b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierCommand.java index b73e117..7e7dfc3 100644 --- a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierCommand.java +++ b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierCommand.java @@ -10,7 +10,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.tree.LiteralCommandNode; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.util.Arrays; import java.util.function.Function; diff --git a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierDispatcher.java b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierDispatcher.java index d45ea55..6602bff 100644 --- a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierDispatcher.java +++ b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/BrigadierDispatcher.java @@ -6,7 +6,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.tree.LiteralCommandNode; import fr.pandacube.lib.chat.Chat; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.kyori.adventure.text.ComponentLike; import java.util.concurrent.CompletableFuture; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupCleaner.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupCleaner.java index 9ede9f8..36e47d7 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupCleaner.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupCleaner.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.core.backup; import fr.pandacube.lib.chat.Chat; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.ChatColor; import java.io.File; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java index 16e09d7..948388c 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupManager.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.core.backup; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.io.File; import java.time.ZonedDateTime; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java index f16f5e5..f15095b 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.core.backup; import fc.cron.CronExpression; import fr.pandacube.lib.core.cron.CronScheduler; import fr.pandacube.lib.util.FileUtils; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.ChatColor; import java.io.File; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/Persist.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/Persist.java index ee01fba..c357cfa 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/Persist.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/Persist.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.core.backup; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; import fr.pandacube.lib.core.json.Json; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.io.File; import java.io.FileReader; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/RotatedLogsBackupProcess.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/RotatedLogsBackupProcess.java index 6e648d7..d6f677b 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/RotatedLogsBackupProcess.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/RotatedLogsBackupProcess.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.core.backup; import com.google.common.io.Files; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.ChatColor; import java.io.File; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java index 8b016b2..888869c 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.core.config; import fr.pandacube.lib.chat.ChatColorUtil; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.io.BufferedReader; import java.io.File; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/cron/CronScheduler.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/cron/CronScheduler.java index 6e4b709..731aeae 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/cron/CronScheduler.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/cron/CronScheduler.java @@ -4,7 +4,7 @@ import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; import fc.cron.CronExpression; import fr.pandacube.lib.core.json.Json; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.io.File; import java.io.FileReader; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/json/ThrowableAdapter.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/ThrowableAdapter.java index 20e600f..8e4805b 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/json/ThrowableAdapter.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/ThrowableAdapter.java @@ -10,7 +10,7 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.TypeAdapterFactory; import com.google.gson.internal.bind.TreeTypeAdapter; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.ThrowableUtil; import java.lang.reflect.Constructor; diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/mc_version/ProtocolVersion.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/mc_version/ProtocolVersion.java index 5d56754..8a5e512 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/mc_version/ProtocolVersion.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/mc_version/ProtocolVersion.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.core.mc_version; import fr.pandacube.lib.core.json.Json; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.StringUtil; import org.jetbrains.annotations.NotNull; @@ -156,8 +156,9 @@ public class ProtocolVersion implements Comparable { * @return all the {@link ProtocolVersion} currently known by this class. */ public static List allKnownProtocolVersions() { - return versionList.get().versionsOfProtocol().keySet().stream() - .map(ProtocolVersion::ofProtocol) + return versionList.get().versionsOfProtocol().entrySet().stream() + .filter(e -> e.getValue() != null && !e.getValue().isEmpty()) + .map(e -> new ProtocolVersion(e.getKey(), List.copyOf(e.getValue()))) .toList(); } diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java index 888934a..c3d581e 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.core.search; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.util.ArrayList; import java.util.HashMap; diff --git a/pandalib-db/src/main/java/fr/pandacube/lib/db/DB.java b/pandalib-db/src/main/java/fr/pandacube/lib/db/DB.java index db8815e..939fd7c 100644 --- a/pandalib-db/src/main/java/fr/pandacube/lib/db/DB.java +++ b/pandalib-db/src/main/java/fr/pandacube/lib/db/DB.java @@ -15,7 +15,7 @@ import java.util.Objects; import java.util.function.Consumer; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Static class to handle most of the database operations. diff --git a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLElement.java b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLElement.java index 713f6b6..c165f06 100644 --- a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLElement.java +++ b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLElement.java @@ -26,7 +26,7 @@ import java.util.UUID; import java.util.stream.Collectors; import fr.pandacube.lib.util.EnumUtil; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Represents an entry in a SQL table. Each subclass is for a specific table. diff --git a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLFKField.java b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLFKField.java index 5f49458..6c45a1c 100644 --- a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLFKField.java +++ b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLFKField.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.db; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * A foreign key field in a SQL table. diff --git a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLUpdateBuilder.java b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLUpdateBuilder.java index 5659089..7363b2c 100644 --- a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLUpdateBuilder.java +++ b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLUpdateBuilder.java @@ -6,7 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Builder for a SQL {@code UPDATE} query. diff --git a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLWhere.java b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLWhere.java index 0f14637..e907552 100644 --- a/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLWhere.java +++ b/pandalib-db/src/main/java/fr/pandacube/lib/db/SQLWhere.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * A SQL {@code WHERE} expression. diff --git a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java index b52acad..53c8aba 100644 --- a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java +++ b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java @@ -5,7 +5,7 @@ import java.io.PrintStream; import java.net.InetAddress; import java.net.Socket; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; public abstract class AbstractRequestExecutor { diff --git a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java index 697ebae..43d9fc9 100644 --- a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java +++ b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.netapi.server; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.io.IOException; import java.net.InetAddress; diff --git a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java index 85cb8c3..f8f987f 100644 --- a/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java +++ b/pandalib-netapi/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java @@ -5,7 +5,7 @@ import java.io.PrintStream; import java.net.Socket; import fr.pandacube.lib.netapi.server.RequestAnalyser.BadRequestException; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Prends en charge un socket client et le transmet au gestionnaire de paquet diff --git a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PandalibPaperPermissions.java b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PandalibPaperPermissions.java index 37d80d1..4b9cc96 100644 --- a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PandalibPaperPermissions.java +++ b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PandalibPaperPermissions.java @@ -23,7 +23,7 @@ import org.bukkit.permissions.ServerOperator; import org.bukkit.plugin.java.JavaPlugin; import fr.pandacube.lib.permissions.Permissions; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Class that integrates the {@code pandalib-permissions} system into a Bukkit/Spigot/Paper instance. diff --git a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorBukkit.java b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorBukkit.java index 5bf5b1a..ec3016e 100644 --- a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorBukkit.java +++ b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorBukkit.java @@ -6,7 +6,7 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import fr.pandacube.lib.permissions.Permissions; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; diff --git a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorVault.java b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorVault.java index 93e57f8..4fd0440 100644 --- a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorVault.java +++ b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorVault.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.permissions; import fr.pandacube.lib.permissions.PermGroup; import fr.pandacube.lib.permissions.Permissions; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.milkbowl.vault.chat.Chat; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; diff --git a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorWEPIF.java b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorWEPIF.java index 83892c5..5aa4029 100644 --- a/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorWEPIF.java +++ b/pandalib-paper-permissions/src/main/java/fr/pandacube/lib/paper/permissions/PermissionsInjectorWEPIF.java @@ -11,7 +11,7 @@ import org.bukkit.plugin.ServicePriority; import fr.pandacube.lib.permissions.PermPlayer; import fr.pandacube.lib.permissions.Permissions; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /* package */ class PermissionsInjectorWEPIF { diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/backup/PaperWorldProcess.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/backup/PaperWorldProcess.java index da18c34..a9f5d4f 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/backup/PaperWorldProcess.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/backup/PaperWorldProcess.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.backup; import fr.pandacube.lib.paper.scheduler.SchedulerUtil; import fr.pandacube.lib.paper.util.WorldUtil; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.md_5.bungee.api.ChatColor; import org.bukkit.Bukkit; import org.bukkit.World; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java index 99927d4..d204580 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java @@ -31,7 +31,7 @@ import fr.pandacube.lib.players.standalone.AbstractOffPlayer; import fr.pandacube.lib.players.standalone.AbstractOnlinePlayer; import fr.pandacube.lib.players.standalone.AbstractPlayerManager; import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import net.kyori.adventure.text.Component; import org.bukkit.Bukkit; import org.bukkit.World; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java index 72ac1d3..2dec6bd 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java @@ -20,7 +20,7 @@ import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.paper.util.BukkitEvent; /** diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java index 9afc845..adb2702 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/PerformanceAnalysisManager.java @@ -13,7 +13,7 @@ import fr.pandacube.lib.paper.scheduler.SchedulerUtil; import fr.pandacube.lib.paper.util.AutoUpdatedBossBar; import fr.pandacube.lib.paper.util.AutoUpdatedBossBar.BarUpdater; import fr.pandacube.lib.players.standalone.AbstractPlayerManager; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.MemoryUtil; import fr.pandacube.lib.util.MemoryUtil.MemoryUnit; import fr.pandacube.lib.util.TimeUtil; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/players/PaperPlayerConfigStorage.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/players/PaperPlayerConfigStorage.java index 443c886..3ab74d6 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/players/PaperPlayerConfigStorage.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/players/PaperPlayerConfigStorage.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.players; import fr.pandacube.lib.paper.PandaLibPaper; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java index 72a1e8e..92c7bb9 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java @@ -19,7 +19,7 @@ import java.util.stream.Collectors; import org.bukkit.Bukkit; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/util/BedrockBambooCollisionFixer.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/util/BedrockBambooCollisionFixer.java index 112786a..ee084a5 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/util/BedrockBambooCollisionFixer.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/util/BedrockBambooCollisionFixer.java @@ -4,7 +4,7 @@ import fr.pandacube.lib.paper.PandaLibPaper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooStalkBlock; import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java index 1382f81..0f08f68 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java @@ -15,7 +15,7 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.pandacube.lib.chat.Chat; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.paper.PandaLibPaper; import net.kyori.adventure.bossbar.BossBar; import net.kyori.adventure.bossbar.BossBar.Color; diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java index 3bb3500..f688012 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java @@ -12,7 +12,7 @@ import org.bukkit.event.Listener; import fr.pandacube.lib.util.BiMap; import fr.pandacube.lib.util.FileUtils; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.RandomUtil; public class GameWorldUtils implements Listener { diff --git a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/DefaultPlayer.java b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/DefaultPlayer.java index 084cb2c..680de1b 100644 --- a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/DefaultPlayer.java +++ b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/DefaultPlayer.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.permissions; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.util.UUID; diff --git a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java index d8f01d9..46dd270 100644 --- a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java +++ b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java @@ -11,7 +11,7 @@ import fr.pandacube.lib.chat.ChatTreeNode; import fr.pandacube.lib.permissions.PermissionExpressionParser.LiteralPermissionTester; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity; import fr.pandacube.lib.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Represents an entity in the permission system, either a group or a player. diff --git a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java index 3872205..71ef016 100644 --- a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java +++ b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java @@ -8,7 +8,7 @@ import java.util.function.Function; import fr.pandacube.lib.db.DB; import fr.pandacube.lib.db.DBConnection; import fr.pandacube.lib.db.DBException; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /** * Main class for the Pandalib permission system. diff --git a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java index 4891b96..c37ab12 100644 --- a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java +++ b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java @@ -19,7 +19,7 @@ import fr.pandacube.lib.db.DB; import fr.pandacube.lib.db.DBException; import fr.pandacube.lib.db.SQLElementList; import fr.pandacube.lib.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /* package */ class PermissionsCachedBackendReader { diff --git a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java index 9fd807f..51313d2 100644 --- a/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java +++ b/pandalib-permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java @@ -23,7 +23,7 @@ import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedGroup; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedPlayer; import fr.pandacube.lib.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; /* package */ class PermissionsResolver { diff --git a/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java index f812d5b..ad7335c 100644 --- a/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.reflect.wrapper; import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.ReflectConstructor; -import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.log.Log; import java.lang.reflect.Modifier; import java.util.HashMap; diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/Lazy.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplier.java similarity index 70% rename from pandalib-util/src/main/java/fr/pandacube/lib/util/Lazy.java rename to pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplier.java index 4f33e8a..c1c00ff 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/Lazy.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplier.java @@ -4,43 +4,39 @@ import java.util.Objects; import java.util.function.Supplier; /** - * Represents a lazy loaded value. - * - * The value will be computed using the Supplier provided in the - * constructor, only the first time the {@link #get()} method is - * called. + * A Supplier that cache the value the first time it is called. * - * @param the type of the enclosed value. + * @param the type of the supplied value. */ -public class Lazy implements Supplier { +public class CachedSupplier implements Supplier { private T cachedValue; - private final Supplier supplier; + private final Supplier source; private boolean cached = false; /** * Create a lazy value loader that will call the provided supplier to get the value. * @param s the supplier from which the value is fetched. */ - public Lazy(Supplier s) { - supplier = Objects.requireNonNull(s); + public CachedSupplier(Supplier s) { + source = Objects.requireNonNull(s); } /** - * Get the wrapped value, from cache or from the provider if it is not yet cached. - * + * Get the value, from cache or from the source supplier if it's not yet cached. + *

* If the provider throws an exception, it will be redirected to the caller as is, and no value will be cached * (the next call to this method will execute the supplier again). */ @Override public synchronized T get() { if (!cached) - set(supplier.get()); + set(source.get()); return cachedValue; } /** - * Reset the cached value. The next call to {@link #get()} will get the value from the provider. + * Reset the cached value. The next call to {@link #get()} will get the value from the source. */ public synchronized void reset() { cached = false; diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/LazyOrException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplierException.java similarity index 63% rename from pandalib-util/src/main/java/fr/pandacube/lib/util/LazyOrException.java rename to pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplierException.java index 1dd1e45..98d1c76 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/LazyOrException.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/CachedSupplierException.java @@ -1,35 +1,31 @@ package fr.pandacube.lib.util; +import fr.pandacube.lib.util.function.SupplierException; + import java.util.Objects; -import fr.pandacube.lib.util.ThrowableUtil.SupplierException; - /** - * Represents a lazy loaded value. - *

- * The value will be computed using the Supplier provided in the - * constructor, only the first time the {@link #get()} method is - * called. + * A Supplier that cache the value the first time it is called. * - * @param the type of the enclosed value. - * @param the exception type + * @param the type of the supplied value. + * @param the exception type that may be thrown by the source supplier. */ -public class LazyOrException implements SupplierException { +public class CachedSupplierException implements SupplierException { private T cachedValue; - private final SupplierException supplier; + private final SupplierException source; private boolean cached = false; /** * Create a lazy value loader that will call the provided supplier to get the value. * @param s the supplier from which the value is fetched. */ - public LazyOrException(SupplierException s) { - supplier = Objects.requireNonNull(s); + public CachedSupplierException(SupplierException s) { + source = Objects.requireNonNull(s); } /** - * Get the wrapped value, from cache or from the provider if it is not yet cached. + * Get the value, from cache or from the provider if it's not yet cached. *

* If the provider throws an exception, it will be redirected to the caller as is, and no value will be cached * (the next call to this method will execute the supplier again). @@ -37,12 +33,12 @@ public class LazyOrException implements SupplierExceptio @Override public synchronized T get() throws E { if (!cached) - set(supplier.get()); + set(source.get()); return cachedValue; } /** - * Reset the cached value. The next call to {@link #get()} will get the value from the provider. + * Reset the cached value. The next call to {@link #get()} will get the value from the source. */ public synchronized void reset() { cached = false; diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableAccumulator.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableAccumulator.java index 37c66aa..0a702a3 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableAccumulator.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableAccumulator.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.util; -import fr.pandacube.lib.util.ThrowableUtil.RunnableException; -import fr.pandacube.lib.util.ThrowableUtil.SupplierException; +import fr.pandacube.lib.util.function.RunnableException; +import fr.pandacube.lib.util.function.SupplierException; import java.util.function.Supplier; diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java index 293a1d6..ae0206a 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java @@ -1,5 +1,8 @@ package fr.pandacube.lib.util; +import fr.pandacube.lib.util.function.RunnableException; +import fr.pandacube.lib.util.function.SupplierException; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; @@ -145,101 +148,4 @@ public class ThrowableUtil { } - - - - - - - - /** - * A supplier that can possibly throw a checked exception. - */ - @FunctionalInterface - public interface SupplierException { - /** - * Gets a result. - * @return a result. - * @throws E if implementation failed to run. - */ - T get() throws E; - } - - - - /** - * A runnable that can possibly throw a checked exception. - */ - @FunctionalInterface - public interface RunnableException { - /** - * Run any code implemented. - * @throws E if implementation failed to run. - */ - void run() throws E; - } - - - - /** - * A predicate that can possibly throw a checked exception. - */ - @FunctionalInterface - public interface PredicateException { - /** - * Test the predicate on the specified value. - * @param value the value to test against. - * @return the result of the test. - * @throws E if implementation failed to run. - */ - boolean test(T value) throws E; - } - - - - /** - * A function that can possibly throw a checked exception. - */ - public interface ToIntBiFunctionException { - /** - * Run on the specified parameters to return an int value. - * @param t the first parameter of the function. - * @param u the second parameter of the function. - * @return the result of the function. - * @throws E if the function fails. - */ - int applyAsInt(T t, U u) throws E; - } - - - - /** - * A consumer that can possibly throw a checked exception. - */ - public interface BiConsumerException { - /** - * Run the consumer on the specified parameters. - * @param t the first parameter of the consumer. - * @param u the second parameter of the consumer. - * @throws E if the function fails. - */ - void accept(T t, U u) throws E; - } - - - - /** - * A consumer that can possibly throw a checked exception. - */ - public interface TriConsumerException { - /** - * Run the consumer on the specified parameters. - * @param t the first parameter of the consumer. - * @param u the second parameter of the consumer. - * @param v the tird parameter of the consumer. - * @throws E if the function fails. - */ - void accept(T t, U u, V v) throws E; - } - } diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/BiConsumerException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/BiConsumerException.java new file mode 100644 index 0000000..12d80b4 --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/BiConsumerException.java @@ -0,0 +1,16 @@ +package fr.pandacube.lib.util.function; + +/** + * A consumer that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface BiConsumerException { + /** + * Run the consumer on the specified parameters. + * + * @param t the first parameter of the consumer. + * @param u the second parameter of the consumer. + * @throws E if the function fails. + */ + void accept(T t, U u) throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/PredicateException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/PredicateException.java new file mode 100644 index 0000000..2c2930f --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/PredicateException.java @@ -0,0 +1,16 @@ +package fr.pandacube.lib.util.function; + +/** + * A predicate that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface PredicateException { + /** + * Test the predicate on the specified value. + * + * @param value the value to test against. + * @return the result of the test. + * @throws E if implementation failed to run. + */ + boolean test(T value) throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/RunnableException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/RunnableException.java new file mode 100644 index 0000000..3b297f9 --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/RunnableException.java @@ -0,0 +1,14 @@ +package fr.pandacube.lib.util.function; + +/** + * A runnable that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface RunnableException { + /** + * Run any code implemented. + * + * @throws E if implementation failed to run. + */ + void run() throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/SupplierException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/SupplierException.java new file mode 100644 index 0000000..bf28c04 --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/SupplierException.java @@ -0,0 +1,15 @@ +package fr.pandacube.lib.util.function; + +/** + * A supplier that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface SupplierException { + /** + * Gets a result. + * + * @return a result. + * @throws E if implementation failed to run. + */ + T get() throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/ToIntBiFunctionException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/ToIntBiFunctionException.java new file mode 100644 index 0000000..fedf211 --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/ToIntBiFunctionException.java @@ -0,0 +1,17 @@ +package fr.pandacube.lib.util.function; + +/** + * A function that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface ToIntBiFunctionException { + /** + * Run on the specified parameters to return an int value. + * + * @param t the first parameter of the function. + * @param u the second parameter of the function. + * @return the result of the function. + * @throws E if the function fails. + */ + int applyAsInt(T t, U u) throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/TriConsumerException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/TriConsumerException.java new file mode 100644 index 0000000..bac1b2e --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/TriConsumerException.java @@ -0,0 +1,17 @@ +package fr.pandacube.lib.util.function; + +/** + * A consumer that can possibly throw a checked exception. + */ +@FunctionalInterface +public interface TriConsumerException { + /** + * Run the consumer on the specified parameters. + * + * @param t the first parameter of the consumer. + * @param u the second parameter of the consumer. + * @param v the third parameter of the consumer. + * @throws E if the function fails. + */ + void accept(T t, U u, V v) throws E; +} diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/logs/DailyLogRotateFileHandler.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/log/DailyLogRotateFileHandler.java similarity index 98% rename from pandalib-util/src/main/java/fr/pandacube/lib/util/logs/DailyLogRotateFileHandler.java rename to pandalib-util/src/main/java/fr/pandacube/lib/util/log/DailyLogRotateFileHandler.java index 15135bf..5766923 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/logs/DailyLogRotateFileHandler.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/log/DailyLogRotateFileHandler.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.util.logs; +package fr.pandacube.lib.util.log; import java.io.BufferedWriter; import java.io.File; diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/Log.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/log/Log.java similarity index 99% rename from pandalib-util/src/main/java/fr/pandacube/lib/util/Log.java rename to pandalib-util/src/main/java/fr/pandacube/lib/util/log/Log.java index 7196c92..d283bac 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/Log.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/log/Log.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.util; +package fr.pandacube.lib.util.log; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; diff --git a/pandalib-ws/src/main/java/fr/pandacube/lib/ws/AbstractWS.java b/pandalib-ws/src/main/java/fr/pandacube/lib/ws/AbstractWS.java index e08b7bf..70813e4 100644 --- a/pandalib-ws/src/main/java/fr/pandacube/lib/ws/AbstractWS.java +++ b/pandalib-ws/src/main/java/fr/pandacube/lib/ws/AbstractWS.java @@ -1,8 +1,8 @@ package fr.pandacube.lib.ws; import com.google.gson.JsonParseException; -import fr.pandacube.lib.util.Log; -import fr.pandacube.lib.util.ThrowableUtil.RunnableException; +import fr.pandacube.lib.util.log.Log; +import fr.pandacube.lib.util.function.RunnableException; import fr.pandacube.lib.ws.payloads.ErrorPayload; import fr.pandacube.lib.ws.payloads.Payload;