Compare commits

..

No commits in common. "62949948e1d55f7155b6858a8b554a7139747d72" and "463a4d7e78b97069d553527c0413cf7b5d7f7867" have entirely different histories.

66 changed files with 193 additions and 300 deletions

View File

@ -4,42 +4,25 @@ import fr.pandacube.lib.bungee.util.BungeeDailyLogRotateFileHandler;
import fr.pandacube.lib.bungee.util.PluginMessagePassthrough; import fr.pandacube.lib.bungee.util.PluginMessagePassthrough;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
/**
* General class used to initialize some tools of pandalib-bungee, following the bungee plugin's lifecycle.
*/
public class PandaLibBungee { public class PandaLibBungee {
private static Plugin plugin; private static Plugin plugin;
/**
* Method to be called in {@link Plugin#onLoad()} method.
* @param plugin the plugin instance.
*/
public static void onLoad(Plugin plugin) { public static void onLoad(Plugin plugin) {
PandaLibBungee.plugin = plugin; PandaLibBungee.plugin = plugin;
} }
/**
* Method to be called in {@link Plugin#onEnable()} method.
*/
public static void onEnable() { public static void onEnable() {
PluginMessagePassthrough.init(plugin); PluginMessagePassthrough.init(plugin);
BungeeDailyLogRotateFileHandler.init(true); BungeeDailyLogRotateFileHandler.init(true);
} }
/**
* Method to be called in {@link Plugin#onDisable()} method.
*/
public static void disable() { public static void disable() {
} }
/**
* Returns the plugin instance.
* @return the plugin instance.
*/
public static Plugin getPlugin() { public static Plugin getPlugin() {
return plugin; return plugin;
} }

View File

@ -6,33 +6,12 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* Class that holds the configuration varables for {@link BungeeBackupManager}.
*/
@SuppressWarnings("CanBeFinal") @SuppressWarnings("CanBeFinal")
public class BungeeBackupConfig { public class BungeeBackupConfig {
/**
* Tells if the working directory of the current bungee instance should be backed up.
*/
public boolean workdirBackupEnabled = true; public boolean workdirBackupEnabled = true;
/**
* Tells if the old logs of the current bungee instance should be backed up.
*/
public boolean logsBackupEnabled = true; public boolean logsBackupEnabled = true;
/**
* The cron scheduling of when the workdir backup occurs.
*/
public String scheduling = "0 2 * * *"; // cron format, here is every day at 2am public String scheduling = "0 2 * * *"; // cron format, here is every day at 2am
/**
* The destination directory for the backups.
*/
public File backupDirectory = null; public File backupDirectory = null;
/**
* The configuration handling the cleaning of the backup directory.
*/
public BackupCleaner workdirBackupCleaner = BackupCleaner.KEEPING_1_EVERY_N_MONTH(3).merge(BackupCleaner.KEEPING_N_LAST(5)); public BackupCleaner workdirBackupCleaner = BackupCleaner.KEEPING_1_EVERY_N_MONTH(3).merge(BackupCleaner.KEEPING_N_LAST(5));
/**
* A list of ignored files or directory in the workdir to exclude from the backup.
*/
public List<String> workdirIgnoreList = new ArrayList<>(); public List<String> workdirIgnoreList = new ArrayList<>();
} }

View File

@ -6,17 +6,10 @@ import fr.pandacube.lib.core.backup.RotatedLogsBackupProcess;
import java.io.File; import java.io.File;
/**
* Handles the backup processes for a Bungeecord instance.
*/
public class BungeeBackupManager extends BackupManager { public class BungeeBackupManager extends BackupManager {
BungeeBackupConfig config; BungeeBackupConfig config;
/**
* Instanciate a new {@link BungeeBackupManager}.
* @param config the configuration.
*/
public BungeeBackupManager(BungeeBackupConfig config) { public BungeeBackupManager(BungeeBackupConfig config) {
super(config.backupDirectory); super(config.backupDirectory);
setConfig(config); setConfig(config);
@ -31,19 +24,12 @@ public class BungeeBackupManager extends BackupManager {
super.addProcess(process); super.addProcess(process);
} }
/**
* Sets a new configuration for this backup manager.
* @param config the new configuration.
*/
public void setConfig(BungeeBackupConfig config) { public void setConfig(BungeeBackupConfig config) {
this.config = config; this.config = config;
backupQueue.forEach(this::updateProcessConfig); backupQueue.forEach(this::updateProcessConfig);
} }
/**
* Deploys the new configuration to the provided backup process.
* @param process the process on which to apply the new config.
*/
public void updateProcessConfig(BackupProcess process) { public void updateProcessConfig(BackupProcess process) {
if (process instanceof BungeeWorkdirProcess) { if (process instanceof BungeeWorkdirProcess) {
process.setEnabled(config.workdirBackupEnabled); process.setEnabled(config.workdirBackupEnabled);

View File

@ -5,15 +5,8 @@ import fr.pandacube.lib.core.backup.BackupProcess;
import java.io.File; import java.io.File;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
/**
* The backup process responsible for the working directory of the current Bungeecord instance.
*/
public class BungeeWorkdirProcess extends BackupProcess { public class BungeeWorkdirProcess extends BackupProcess {
/**
* Instantiates this backup process.
* @param bm the backup manager.
*/
protected BungeeWorkdirProcess(BungeeBackupManager bm) { protected BungeeWorkdirProcess(BungeeBackupManager bm) {
super(bm, "workdir"); super(bm, "workdir");
} }

View File

@ -7,7 +7,7 @@ import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import fr.pandacube.lib.commands.BrigadierCommand; import fr.pandacube.lib.commands.BrigadierCommand;
import fr.pandacube.lib.commands.SuggestionsSupplier; import fr.pandacube.lib.commands.SuggestionsSupplier;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;

View File

@ -1,6 +1,6 @@
package fr.pandacube.lib.bungee.util; package fr.pandacube.lib.bungee.util;
import fr.pandacube.lib.util.log.DailyLogRotateFileHandler; import fr.pandacube.lib.util.logs.DailyLogRotateFileHandler;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.log.ConciseFormatter; import net.md_5.bungee.log.ConciseFormatter;

View File

@ -199,7 +199,6 @@ public class ChatUtil {
/** /**
* Do like {@link String#join(CharSequence, Iterable)}, but for components. * Do like {@link String#join(CharSequence, Iterable)}, but for components.
* @param separator the separator used everywhere except between the two last components to join. * @param separator the separator used everywhere except between the two last components to join.
* @param elements the components to join.
* @return a new {@link Chat} instance with all the provided {@code component} joined using the separators. * @return a new {@link Chat} instance with all the provided {@code component} joined using the separators.
*/ */
public static FormatableChat join(ComponentLike separator, Iterable<? extends ComponentLike> elements) { public static FormatableChat join(ComponentLike separator, Iterable<? extends ComponentLike> elements) {

View File

@ -8,7 +8,7 @@ import fr.pandacube.lib.cli.log.CLILogger;
import jline.console.ConsoleReader; import jline.console.ConsoleReader;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Class to handle general standard IO operation for a CLI application. It uses Jlines {@link ConsoleReader} for the * Class to handle general standard IO operation for a CLI application. It uses Jlines {@link ConsoleReader} for the

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.cli;
import fr.pandacube.lib.cli.commands.CommandAdmin; import fr.pandacube.lib.cli.commands.CommandAdmin;
import fr.pandacube.lib.cli.commands.CommandStop; import fr.pandacube.lib.cli.commands.CommandStop;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -14,23 +14,17 @@ public abstract class CLIApplication {
private static CLIApplication instance; private static CLIApplication instance;
/**
* Returns the current application instance.
* @return the current application instance.
*/
public static CLIApplication getInstance() { public static CLIApplication getInstance() {
return instance; return instance;
} }
/**
* The instance of {@link CLI} for this application.
*/
public final CLI cli; public final CLI cli;
/**
* Creates a new application instance.
*/
protected CLIApplication() { protected CLIApplication() {
instance = this; instance = this;
CLI tmpCLI = null; CLI tmpCLI = null;
@ -62,10 +56,6 @@ public abstract class CLIApplication {
} }
} }
/**
* Returns the application's {@link Logger}.
* @return the application's {@link Logger}.
*/
public Logger getLogger() { public Logger getLogger() {
return cli.getLogger(); return cli.getLogger();
} }
@ -73,9 +63,6 @@ public abstract class CLIApplication {
private final AtomicBoolean stopping = new AtomicBoolean(false); private final AtomicBoolean stopping = new AtomicBoolean(false);
/**
* Stops this application.
*/
@SuppressWarnings("finally") @SuppressWarnings("finally")
public final void stop() { public final void stop() {
synchronized (stopping) { synchronized (stopping) {
@ -88,45 +75,25 @@ public abstract class CLIApplication {
end(); end();
} catch (Throwable t) { } catch (Throwable t) {
Log.severe("Error stopping application " + getName() + " version " + getClass().getPackage().getImplementationVersion(), t); Log.severe("Error stopping application " + getName() + " version " + getClass().getPackage().getImplementationVersion(), t);
System.exit(1);
} finally { } finally {
Log.info("Bye bye."); Log.info("Bye bye.");
System.exit(0); System.exit(0);
} }
} }
/**
* Tells if this application is currently stopping, that is the {@link #stop()} method has been called.
* @return true if the application is stopping, false otherwise.
*/
public boolean isStopping() { public boolean isStopping() {
return stopping.get(); return stopping.get();
} }
/**
* Gets the name of this application.
* @return the name of this application.
*/
public abstract String getName(); public abstract String getName();
/**
* Method to override to initialize stuff in this application.
* This method is called on instanciation of this Application.
* @throws Exception If an exception is thrown, the application will not start.
*/
protected abstract void start() throws Exception; protected abstract void start() throws Exception;
/**
* Method to override to reload specific stuff in this application.
* This method is called by using the command {@code admin reload}.
*/
public abstract void reload(); public abstract void reload();
/**
* Method to override to execute stuff when this application stops.
* This method is called once before this application terminates, possibly from a shutdown hook Thread.
*/
protected abstract void end(); protected abstract void end();

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.cli.commands; package fr.pandacube.lib.cli.commands;
import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;

View File

@ -17,7 +17,7 @@ import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.chat.Chat.FormatableChat; import fr.pandacube.lib.chat.Chat.FormatableChat;
import fr.pandacube.lib.chat.ChatTreeNode; import fr.pandacube.lib.chat.ChatTreeNode;
import fr.pandacube.lib.cli.CLIApplication; import fr.pandacube.lib.cli.CLIApplication;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import java.util.ArrayList; import java.util.ArrayList;
@ -31,9 +31,6 @@ import static fr.pandacube.lib.chat.ChatStatic.failureText;
import static fr.pandacube.lib.chat.ChatStatic.successText; import static fr.pandacube.lib.chat.ChatStatic.successText;
import static fr.pandacube.lib.chat.ChatStatic.text; import static fr.pandacube.lib.chat.ChatStatic.text;
/**
* The {@code admin} command for a {@link CLIApplication}.
*/
public class CommandAdmin extends CLIBrigadierCommand { public class CommandAdmin extends CLIBrigadierCommand {
@Override @Override

View File

@ -5,7 +5,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import fr.pandacube.lib.cli.CLIApplication; import fr.pandacube.lib.cli.CLIApplication;
/** /**
* the {@code stop} (or {@code end}) command for a {@link CLIApplication}. * /stop (/end) command.
*/ */
public class CommandStop extends CLIBrigadierCommand { public class CommandStop extends CLIBrigadierCommand {

View File

@ -1,9 +1,9 @@
package fr.pandacube.lib.cli.log; package fr.pandacube.lib.cli.log;
import fr.pandacube.lib.cli.CLI; import fr.pandacube.lib.cli.CLI;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.ThrowableUtil; import fr.pandacube.lib.util.ThrowableUtil;
import fr.pandacube.lib.util.log.DailyLogRotateFileHandler; import fr.pandacube.lib.util.logs.DailyLogRotateFileHandler;
import net.md_5.bungee.log.ColouredWriter; import net.md_5.bungee.log.ColouredWriter;
import net.md_5.bungee.log.ConciseFormatter; import net.md_5.bungee.log.ConciseFormatter;

View File

@ -10,7 +10,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.Function; import java.util.function.Function;

View File

@ -6,7 +6,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.kyori.adventure.text.ComponentLike; import net.kyori.adventure.text.ComponentLike;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.core.backup; package fr.pandacube.lib.core.backup;
import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import java.io.File; import java.io.File;

View File

@ -1,6 +1,6 @@
package fr.pandacube.lib.core.backup; package fr.pandacube.lib.core.backup;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.io.File; import java.io.File;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
@ -66,10 +66,7 @@ public class BackupManager extends TimerTask {
return backupDirectory; return backupDirectory;
} }
/**
* Tells if a backup is currently running.
* @return true if a backup is running, false otherwise.
*/
public synchronized boolean isBackupRunning() { public synchronized boolean isBackupRunning() {
return runningBackup.get() != null; return runningBackup.get() != null;
} }
@ -96,7 +93,6 @@ public class BackupManager extends TimerTask {
* Disables this backup manager, canceling scheduled backups. * Disables this backup manager, canceling scheduled backups.
* It will wait for a currently running backup to finish before returning. * It will wait for a currently running backup to finish before returning.
*/ */
@SuppressWarnings("BusyWait")
public synchronized void onDisable() { public synchronized void onDisable() {
schedulerTimer.cancel(); schedulerTimer.cancel();

View File

@ -3,7 +3,7 @@ package fr.pandacube.lib.core.backup;
import fc.cron.CronExpression; import fc.cron.CronExpression;
import fr.pandacube.lib.core.cron.CronScheduler; import fr.pandacube.lib.core.cron.CronScheduler;
import fr.pandacube.lib.util.FileUtils; import fr.pandacube.lib.util.FileUtils;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import java.io.File; import java.io.File;

View File

@ -3,7 +3,7 @@ package fr.pandacube.lib.core.backup;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import fr.pandacube.lib.core.json.Json; import fr.pandacube.lib.core.json.Json;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.core.backup; package fr.pandacube.lib.core.backup;
import com.google.common.io.Files; import com.google.common.io.Files;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import java.io.File; import java.io.File;

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.core.config; package fr.pandacube.lib.core.config;
import fr.pandacube.lib.chat.ChatColorUtil; import fr.pandacube.lib.chat.ChatColorUtil;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;

View File

@ -4,7 +4,7 @@ import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import fc.cron.CronExpression; import fc.cron.CronExpression;
import fr.pandacube.lib.core.json.Json; import fr.pandacube.lib.core.json.Json;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;

View File

@ -10,7 +10,7 @@ import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer; import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapterFactory; import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.bind.TreeTypeAdapter; import com.google.gson.internal.bind.TreeTypeAdapter;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.ThrowableUtil; import fr.pandacube.lib.util.ThrowableUtil;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;

View File

@ -5,27 +5,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
/**
* Record holding the data for {@link ProtocolVersion}, to facilitate serializing and deserializing.
* @param protocolOfVersion mapping from a version string to the corresponding protocol version number.
* @param versionsOfProtocol mapping from a protocol version number to a list of the supported MC versions.
*/
public record MinecraftVersionList( public record MinecraftVersionList(
Map<String, Integer> protocolOfVersion, Map<String, Integer> protocolOfVersion,
Map<Integer, List<String>> versionsOfProtocol Map<Integer, List<String>> versionsOfProtocol
) { ) {
/**
* Creates an empty {@link MinecraftVersionList}.
*/
public MinecraftVersionList() { public MinecraftVersionList() {
this(new TreeMap<>(MinecraftVersionUtil::compareVersions), new TreeMap<>()); this(new TreeMap<>(MinecraftVersionUtil::compareVersions), new TreeMap<>());
} }
/**
* Adds a new pair of version string and protocol version number.
* @param versionId the version string (e.g. "1.19.4").
* @param protocolVersion the protocol version number.
*/
public void add(String versionId, int protocolVersion) { public void add(String versionId, int protocolVersion) {
protocolOfVersion.put(versionId, protocolVersion); protocolOfVersion.put(versionId, protocolVersion);
List<String> versions = versionsOfProtocol.computeIfAbsent(protocolVersion, p -> new ArrayList<>()); List<String> versions = versionsOfProtocol.computeIfAbsent(protocolVersion, p -> new ArrayList<>());

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.core.mc_version; package fr.pandacube.lib.core.mc_version;
import fr.pandacube.lib.core.json.Json; import fr.pandacube.lib.core.json.Json;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.StringUtil; import fr.pandacube.lib.util.StringUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -156,9 +156,8 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @return all the {@link ProtocolVersion} currently known by this class. * @return all the {@link ProtocolVersion} currently known by this class.
*/ */
public static List<ProtocolVersion> allKnownProtocolVersions() { public static List<ProtocolVersion> allKnownProtocolVersions() {
return versionList.get().versionsOfProtocol().entrySet().stream() return versionList.get().versionsOfProtocol().keySet().stream()
.filter(e -> e.getValue() != null && !e.getValue().isEmpty()) .map(ProtocolVersion::ofProtocol)
.map(e -> new ProtocolVersion(e.getKey(), List.copyOf(e.getValue())))
.toList(); .toList();
} }

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.core.search;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -15,7 +15,7 @@ import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.Reflect;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Static class to handle most of the database operations. * Static class to handle most of the database operations.

View File

@ -26,7 +26,7 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import fr.pandacube.lib.util.EnumUtil; import fr.pandacube.lib.util.EnumUtil;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Represents an entry in a SQL table. Each subclass is for a specific table. * Represents an entry in a SQL table. Each subclass is for a specific table.

View File

@ -1,6 +1,6 @@
package fr.pandacube.lib.db; package fr.pandacube.lib.db;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* A foreign key field in a SQL table. * A foreign key field in a SQL table.

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Builder for a SQL {@code UPDATE} query. * Builder for a SQL {@code UPDATE} query.

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* A SQL {@code WHERE} expression. * A SQL {@code WHERE} expression.

View File

@ -5,7 +5,7 @@ import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.Socket; import java.net.Socket;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
public abstract class AbstractRequestExecutor { public abstract class AbstractRequestExecutor {

View File

@ -1,6 +1,6 @@
package fr.pandacube.lib.netapi.server; package fr.pandacube.lib.netapi.server;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;

View File

@ -5,7 +5,7 @@ import java.io.PrintStream;
import java.net.Socket; import java.net.Socket;
import fr.pandacube.lib.netapi.server.RequestAnalyser.BadRequestException; import fr.pandacube.lib.netapi.server.RequestAnalyser.BadRequestException;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Prends en charge un socket client et le transmet au gestionnaire de paquet * Prends en charge un socket client et le transmet au gestionnaire de paquet

View File

@ -23,7 +23,7 @@ import org.bukkit.permissions.ServerOperator;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import fr.pandacube.lib.permissions.Permissions; import fr.pandacube.lib.permissions.Permissions;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Class that integrates the {@code pandalib-permissions} system into a Bukkit/Spigot/Paper instance. * Class that integrates the {@code pandalib-permissions} system into a Bukkit/Spigot/Paper instance.

View File

@ -6,7 +6,7 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import fr.pandacube.lib.permissions.Permissions; import fr.pandacube.lib.permissions.Permissions;
import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.Reflect;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.permissions;
import fr.pandacube.lib.permissions.PermGroup; import fr.pandacube.lib.permissions.PermGroup;
import fr.pandacube.lib.permissions.Permissions; import fr.pandacube.lib.permissions.Permissions;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.milkbowl.vault.chat.Chat; import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.permission.Permission; import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View File

@ -11,7 +11,7 @@ import org.bukkit.plugin.ServicePriority;
import fr.pandacube.lib.permissions.PermPlayer; import fr.pandacube.lib.permissions.PermPlayer;
import fr.pandacube.lib.permissions.Permissions; import fr.pandacube.lib.permissions.Permissions;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/* package */ class PermissionsInjectorWEPIF { /* package */ class PermissionsInjectorWEPIF {

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.backup;
import fr.pandacube.lib.paper.scheduler.SchedulerUtil; import fr.pandacube.lib.paper.scheduler.SchedulerUtil;
import fr.pandacube.lib.paper.util.WorldUtil; import fr.pandacube.lib.paper.util.WorldUtil;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;

View File

@ -31,7 +31,7 @@ import fr.pandacube.lib.players.standalone.AbstractOffPlayer;
import fr.pandacube.lib.players.standalone.AbstractOnlinePlayer; import fr.pandacube.lib.players.standalone.AbstractOnlinePlayer;
import fr.pandacube.lib.players.standalone.AbstractPlayerManager; import fr.pandacube.lib.players.standalone.AbstractPlayerManager;
import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.wrapper.ReflectWrapper;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;

View File

@ -20,7 +20,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.paper.util.BukkitEvent; import fr.pandacube.lib.paper.util.BukkitEvent;
/** /**

View File

@ -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;
import fr.pandacube.lib.paper.util.AutoUpdatedBossBar.BarUpdater; import fr.pandacube.lib.paper.util.AutoUpdatedBossBar.BarUpdater;
import fr.pandacube.lib.players.standalone.AbstractPlayerManager; import fr.pandacube.lib.players.standalone.AbstractPlayerManager;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.MemoryUtil; import fr.pandacube.lib.util.MemoryUtil;
import fr.pandacube.lib.util.MemoryUtil.MemoryUnit; import fr.pandacube.lib.util.MemoryUtil.MemoryUnit;
import fr.pandacube.lib.util.TimeUtil; import fr.pandacube.lib.util.TimeUtil;

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.paper.players; package fr.pandacube.lib.paper.players;
import fr.pandacube.lib.paper.PandaLibPaper; import fr.pandacube.lib.paper.PandaLibPaper;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;

View File

@ -19,7 +19,7 @@ import java.util.stream.Collectors;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.Reflect;
import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectClass;
import fr.pandacube.lib.reflect.ReflectField; import fr.pandacube.lib.reflect.ReflectField;

View File

@ -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.AABB;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooStalkBlock; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooStalkBlock;
import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;

View File

@ -15,7 +15,7 @@ import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.paper.PandaLibPaper; import fr.pandacube.lib.paper.PandaLibPaper;
import net.kyori.adventure.bossbar.BossBar; import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.bossbar.BossBar.Color; import net.kyori.adventure.bossbar.BossBar.Color;

View File

@ -12,7 +12,7 @@ import org.bukkit.event.Listener;
import fr.pandacube.lib.util.BiMap; import fr.pandacube.lib.util.BiMap;
import fr.pandacube.lib.util.FileUtils; import fr.pandacube.lib.util.FileUtils;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.RandomUtil; import fr.pandacube.lib.util.RandomUtil;
public class GameWorldUtils implements Listener { public class GameWorldUtils implements Listener {

View File

@ -1,6 +1,6 @@
package fr.pandacube.lib.permissions; package fr.pandacube.lib.permissions;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.util.UUID; import java.util.UUID;

View File

@ -11,7 +11,7 @@ import fr.pandacube.lib.chat.ChatTreeNode;
import fr.pandacube.lib.permissions.PermissionExpressionParser.LiteralPermissionTester; import fr.pandacube.lib.permissions.PermissionExpressionParser.LiteralPermissionTester;
import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity;
import fr.pandacube.lib.permissions.SQLPermissions.EntityType; import fr.pandacube.lib.permissions.SQLPermissions.EntityType;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Represents an entity in the permission system, either a group or a player. * Represents an entity in the permission system, either a group or a player.

View File

@ -8,7 +8,7 @@ import java.util.function.Function;
import fr.pandacube.lib.db.DB; import fr.pandacube.lib.db.DB;
import fr.pandacube.lib.db.DBConnection; import fr.pandacube.lib.db.DBConnection;
import fr.pandacube.lib.db.DBException; import fr.pandacube.lib.db.DBException;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/** /**
* Main class for the Pandalib permission system. * Main class for the Pandalib permission system.

View File

@ -19,7 +19,7 @@ import fr.pandacube.lib.db.DB;
import fr.pandacube.lib.db.DBException; import fr.pandacube.lib.db.DBException;
import fr.pandacube.lib.db.SQLElementList; import fr.pandacube.lib.db.SQLElementList;
import fr.pandacube.lib.permissions.SQLPermissions.EntityType; import fr.pandacube.lib.permissions.SQLPermissions.EntityType;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/* package */ class PermissionsCachedBackendReader /* package */ class PermissionsCachedBackendReader
{ {

View File

@ -23,7 +23,7 @@ import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity;
import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedGroup; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedGroup;
import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedPlayer; import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedPlayer;
import fr.pandacube.lib.permissions.SQLPermissions.EntityType; import fr.pandacube.lib.permissions.SQLPermissions.EntityType;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
/* package */ class PermissionsResolver { /* package */ class PermissionsResolver {

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.reflect.wrapper;
import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.reflect.Reflect;
import fr.pandacube.lib.reflect.ReflectConstructor; import fr.pandacube.lib.reflect.ReflectConstructor;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.HashMap; import java.util.HashMap;

View File

@ -4,39 +4,43 @@ import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**
* A Supplier that cache the value the first time it is called. * Represents a lazy loaded value.
* *
* @param <T> the type of the supplied value. * The value will be computed using the Supplier provided in the
* constructor, only the first time the {@link #get()} method is
* called.
*
* @param <T> the type of the enclosed value.
*/ */
public class CachedSupplier<T> implements Supplier<T> { public class Lazy<T> implements Supplier<T> {
private T cachedValue; private T cachedValue;
private final Supplier<T> source; private final Supplier<T> supplier;
private boolean cached = false; private boolean cached = false;
/** /**
* Create a lazy value loader that will call the provided supplier to get the value. * 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. * @param s the supplier from which the value is fetched.
*/ */
public CachedSupplier(Supplier<T> s) { public Lazy(Supplier<T> s) {
source = Objects.requireNonNull(s); supplier = Objects.requireNonNull(s);
} }
/** /**
* Get the value, from cache or from the source supplier if it's not yet cached. * Get the wrapped value, from cache or from the provider if it is not yet cached.
* <p> *
* If the provider throws an exception, it will be redirected to the caller as is, and no value will be 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). * (the next call to this method will execute the supplier again).
*/ */
@Override @Override
public synchronized T get() { public synchronized T get() {
if (!cached) if (!cached)
set(source.get()); set(supplier.get());
return cachedValue; return cachedValue;
} }
/** /**
* Reset the cached value. The next call to {@link #get()} will get the value from the source. * Reset the cached value. The next call to {@link #get()} will get the value from the provider.
*/ */
public synchronized void reset() { public synchronized void reset() {
cached = false; cached = false;

View File

@ -1,31 +1,35 @@
package fr.pandacube.lib.util; package fr.pandacube.lib.util;
import fr.pandacube.lib.util.function.SupplierException;
import java.util.Objects; import java.util.Objects;
import fr.pandacube.lib.util.ThrowableUtil.SupplierException;
/** /**
* A Supplier that cache the value the first time it is called. * Represents a lazy loaded value.
* <p>
* The value will be computed using the Supplier provided in the
* constructor, only the first time the {@link #get()} method is
* called.
* *
* @param <T> the type of the supplied value. * @param <T> the type of the enclosed value.
* @param <E> the exception type that may be thrown by the source supplier. * @param <E> the exception type
*/ */
public class CachedSupplierException<T, E extends Exception> implements SupplierException<T, E> { public class LazyOrException<T, E extends Exception> implements SupplierException<T, E> {
private T cachedValue; private T cachedValue;
private final SupplierException<T, E> source; private final SupplierException<T, E> supplier;
private boolean cached = false; private boolean cached = false;
/** /**
* Create a lazy value loader that will call the provided supplier to get the value. * 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. * @param s the supplier from which the value is fetched.
*/ */
public CachedSupplierException(SupplierException<T, E> s) { public LazyOrException(SupplierException<T, E> s) {
source = Objects.requireNonNull(s); supplier = Objects.requireNonNull(s);
} }
/** /**
* Get the value, from cache or from the provider if it's not yet cached. * Get the wrapped value, from cache or from the provider if it is not yet cached.
* <p> * <p>
* If the provider throws an exception, it will be redirected to the caller as is, and no value will be 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). * (the next call to this method will execute the supplier again).
@ -33,12 +37,12 @@ public class CachedSupplierException<T, E extends Exception> implements Supplier
@Override @Override
public synchronized T get() throws E { public synchronized T get() throws E {
if (!cached) if (!cached)
set(source.get()); set(supplier.get());
return cachedValue; return cachedValue;
} }
/** /**
* Reset the cached value. The next call to {@link #get()} will get the value from the source. * Reset the cached value. The next call to {@link #get()} will get the value from the provider.
*/ */
public synchronized void reset() { public synchronized void reset() {
cached = false; cached = false;

View File

@ -1,4 +1,4 @@
package fr.pandacube.lib.util.log; package fr.pandacube.lib.util;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level; import java.util.logging.Level;

View File

@ -1,7 +1,7 @@
package fr.pandacube.lib.util; package fr.pandacube.lib.util;
import fr.pandacube.lib.util.function.RunnableException; import fr.pandacube.lib.util.ThrowableUtil.RunnableException;
import fr.pandacube.lib.util.function.SupplierException; import fr.pandacube.lib.util.ThrowableUtil.SupplierException;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@ -1,8 +1,5 @@
package fr.pandacube.lib.util; 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.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
@ -148,4 +145,101 @@ public class ThrowableUtil {
} }
/**
* A supplier that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface SupplierException<T, E extends Exception> {
/**
* 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<E extends Exception> {
/**
* 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<T, E extends Exception> {
/**
* 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<T, U, E extends Exception> {
/**
* 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<T, U, E extends Exception> {
/**
* 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<T, U, V, E extends Exception> {
/**
* 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;
}
} }

View File

@ -1,16 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A consumer that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface BiConsumerException<T, U, E extends Exception> {
/**
* 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;
}

View File

@ -1,16 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A predicate that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface PredicateException<T, E extends Exception> {
/**
* 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;
}

View File

@ -1,14 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A runnable that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface RunnableException<E extends Exception> {
/**
* Run any code implemented.
*
* @throws E if implementation failed to run.
*/
void run() throws E;
}

View File

@ -1,15 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A supplier that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface SupplierException<T, E extends Exception> {
/**
* Gets a result.
*
* @return a result.
* @throws E if implementation failed to run.
*/
T get() throws E;
}

View File

@ -1,17 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A function that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface ToIntBiFunctionException<T, U, E extends Exception> {
/**
* 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;
}

View File

@ -1,17 +0,0 @@
package fr.pandacube.lib.util.function;
/**
* A consumer that can possibly throw a checked exception.
*/
@FunctionalInterface
public interface TriConsumerException<T, U, V, E extends Exception> {
/**
* 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;
}

View File

@ -1,4 +1,4 @@
package fr.pandacube.lib.util.log; package fr.pandacube.lib.util.logs;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;

View File

@ -1,8 +1,8 @@
package fr.pandacube.lib.ws; package fr.pandacube.lib.ws;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import fr.pandacube.lib.util.log.Log; import fr.pandacube.lib.util.Log;
import fr.pandacube.lib.util.function.RunnableException; import fr.pandacube.lib.util.ThrowableUtil.RunnableException;
import fr.pandacube.lib.ws.payloads.ErrorPayload; import fr.pandacube.lib.ws.payloads.ErrorPayload;
import fr.pandacube.lib.ws.payloads.Payload; import fr.pandacube.lib.ws.payloads.Payload;