diff --git a/.gitignore b/.gitignore index 757fee3..ef1ca3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/.idea \ No newline at end of file +/.idea +/*/target +dependency-reduced-pom.xml \ No newline at end of file diff --git a/Bungee/pom.xml b/Bungee/pom.xml index 8fb5861..3a813aa 100644 --- a/Bungee/pom.xml +++ b/Bungee/pom.xml @@ -8,36 +8,30 @@ pandalib-bungee - - PandaLib-Bungee - - - - papermc - https://papermc.io/repo/repository/maven-public/ - - + jar + + + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + + fr.pandacube.lib pandalib-core ${project.version} - compile - - - - - - fr.pandacube.bungeecord - bungeecord-proxy - ${bungeecord.version} - compile - - + + + net.md-5 + bungeecord-api + ${bungeecord.version} + + + + \ No newline at end of file diff --git a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java b/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java deleted file mode 100644 index cc1bae5..0000000 --- a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java +++ /dev/null @@ -1,229 +0,0 @@ -package fr.pandacube.lib.bungee.commands; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import com.mojang.brigadier.arguments.ArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.builder.RequiredArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.context.ParsedCommandNode; -import com.mojang.brigadier.context.StringRange; -import com.mojang.brigadier.suggestion.Suggestion; -import com.mojang.brigadier.suggestion.SuggestionProvider; -import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import com.mojang.brigadier.tree.LiteralCommandNode; - -import fr.pandacube.lib.core.chat.ChatStatic; -import fr.pandacube.lib.core.commands.SuggestionsSupplier; -import fr.pandacube.lib.core.players.IPlayerManager; -import fr.pandacube.lib.core.players.PlayerFinder; -import fr.pandacube.lib.core.util.Log; -import fr.pandacube.lib.core.util.Reflect; -import net.md_5.bungee.BungeeCord; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.plugin.Command; -import net.md_5.bungee.api.plugin.TabExecutor; -import net.md_5.bungee.command.ConsoleCommandSender; - -public abstract class BrigadierCommand extends ChatStatic { - - protected BrigadierDispatcher dispatcher; - - public BrigadierCommand() { - if (BrigadierDispatcher.getInstance() == null) { - throw new IllegalStateException("BrigadierDispatcher is not yet initialized."); - } - dispatcher = BrigadierDispatcher.getInstance(); - - LiteralArgumentBuilder builder; - String[] aliases; - - try { - builder = buildCommand(); - aliases = getAliases(); - } catch (Exception e) { - Log.severe("Exception encountered when building Brigadier command " + getClass().getName(), e); - return; - } - if (aliases == null) - aliases = new String[0]; - - LiteralCommandNode commandNode = dispatcher.register(builder); - - // still have to be registered for console - BungeeCord.getInstance().getPluginManager().registerCommand(dispatcher.plugin, new CommandRelay(commandNode.getLiteral())); - - for (String alias : aliases) { - dispatcher.register(literal(alias) - .requires(commandNode.getRequirement()) - .executes(commandNode.getCommand()) - .redirect(commandNode) - ); - - BungeeCord.getInstance().getPluginManager().registerCommand(dispatcher.plugin, new CommandRelay(alias)); - } - - } - - private class CommandRelay extends Command implements TabExecutor { - private final String alias; - public CommandRelay(String alias) { - super(alias); - this.alias = alias; - } - @Override - public void execute(CommandSender sender, String[] args) { - dispatcher.execute(sender, alias + (args.length == 0 ? "" : (" " + String.join(" ", args)))); - } - @Override - public Iterable onTabComplete(CommandSender sender, String[] args) { - - String cursor = "/" + alias + " " + String.join(" ", args); - - StringRange supportedRange = StringRange.between(cursor.lastIndexOf(' ') + 1, cursor.length()); - - Suggestions suggestions = dispatcher.getSuggestions(sender, cursor.substring(1)); - if (!suggestions.getRange().equals(supportedRange)) - return Collections.emptyList(); - - return suggestions.getList() - .stream() - .filter(s -> s.getRange().equals(supportedRange)) - .map(Suggestion::getText) - .collect(Collectors.toList()); - } - } - - protected abstract LiteralArgumentBuilder buildCommand(); - - protected String[] getAliases() { - return new String[0]; - } - - - - - public static LiteralArgumentBuilder literal(String name) { - return LiteralArgumentBuilder.literal(name); - } - - public static RequiredArgumentBuilder argument(String name, ArgumentType type) { - return RequiredArgumentBuilder.argument(name, type); - } - - public static Predicate hasPermission(String permission) { - return sender -> sender.hasPermission(permission); - } - - public static Predicate isPlayer() { - return BrigadierCommand::isPlayer; - } - - public static boolean isPlayer(CommandSender sender) { - return sender instanceof ProxiedPlayer; - } - - public static Predicate isConsole() { - return BrigadierCommand::isConsole; - } - - public static boolean isConsole(CommandSender sender) { - return sender instanceof ConsoleCommandSender; - } - - - public static boolean isLiteralParsed(CommandContext context, String literal) { - for (ParsedCommandNode node : context.getNodes()) { - if (!(node.getNode() instanceof LiteralCommandNode)) - continue; - if (((LiteralCommandNode)node.getNode()).getLiteral().equals(literal)) - return true; - } - return false; - } - - public static T tryGetArgument(CommandContext context, String argument, Class type) { - return tryGetArgument(context, argument, type, null); - } - - public static T tryGetArgument(CommandContext context, String argument, Class type, T deflt) { - try { - return context.getArgument(argument, type); - } catch (IllegalArgumentException e) { - return deflt; - } - } - - - - - protected static SuggestionProvider wrapSuggestions(SuggestionsSupplier suggestions) { - return (context, builder) -> { - CommandSender sender = context.getSource(); - String message = builder.getInput(); - try { - int tokenStartPos = builder.getStart(); - - int firstSpacePos = message.indexOf(" "); - String[] args = (firstSpacePos + 1 > tokenStartPos - 1) ? new String[0] - : message.substring(firstSpacePos + 1, tokenStartPos - 1).split(" ", -1); - args = Arrays.copyOf(args, args.length + 1); - args[args.length - 1] = message.substring(tokenStartPos); - - List results = suggestions.getSuggestions(sender, args.length - 1, args[args.length - 1], args); - - for (String s : results) { - if (s != null) - builder.suggest(s); - } - } catch (Throwable e) { - Log.severe("Error while tab-completing '" + message + "' for " + sender.getName(), e); - } - return completableFutureSuggestionsKeepsOriginalOrdering(builder); - }; - } - - - - - public static CompletableFuture completableFutureSuggestionsKeepsOriginalOrdering(SuggestionsBuilder builder) { - return CompletableFuture.completedFuture( - BrigadierDispatcher.createSuggestionsOriginalOrdering(builder.getInput(), getSuggestionsFromSuggestionsBuilder(builder)) - ); - } - - @SuppressWarnings("unchecked") - private static List getSuggestionsFromSuggestionsBuilder(SuggestionsBuilder builder) { - try { - return (List) Reflect.ofClass(SuggestionsBuilder.class).field("result").getValue(builder); - } catch (ReflectiveOperationException e) { - throw new RuntimeException(e); - } - } - - - - - - - - public static final SuggestionsSupplier TAB_PLAYER_CURRENT_SERVER = (sender, ti, token, a) -> SuggestionsSupplier.collectFilteredStream( - IPlayerManager.getInstance().getNamesOnlyVisibleFor((sender instanceof ProxiedPlayer pl) ? pl.getUniqueId() : null, sender instanceof ProxiedPlayer).stream(), - token); - - public static final SuggestionsSupplier TAB_PLAYER_ALL_SERVERS = (sender, ti, token, a) -> SuggestionsSupplier.collectFilteredStream( - IPlayerManager.getInstance().getNamesOnlyVisibleFor((sender instanceof ProxiedPlayer pl) ? pl.getUniqueId() : null, false).stream(), - token); - - public static final SuggestionsSupplier TAB_PLAYER_ALL_SERVERS_THEN_OFFLINE = TAB_PLAYER_ALL_SERVERS.orIfEmpty(PlayerFinder.TAB_PLAYER_OFFLINE()); - - - -} \ No newline at end of file diff --git a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierDispatcher.java b/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierDispatcher.java deleted file mode 100644 index f4bb3c7..0000000 --- a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierDispatcher.java +++ /dev/null @@ -1,218 +0,0 @@ -package fr.pandacube.lib.bungee.commands; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.ParseResults; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.context.CommandContextBuilder; -import com.mojang.brigadier.context.StringRange; -import com.mojang.brigadier.context.SuggestionContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.suggestion.Suggestion; -import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import com.mojang.brigadier.tree.CommandNode; -import com.mojang.brigadier.tree.LiteralCommandNode; - -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.util.Log; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.ChatEvent; -import net.md_5.bungee.api.event.CommandsDeclareEvent; -import net.md_5.bungee.api.event.TabCompleteRequestEvent; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.api.plugin.Plugin; -import net.md_5.bungee.event.EventHandler; - -public class BrigadierDispatcher implements Listener { - - private static BrigadierDispatcher instance = null; - - public static synchronized void init(Plugin plugin) { - instance = new BrigadierDispatcher(plugin); - } - - public static synchronized BrigadierDispatcher getInstance() { - return instance; - } - - - - - - private final CommandDispatcher dispatcher; - /* package */ final Plugin plugin; - - private BrigadierDispatcher(Plugin pl) { - plugin = pl; - dispatcher = new CommandDispatcher<>(); - ProxyServer.getInstance().getPluginManager().registerListener(plugin, this); - } - - - - /* package */ LiteralCommandNode register(LiteralArgumentBuilder node) { - return dispatcher.register(node); - } - - - public CommandDispatcher getDispatcher() { - return dispatcher; - } - - - - @EventHandler - public void onCommandsDeclare(CommandsDeclareEvent event) { - dispatcher.getRoot().getChildren().forEach(node -> { - event.getRoot().getChildren().remove(event.getRoot().getChild(node.getName())); // may not work in the future - event.getRoot().addChild(node); - }); - } - - - - @EventHandler - public void onTabComplete(TabCompleteRequestEvent event) { - if (!event.getCursor().startsWith("/")) - return; - - String commandLine = event.getCursor().substring(1); - - String commandName = commandLine.split(" ", -1)[0]; - - if (dispatcher.getRoot().getChild(commandName) == null) - return; - - Suggestions suggestions = getSuggestions((ProxiedPlayer) event.getSender(), commandLine); - - // shift suggestion range 1 to the right to consider the / - suggestions = new Suggestions(new StringRange(suggestions.getRange().getStart() + 1, suggestions.getRange().getEnd() + 1), suggestions.getList()); - - event.setSuggestions(suggestions); - } - - - - @EventHandler - public void onChat(ChatEvent event) { - if (!event.getMessage().startsWith("/")) - return; - - String commandLine = event.getMessage().substring(1); - - String commandName = commandLine.split(" ", -1)[0]; - - if (dispatcher.getRoot().getChild(commandName) == null) - return; - - event.setCancelled(true); - - ProxyServer.getInstance().getScheduler().runAsync(plugin, () -> execute((ProxiedPlayer) event.getSender(), commandLine)); - - } - - - - - /* package */ void execute(CommandSender sender, String commandWithoutSlash) { - ParseResults parsed = dispatcher.parse(commandWithoutSlash, sender); - - try { - dispatcher.execute(parsed); - } catch (CommandSyntaxException e) { - sender.sendMessage(Chat.failureText("Erreur d'utilisation de la commande : " + e.getMessage()).get()); - } catch (Throwable e) { - sender.sendMessage(Chat.failureText("Erreur lors de l'exécution de la commande : " + e.getMessage()).get()); - Log.severe(e); - } - - } - - /* package */ Suggestions getSuggestions(CommandSender sender, String buffer) { - ParseResults parsed = dispatcher.parse(buffer, sender); - try { - CompletableFuture futureSuggestions = buildSuggestionBrigadier(parsed); - return futureSuggestions.join(); - } catch (Throwable e) { - sender.sendMessage(Chat.failureText("Erreur d’exécution des suggestions :\n" + e.getMessage()).get()); - Log.severe(e); - return Suggestions.empty().join(); - } - } - - - - CompletableFuture buildSuggestionBrigadier(ParseResults parsed) { - int cursor = parsed.getReader().getTotalLength(); - final CommandContextBuilder context = parsed.getContext(); - - final SuggestionContext nodeBeforeCursor = context.findSuggestionContext(cursor); - final CommandNode parent = nodeBeforeCursor.parent; - final int start = Math.min(nodeBeforeCursor.startPos, cursor); - - final String fullInput = parsed.getReader().getString(); - final String truncatedInput = fullInput.substring(0, cursor); - @SuppressWarnings("unchecked") final CompletableFuture[] futures = new CompletableFuture[parent.getChildren().size()]; - int i = 0; - for (final CommandNode node : parent.getChildren()) { - CompletableFuture future = Suggestions.empty(); - try { - future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, start)); - } catch (final CommandSyntaxException ignored) { - } - futures[i++] = future; - } - - final CompletableFuture result = new CompletableFuture<>(); - CompletableFuture.allOf(futures).thenRun(() -> { - final List suggestions = new ArrayList<>(); - for (final CompletableFuture future : futures) { - suggestions.add(future.join()); - } - result.complete(mergeSuggestionsOriginalOrdering(fullInput, suggestions)); - }); - return result; - } - - // inspired from com.mojang.brigadier.suggestion.Suggestions#merge, but without the sorting part - public static Suggestions mergeSuggestionsOriginalOrdering(String input, Collection suggestions) { - if (suggestions.isEmpty()) { - return new Suggestions(StringRange.at(0), new ArrayList<>(0)); - } else if (suggestions.size() == 1) { - return suggestions.iterator().next(); - } - - final List texts = new ArrayList<>(); - for (final Suggestions suggestions1 : suggestions) { - texts.addAll(suggestions1.getList()); - } - return createSuggestionsOriginalOrdering(input, texts); - } - - // inspired from com.mojang.brigadier.suggestion.Suggestions#create, but without the sorting part - public static Suggestions createSuggestionsOriginalOrdering(String command, Collection suggestions) { - if (suggestions.isEmpty()) { - return new Suggestions(StringRange.at(0), new ArrayList<>(0)); - } - int start = Integer.MAX_VALUE; - int end = Integer.MIN_VALUE; - for (final Suggestion suggestion : suggestions) { - start = Math.min(suggestion.getRange().getStart(), start); - end = Math.max(suggestion.getRange().getEnd(), end); - } - final StringRange range = new StringRange(start, end); - final List texts = new ArrayList<>(suggestions.size()); - for (final Suggestion suggestion : suggestions) { - texts.add(suggestion.expand(command, range)); - } - return new Suggestions(range, texts); - } - -} diff --git a/CLI/pom.xml b/CLI/pom.xml index 8504951..2cfe346 100644 --- a/CLI/pom.xml +++ b/CLI/pom.xml @@ -8,8 +8,7 @@ pandalib-cli - - PandaLib-CLI + jar @@ -17,7 +16,11 @@ Minecraft Libraries https://libraries.minecraft.net - + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + + @@ -28,13 +31,13 @@ - fr.pandacube.bungeecord + net.md-5 bungeecord-log ${bungeecord.version} compile - fr.pandacube.bungeecord + net.md-5 bungeecord-config ${bungeecord.version} compile diff --git a/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java b/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java index b857351..0739595 100644 --- a/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java +++ b/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java @@ -15,10 +15,10 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.tree.LiteralCommandNode; -import fr.pandacube.lib.core.chat.ChatStatic; +import fr.pandacube.lib.chat.ChatStatic; import fr.pandacube.lib.core.commands.SuggestionsSupplier; -import fr.pandacube.lib.core.util.Log; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.reflect.Reflect; public abstract class BrigadierCommand extends ChatStatic { diff --git a/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierDispatcher.java b/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierDispatcher.java index 51930de..1d68bee 100644 --- a/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierDispatcher.java +++ b/CLI/src/main/java/fr/pandacube/lib/cli/BrigadierDispatcher.java @@ -18,7 +18,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.LiteralCommandNode; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; import jline.console.completer.Completer; public class BrigadierDispatcher implements Completer { diff --git a/CLI/src/main/java/fr/pandacube/lib/cli/CLI.java b/CLI/src/main/java/fr/pandacube/lib/cli/CLI.java index 63f6828..fc8a02c 100644 --- a/CLI/src/main/java/fr/pandacube/lib/cli/CLI.java +++ b/CLI/src/main/java/fr/pandacube/lib/cli/CLI.java @@ -3,10 +3,10 @@ package fr.pandacube.lib.cli; import java.io.IOException; import java.util.logging.Logger; +import jline.console.ConsoleReader; import org.fusesource.jansi.AnsiConsole; -import fr.pandacube.lib.core.util.Log; -import jline.console.ConsoleReader; +import fr.pandacube.lib.util.Log; public class CLI { diff --git a/Chat/pom.xml b/Chat/pom.xml new file mode 100644 index 0000000..f21548b --- /dev/null +++ b/Chat/pom.xml @@ -0,0 +1,57 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-chat + jar + + + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + + + + + + fr.pandacube.lib + pandalib-util + ${project.version} + compile + + + + + net.kyori + adventure-api + 4.11.0 + + + net.kyori + adventure-platform-bungeecord + 4.1.1 + + + net.kyori + adventure-text-serializer-plain + 4.11.0 + + + + + + net.md-5 + bungeecord-chat + ${bungeecord.version} + compile + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java b/Chat/src/main/java/fr/pandacube/lib/chat/Chat.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java rename to Chat/src/main/java/fr/pandacube/lib/chat/Chat.java index 749ee83..965b143 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java +++ b/Chat/src/main/java/fr/pandacube/lib/chat/Chat.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.chat; +package fr.pandacube.lib.chat; import java.awt.Color; import java.util.Objects; @@ -6,8 +6,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; import java.util.function.UnaryOperator; -import org.checkerframework.checker.nullness.qual.NonNull; - import net.kyori.adventure.key.Key; import net.kyori.adventure.text.BlockNBTComponent; import net.kyori.adventure.text.Component; @@ -296,12 +294,12 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource @Override - public @NonNull HoverEvent asHoverEvent(@NonNull UnaryOperator op) { + public HoverEvent asHoverEvent(UnaryOperator op) { return HoverEvent.showText(op.apply(getAdv())); } @Override - public @NonNull Component asComponent() { + public Component asComponent() { return getAdv(); } diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java b/Chat/src/main/java/fr/pandacube/lib/chat/ChatColorUtil.java similarity index 99% rename from Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java rename to Chat/src/main/java/fr/pandacube/lib/chat/ChatColorUtil.java index 841b0ca..ab75e2e 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java +++ b/Chat/src/main/java/fr/pandacube/lib/chat/ChatColorUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.chat; +package fr.pandacube.lib.chat; import java.util.ArrayList; import java.util.List; diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java b/Chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java rename to Chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java index 9ba52f5..d999ece 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java +++ b/Chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java @@ -1,14 +1,15 @@ -package fr.pandacube.lib.core.chat; +package fr.pandacube.lib.chat; import java.util.Objects; -import fr.pandacube.lib.core.chat.Chat.FormatableChat; -import fr.pandacube.lib.core.util.Log; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.md_5.bungee.api.chat.BaseComponent; +import fr.pandacube.lib.chat.Chat.FormatableChat; +import fr.pandacube.lib.util.Log; + public abstract class ChatStatic { diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatUtil.java b/Chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java similarity index 90% rename from Core/src/main/java/fr/pandacube/lib/core/chat/ChatUtil.java rename to Chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java index 821fe7f..6c5560a 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatUtil.java +++ b/Chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.chat; +package fr.pandacube.lib.chat; import java.util.ArrayList; import java.util.Arrays; @@ -8,7 +8,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; -import com.google.common.collect.ImmutableMap; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; @@ -18,24 +17,20 @@ import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.format.TextDecoration.State; import net.md_5.bungee.api.ChatColor; -import fr.pandacube.lib.core.chat.Chat.FormatableChat; - -import static fr.pandacube.lib.core.chat.ChatStatic.chat; -import static fr.pandacube.lib.core.chat.ChatStatic.legacyText; -import static fr.pandacube.lib.core.chat.ChatStatic.text; +import fr.pandacube.lib.chat.Chat.FormatableChat; public class ChatUtil { public static final int DEFAULT_CHAR_SIZE = 6; - public static final Map CHARS_SIZE = new ImmutableMap.Builder() - .put(-6, "§") - .put(2, "!.,:;i|¡'") - .put(3, "`lìí’‘") - .put(4, " I[]tï×") - .put(5, "\"()*<>fk{}") - .put(7, "@~®©«»") - .put(9, "├└") - .build(); + public static final Map CHARS_SIZE = Map.ofEntries( + Map.entry(-6, "§"), + Map.entry(2, "!.,:;i|¡'"), + Map.entry(3, "`lìí’‘"), + Map.entry(4, " I[]tï×"), + Map.entry(5, "\"()*<>fk{}"), + Map.entry(7, "@~®©«»"), + Map.entry(9, "├└") + ); @@ -54,16 +49,16 @@ public class ChatUtil { public static FormatableChat createURLLink(String text, String url) { - return createURLLink(legacyText(text), url, null); + return createURLLink(ChatStatic.legacyText(text), url, null); } public static FormatableChat createURLLink(String text, String url, String hoverText) { - return createURLLink(legacyText(text), url, hoverText != null ? legacyText(hoverText) : null); + return createURLLink(ChatStatic.legacyText(text), url, hoverText != null ? ChatStatic.legacyText(hoverText) : null); } /* package */ static FormatableChat createURLLink(Chat element, String url, Chat hover) { String dispURL = (url.length() > 50) ? (url.substring(0, 48) + "...") : url; - return (FormatableChat) chat() + return (FormatableChat) ChatStatic.chat() .clickURL(url) .urlColor() .hover( @@ -80,14 +75,14 @@ public class ChatUtil { public static FormatableChat createCommandLink(String text, String commandWithSlash, String hoverText) { - return createCommandLink(text, commandWithSlash, hoverText == null ? null : legacyText(hoverText)); + return createCommandLink(text, commandWithSlash, hoverText == null ? null : ChatStatic.legacyText(hoverText)); } public static FormatableChat createCommandLink(String text, String commandWithSlash, Chat hoverText) { - return createCommandLink(legacyText(text), commandWithSlash, hoverText); + return createCommandLink(ChatStatic.legacyText(text), commandWithSlash, hoverText); } /* package */ static FormatableChat createCommandLink(Chat d, String commandWithSlash, Chat hoverText) { - FormatableChat c = chat() + FormatableChat c = ChatStatic.chat() .clickCommand(commandWithSlash) .commandColor(); if (hoverText != null) @@ -105,14 +100,14 @@ public class ChatUtil { public static FormatableChat createCommandSuggest(String text, String commandWithSlash, String hoverText) { - return createCommandSuggest(text, commandWithSlash, hoverText == null ? null : legacyText(hoverText)); + return createCommandSuggest(text, commandWithSlash, hoverText == null ? null : ChatStatic.legacyText(hoverText)); } public static FormatableChat createCommandSuggest(String text, String commandWithSlash, Chat hoverText) { - return createCommandSuggest(legacyText(text), commandWithSlash, hoverText); + return createCommandSuggest(ChatStatic.legacyText(text), commandWithSlash, hoverText); } /* package */ static FormatableChat createCommandSuggest(Chat d, String commandWithSlash, Chat hoverText) { - FormatableChat c = chat() + FormatableChat c = ChatStatic.chat() .clickSuggest(commandWithSlash) .commandColor(); if (hoverText != null) @@ -143,7 +138,7 @@ public class ChatUtil { pagesToDisplay.add(i); } - Chat d = chat().thenLegacyText(prefix); + Chat d = ChatStatic.chat().thenLegacyText(prefix); boolean first = true; int previous = 0; @@ -213,7 +208,7 @@ public class ChatUtil { return text; String sideChars = repeatedChar(repeatedChar, sideNbChar); - FormatableChat side = text(sideChars).color(decorationColor); + FormatableChat side = ChatStatic.text(sideChars).color(decorationColor); if (decorationBold) side.bold(); @@ -242,11 +237,11 @@ public class ChatUtil { int rightNbChar = (maxWidth - (textWidth + leftWidth)) / repeatedCharWidth; - Chat d = chat() - .then(text(repeatedChar(repeatedChar, nbLeft)).color(decorationColor)) + Chat d = ChatStatic.chat() + .then(ChatStatic.text(repeatedChar(repeatedChar, nbLeft)).color(decorationColor)) .then(text); if (repeatedChar != ' ') { - d.then(text(repeatedChar(repeatedChar, rightNbChar)).color(decorationColor)); + d.then(ChatStatic.text(repeatedChar(repeatedChar, rightNbChar)).color(decorationColor)); } return d; @@ -268,11 +263,11 @@ public class ChatUtil { int leftNbChar = (maxWidth - (textWidth + rightWidth)) / repeatedCharWidth; - Chat d = chat() - .then(text(repeatedChar(repeatedChar, leftNbChar)).color(decorationColor)) + Chat d = ChatStatic.chat() + .then(ChatStatic.text(repeatedChar(repeatedChar, leftNbChar)).color(decorationColor)) .then(text); if (repeatedChar != ' ') { - d.then(text(repeatedChar(repeatedChar, nbRight)).color(decorationColor)); + d.then(ChatStatic.text(repeatedChar(repeatedChar, nbRight)).color(decorationColor)); } return d; @@ -288,7 +283,7 @@ public class ChatUtil { public static Chat emptyLine(char repeatedChar, TextColor decorationColor, boolean decorationBold, boolean console, int maxWidth) { int count = maxWidth / charW(repeatedChar, console, decorationBold); - FormatableChat line = text(repeatedChar(repeatedChar, count)).color(decorationColor); + FormatableChat line = ChatStatic.text(repeatedChar(repeatedChar, count)).color(decorationColor); if (decorationBold) line.bold(); return line; @@ -585,13 +580,13 @@ public class ChatUtil { } // 2. Generate rendered text - Chat c = text(PROGRESS_BAR_START); + Chat c = ChatStatic.text(PROGRESS_BAR_START); int sumSizes = 0; for (int i = 0; i < sizes.length; i++) { sumSizes += sizes[i]; - FormatableChat subC = text(repeatedChar(PROGRESS_BAR_FULL_CHAR, sizes[i])); + FormatableChat subC = ChatStatic.text(repeatedChar(PROGRESS_BAR_FULL_CHAR, sizes[i])); if (colors != null && i < colors.length && colors[i] != null) subC.color(colors[i]); @@ -600,7 +595,7 @@ public class ChatUtil { } return c - .then(text(repeatedChar(PROGRESS_BAR_EMPTY_CHAR, progressCharWidth - sumSizes)) + .then(ChatStatic.text(repeatedChar(PROGRESS_BAR_EMPTY_CHAR, progressCharWidth - sumSizes)) .color(PROGRESS_BAR_EMPTY_COLOR)) .thenText(PROGRESS_BAR_END); } @@ -674,7 +669,7 @@ public class ChatUtil { public static List treeView(DisplayTreeNode node, boolean console) { List ret = new ArrayList<>(); - ret.add(chat() + ret.add(ChatStatic.chat() .then(node.component)); for (int i = 0; i < node.children.size(); i++) { @@ -685,7 +680,7 @@ public class ChatUtil { String prefix = last ? (j == 0 ? TREE_END_CONNECTED : (console ? TREE_END_OPEN_CONSOLE : TREE_END_OPEN)) : (j == 0 ? TREE_MIDDLE_CONNECTED : (console ? TREE_MIDDLE_OPEN_CONSOLE : TREE_MIDDLE_OPEN)); - ret.add(text(prefix) + ret.add(ChatStatic.text(prefix) .then(childComponents.get(j))); } } diff --git a/Core/pom.xml b/Core/pom.xml index b5bd1ec..c751d3f 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -11,8 +11,6 @@ pandalib-core jar - - PandaLib-Core @@ -27,34 +25,42 @@ - fr.pandacube.bungeecord - bungeecord-chat - ${bungeecord.version} - compile + fr.pandacube.lib + pandalib-util + ${project.version} - + - net.kyori - adventure-api - 4.11.0 - - - net.kyori - adventure-platform-bungeecord - 4.1.1 - - - net.kyori - adventure-text-serializer-plain - 4.11.0 - - - + fr.pandacube.lib + pandalib-chat + ${project.version} + + - io.github.classgraph - classgraph - 4.8.147 - + fr.pandacube.lib + pandalib-db + ${project.version} + + + + fr.pandacube.lib + pandalib-reflect + ${project.version} + + + + fr.pandacube.lib + pandalib-permissions + ${project.version} + + + + fr.pandacube.lib + pandalib-network-api + ${project.version} + + + com.fathzer @@ -67,33 +73,6 @@ org.geysermc.floodgate api 2.0-SNAPSHOT - compile - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.4.3 - - - - package - - shade - - - - - io.github.classgraph:classgraph - - - - - - - - diff --git a/Core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java b/Core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java index 21ab506..a1e4729 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java +++ b/Core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.core.commands; import java.util.Arrays; -import fr.pandacube.lib.core.chat.ChatStatic; +import fr.pandacube.lib.chat.ChatStatic; public class AbstractCommand extends ChatStatic { diff --git a/Core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java b/Core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java index 66033a6..62d2c45 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java +++ b/Core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java @@ -11,7 +11,8 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; import java.util.stream.Stream; -import fr.pandacube.lib.core.util.ListUtil; +import fr.pandacube.lib.util.ListUtil; +import fr.pandacube.lib.util.TimeUtil; @FunctionalInterface public interface SuggestionsSupplier { @@ -183,6 +184,49 @@ public interface SuggestionsSupplier { return (s, ti, token, a) -> collectFilteredStream(LongStream.rangeClosed(min, max).mapToObj(Long::toString), token); } } + + + + + + public static SuggestionsSupplier suggestDuration() { + final List emptyTokenSuggestions = TimeUtil.DURATION_SUFFIXES.stream().map(p -> "1" + p).collect(Collectors.toList()); + return (s, ti, token, args) -> { + if (token.isEmpty()) { + return emptyTokenSuggestions; + } + List remainingSuffixes = new ArrayList<>(TimeUtil.DURATION_SUFFIXES); + char[] tokenChars = token.toCharArray(); + String accSuffix = ""; + for (char c : tokenChars) { + if (Character.isDigit(c)) { + scanAndRemovePastSuffixes(remainingSuffixes, accSuffix); + accSuffix = ""; + } else if (Character.isLetter(c)) { + accSuffix += c; + } else + return Collections.emptyList(); + } + String prefixToken = token.substring(0, token.length() - accSuffix.length()); + return SuggestionsSupplier.collectFilteredStream(remainingSuffixes.stream(), accSuffix) + .stream() + .map(str -> prefixToken + str) + .collect(Collectors.toList()); + }; + } + + + private static void scanAndRemovePastSuffixes(List suffixes, String foundSuffix) { + for (int i = 0; i < suffixes.size(); i++) { + if (foundSuffix.startsWith(suffixes.get(i))) { + suffixes.subList(0, i + 1).clear(); + return; + } + } + } + + + diff --git a/Core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java b/Core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java index 7078441..9d7dabd 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java +++ b/Core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java @@ -8,8 +8,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import fr.pandacube.lib.core.chat.ChatColorUtil; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.chat.ChatColorUtil; +import fr.pandacube.lib.util.Log; + /** * Class tht loads a specific config file or directory * diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java b/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java index bd17d50..4792dfb 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java @@ -1,21 +1,21 @@ package fr.pandacube.lib.core.players; -import static fr.pandacube.lib.core.chat.ChatStatic.dataText; -import static fr.pandacube.lib.core.chat.ChatStatic.successText; -import static fr.pandacube.lib.core.chat.ChatStatic.text; -import static fr.pandacube.lib.core.chat.ChatStatic.warningText; - import java.util.Calendar; import java.util.OptionalLong; import java.util.UUID; import java.util.stream.LongStream; -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.chat.ChatColorUtil; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.permissions.PermPlayer; -import fr.pandacube.lib.core.permissions.Permissions; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.chat.ChatColorUtil; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.permissions.PermPlayer; +import fr.pandacube.lib.permissions.Permissions; +import fr.pandacube.lib.util.Log; + +import static fr.pandacube.lib.chat.ChatStatic.dataText; +import static fr.pandacube.lib.chat.ChatStatic.successText; +import static fr.pandacube.lib.chat.ChatStatic.text; +import static fr.pandacube.lib.chat.ChatStatic.warningText; public interface IOffPlayer { diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java b/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java index ea6ecc3..7bf11da 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java @@ -8,8 +8,8 @@ import java.util.stream.LongStream; import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.db.DBException; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.db.DBException; import net.kyori.adventure.identity.Identified; import net.kyori.adventure.identity.Identity; import net.kyori.adventure.text.Component; diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java b/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java index 1ef191a..640279f 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java @@ -13,15 +13,15 @@ import java.util.stream.Collectors; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; - -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBInitTableException; -import fr.pandacube.lib.core.util.Log; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; import net.md_5.bungee.api.chat.BaseComponent; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBInitTableException; +import fr.pandacube.lib.util.Log; + public abstract class IPlayerManager { private static IPlayerManager instance; diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java b/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java index a8c9c92..8a01984 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java @@ -19,11 +19,11 @@ import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.UncheckedExecutionException; import fr.pandacube.lib.core.commands.SuggestionsSupplier; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLOrderBy; -import fr.pandacube.lib.core.util.LevenshteinDistance; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.db.SQLOrderBy; +import fr.pandacube.lib.util.LevenshteinDistance; +import fr.pandacube.lib.util.Log; /* * Etape de recherche de joueur : diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayer.java b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayer.java index 806a768..7e9643c 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayer.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayer.java @@ -6,12 +6,12 @@ import java.util.GregorianCalendar; import java.util.Set; import java.util.UUID; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLElement; -import fr.pandacube.lib.core.db.SQLElementList; -import fr.pandacube.lib.core.db.SQLField; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.db.SQLElement; +import fr.pandacube.lib.db.SQLElementList; +import fr.pandacube.lib.db.SQLField; +import fr.pandacube.lib.util.Log; public class SQLPlayer extends SQLElement { diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerConfig.java b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerConfig.java index c643f4b..a14e949 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerConfig.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerConfig.java @@ -2,12 +2,12 @@ package fr.pandacube.lib.core.players; import java.util.UUID; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLElement; -import fr.pandacube.lib.core.db.SQLElementList; -import fr.pandacube.lib.core.db.SQLFKField; -import fr.pandacube.lib.core.db.SQLField; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.db.SQLElement; +import fr.pandacube.lib.db.SQLElementList; +import fr.pandacube.lib.db.SQLFKField; +import fr.pandacube.lib.db.SQLField; public class SQLPlayerConfig extends SQLElement { diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerIgnore.java b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerIgnore.java index d2ac6af..88a0bc0 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerIgnore.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerIgnore.java @@ -3,10 +3,10 @@ package fr.pandacube.lib.core.players; import java.util.Map; import java.util.UUID; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLElement; -import fr.pandacube.lib.core.db.SQLFKField; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.db.SQLElement; +import fr.pandacube.lib.db.SQLFKField; public class SQLPlayerIgnore extends SQLElement { diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerNameHistory.java b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerNameHistory.java index 00cd289..6f36053 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerNameHistory.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/SQLPlayerNameHistory.java @@ -2,12 +2,12 @@ package fr.pandacube.lib.core.players; import java.util.UUID; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLElement; -import fr.pandacube.lib.core.db.SQLFKField; -import fr.pandacube.lib.core.db.SQLField; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.db.SQLElement; +import fr.pandacube.lib.db.SQLFKField; +import fr.pandacube.lib.db.SQLField; +import fr.pandacube.lib.util.Log; public class SQLPlayerNameHistory extends SQLElement { diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/StandalonePlayerManager.java b/Core/src/main/java/fr/pandacube/lib/core/players/StandalonePlayerManager.java index a6b0c92..2df17ea 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/StandalonePlayerManager.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/StandalonePlayerManager.java @@ -2,9 +2,9 @@ package fr.pandacube.lib.core.players; import java.util.UUID; -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.db.DBInitTableException; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.db.DBInitTableException; +import fr.pandacube.lib.util.Log; import net.kyori.adventure.text.Component; /** diff --git a/Core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java b/Core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java index 2573980..e8d6ad4 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java +++ b/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.core.util.Log; +import fr.pandacube.lib.util.Log; import java.util.ArrayList; import java.util.HashMap; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/GifDecoder.java b/Core/src/main/java/fr/pandacube/lib/core/util/GifDecoder.java deleted file mode 100644 index ebf17bf..0000000 --- a/Core/src/main/java/fr/pandacube/lib/core/util/GifDecoder.java +++ /dev/null @@ -1,773 +0,0 @@ -package fr.pandacube.lib.core.util; - -import java.net.URL; -import java.util.ArrayList; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferInt; -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Class GifDecoder - Decodes a GIF file into one or more frames. - *
- * Example:
- *    GifDecoder d = new GifDecoder();
- *    d.read("sample.gif");
- *    int n = d.getFrameCount();
- *    for (int i = 0; i < n; i++) {
- *       BufferedImage frame = d.getFrame(i);  // frame i
- *       int t = d.getDelay(i);  // display duration of frame in milliseconds
- *       // do something with frame
- *    }
- * 
- * No copyright asserted on the source code of this class. May be used for - * any purpose, however, refer to the Unisys LZW patent for any additional - * restrictions. Please forward any corrections to questions at fmsware.com. - * - * @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's ImageMagick. - * @version 1.03 November 2003 - * - */ - -public class GifDecoder { - - /** - * File read status: No errors. - */ - public static final int STATUS_OK = 0; - - /** - * File read status: Error decoding file (may be partially decoded) - */ - public static final int STATUS_FORMAT_ERROR = 1; - - /** - * File read status: Unable to open source. - */ - public static final int STATUS_OPEN_ERROR = 2; - - protected BufferedInputStream in; - protected int status; - - protected int width; // full image width - protected int height; // full image height - protected boolean gctFlag; // global color table used - protected int gctSize; // size of global color table - protected int loopCount = 1; // iterations; 0 = repeat forever - - protected int[] gct; // global color table - protected int[] lct; // local color table - protected int[] act; // active color table - - protected int bgIndex; // background color index - protected int bgColor; // background color - protected int lastBgColor; // previous bg color - protected int pixelAspect; // pixel aspect ratio - - protected boolean lctFlag; // local color table flag - protected boolean interlace; // interlace flag - protected int lctSize; // local color table size - - protected int ix, iy, iw, ih; // current image rectangle - protected Rectangle lastRect; // last image rect - protected BufferedImage image; // current frame - protected BufferedImage lastImage; // previous frame - - protected byte[] block = new byte[256]; // current data block - protected int blockSize = 0; // block size - - // last graphic control extension info - protected int dispose = 0; - // 0=no action; 1=leave in place; 2=restore to bg; 3=restore to prev - protected int lastDispose = 0; - protected boolean transparency = false; // use transparent color - protected int delay = 0; // delay in milliseconds - protected int transIndex; // transparent color index - - protected static final int MaxStackSize = 4096; - // max decoder pixel stack size - - // LZW decoder working arrays - protected short[] prefix; - protected byte[] suffix; - protected byte[] pixelStack; - protected byte[] pixels; - - protected ArrayList frames; // frames read from current file - protected int frameCount; - - record GifFrame(BufferedImage image, int delay) { - } - - /** - * Gets display duration for specified frame. - * - * @param n int index of frame - * @return delay in milliseconds - */ - public int getDelay(int n) { - // - delay = -1; - if ((n >= 0) && (n < frameCount)) { - delay = frames.get(n).delay; - } - return delay; - } - - /** - * Gets the number of frames read from file. - * @return frame count - */ - public int getFrameCount() { - return frameCount; - } - - /** - * Gets the first (or only) image read. - * - * @return BufferedImage containing first frame, or null if none. - */ - public BufferedImage getImage() { - return getFrame(0); - } - - /** - * Gets the "Netscape" iteration count, if any. - * A count of 0 means repeat indefinitiely. - * - * @return iteration count if one was specified, else 1. - */ - public int getLoopCount() { - return loopCount; - } - - /** - * Creates new frame image from current data (and previous - * frames as specified by their disposition codes). - */ - protected void setPixels() { - // expose destination image's pixels as int array - int[] dest = - ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); - - // fill in starting image contents based on last image's dispose code - if (lastDispose > 0) { - if (lastDispose == 3) { - // use image before last - int n = frameCount - 2; - if (n > 0) { - lastImage = getFrame(n - 1); - } else { - lastImage = null; - } - } - - if (lastImage != null) { - int[] prev = - ((DataBufferInt) lastImage.getRaster().getDataBuffer()).getData(); - System.arraycopy(prev, 0, dest, 0, width * height); - // copy pixels - - if (lastDispose == 2) { - // fill last image rect area with background color - Graphics2D g = image.createGraphics(); - Color c = transparency ? new Color(0, 0, 0, 0) : new Color(lastBgColor); - g.setColor(c); - g.setComposite(AlphaComposite.Src); // replace area - g.fill(lastRect); - g.dispose(); - } - } - } - - // copy each source line to the appropriate place in the destination - int pass = 1; - int inc = 8; - int iline = 0; - for (int i = 0; i < ih; i++) { - int line = i; - if (interlace) { - if (iline >= ih) { - pass++; - switch (pass) { - case 2 : - iline = 4; - break; - case 3 : - iline = 2; - inc = 4; - break; - case 4 : - iline = 1; - inc = 2; - } - } - line = iline; - iline += inc; - } - line += iy; - if (line < height) { - int k = line * width; - int dx = k + ix; // start of line in dest - int dlim = dx + iw; // end of dest line - if ((k + width) < dlim) { - dlim = k + width; // past dest edge - } - int sx = i * iw; // start of line in source - while (dx < dlim) { - // map color and insert in destination - int index = (pixels[sx++]) & 0xff; - int c = act[index]; - if (c != 0) { - dest[dx] = c; - } - dx++; - } - } - } - } - - /** - * Gets the image contents of frame n. - * - * @return BufferedImage representation of frame, or null if n is invalid. - */ - public BufferedImage getFrame(int n) { - BufferedImage im = null; - if ((n >= 0) && (n < frameCount)) { - im = frames.get(n).image; - } - return im; - } - - /** - * Gets image size. - * - * @return GIF image dimensions - */ - public Dimension getFrameSize() { - return new Dimension(width, height); - } - - /** - * Reads GIF image from stream - * - * @param is containing GIF file. - * @return read status code (0 = no errors) - */ - public int read(BufferedInputStream is) { - init(); - if (is != null) { - in = is; - readHeader(); - if (!err()) { - readContents(); - if (frameCount < 0) { - status = STATUS_FORMAT_ERROR; - } - } - try { - is.close(); - } catch (IOException ignored) { - } - } else { - status = STATUS_OPEN_ERROR; - } - return status; - } - - /** - * Reads GIF image from stream - * - * @param is containing GIF file. - * @return read status code (0 = no errors) - */ - public int read(InputStream is) { - init(); - if (is != null) { - if (!(is instanceof BufferedInputStream)) - is = new BufferedInputStream(is); - in = (BufferedInputStream) is; - readHeader(); - if (!err()) { - readContents(); - if (frameCount < 0) { - status = STATUS_FORMAT_ERROR; - } - } - try { - is.close(); - } catch (IOException ignored) { - } - } else { - status = STATUS_OPEN_ERROR; - } - return status; - } - - /** - * Reads GIF file from specified file/URL source - * (URL assumed if name contains ":/" or "file:") - * - * @param name String containing source - * @return read status code (0 = no errors) - */ - public int read(String name) { - status = STATUS_OK; - try { - name = name.trim().toLowerCase(); - if ((name.contains("file:")) || - (name.indexOf(":/") > 0)) { - URL url = new URL(name); - in = new BufferedInputStream(url.openStream()); - } else { - in = new BufferedInputStream(new FileInputStream(name)); - } - status = read(in); - } catch (IOException e) { - status = STATUS_OPEN_ERROR; - } - - return status; - } - - /** - * Decodes LZW image data into pixel array. - * Adapted from John Cristy's ImageMagick. - */ - protected void decodeImageData() { - int NullCode = -1; - int npix = iw * ih; - int available, - clear, - code_mask, - code_size, - end_of_information, - in_code, - old_code, - bits, - code, - count, - i, - datum, - data_size, - first, - top, - bi, - pi; - - if ((pixels == null) || (pixels.length < npix)) { - pixels = new byte[npix]; // allocate new pixel array - } - if (prefix == null) prefix = new short[MaxStackSize]; - if (suffix == null) suffix = new byte[MaxStackSize]; - if (pixelStack == null) pixelStack = new byte[MaxStackSize + 1]; - - // Initialize GIF data stream decoder. - - data_size = read(); - clear = 1 << data_size; - end_of_information = clear + 1; - available = clear + 2; - old_code = NullCode; - code_size = data_size + 1; - code_mask = (1 << code_size) - 1; - for (code = 0; code < clear; code++) { - prefix[code] = 0; - suffix[code] = (byte) code; - } - - // Decode GIF pixel stream. - - datum = bits = count = first = top = pi = bi = 0; - - for (i = 0; i < npix;) { - if (top == 0) { - if (bits < code_size) { - // Load bytes until there are enough bits for a code. - if (count == 0) { - // Read a new data block. - count = readBlock(); - if (count <= 0) - break; - bi = 0; - } - datum += ((block[bi]) & 0xff) << bits; - bits += 8; - bi++; - count--; - continue; - } - - // Get the next code. - - code = datum & code_mask; - datum >>= code_size; - bits -= code_size; - - // Interpret the code - - if ((code > available) || (code == end_of_information)) - break; - if (code == clear) { - // Reset decoder. - code_size = data_size + 1; - code_mask = (1 << code_size) - 1; - available = clear + 2; - old_code = NullCode; - continue; - } - if (old_code == NullCode) { - pixelStack[top++] = suffix[code]; - old_code = code; - first = code; - continue; - } - in_code = code; - if (code == available) { - pixelStack[top++] = (byte) first; - code = old_code; - } - while (code > clear) { - pixelStack[top++] = suffix[code]; - code = prefix[code]; - } - first = (suffix[code]) & 0xff; - - // Add a new string to the string table, - - if (available >= MaxStackSize) { - pixelStack[top++] = (byte) first; - continue; - } - pixelStack[top++] = (byte) first; - prefix[available] = (short) old_code; - suffix[available] = (byte) first; - available++; - if (((available & code_mask) == 0) - && (available < MaxStackSize)) { - code_size++; - code_mask += available; - } - old_code = in_code; - } - - // Pop a pixel off the pixel stack. - - top--; - pixels[pi++] = pixelStack[top]; - i++; - } - - for (i = pi; i < npix; i++) { - pixels[i] = 0; // clear missing pixels - } - - } - - /** - * Returns true if an error was encountered during reading/decoding - */ - protected boolean err() { - return status != STATUS_OK; - } - - /** - * Initializes or re-initializes reader - */ - protected void init() { - status = STATUS_OK; - frameCount = 0; - frames = new ArrayList<>(); - gct = null; - lct = null; - } - - /** - * Reads a single byte from the input stream. - */ - protected int read() { - int curByte = 0; - try { - curByte = in.read(); - } catch (IOException e) { - status = STATUS_FORMAT_ERROR; - } - return curByte; - } - - /** - * Reads next variable length block from input. - * - * @return number of bytes stored in "buffer" - */ - protected int readBlock() { - blockSize = read(); - int n = 0; - if (blockSize > 0) { - try { - int count; - while (n < blockSize) { - count = in.read(block, n, blockSize - n); - if (count == -1) - break; - n += count; - } - } catch (IOException ignored) { - } - - if (n < blockSize) { - status = STATUS_FORMAT_ERROR; - } - } - return n; - } - - /** - * Reads color table as 256 RGB integer values - * - * @param ncolors int number of colors to read - * @return int array containing 256 colors (packed ARGB with full alpha) - */ - protected int[] readColorTable(int ncolors) { - int nbytes = 3 * ncolors; - int[] tab = null; - byte[] c = new byte[nbytes]; - int n = 0; - try { - n = in.read(c); - } catch (IOException ignored) { - } - if (n < nbytes) { - status = STATUS_FORMAT_ERROR; - } else { - tab = new int[256]; // max size to avoid bounds checks - int i = 0; - int j = 0; - while (i < ncolors) { - int r = (c[j++]) & 0xff; - int g = (c[j++]) & 0xff; - int b = (c[j++]) & 0xff; - tab[i++] = 0xff000000 | (r << 16) | (g << 8) | b; - } - } - return tab; - } - - /** - * Main file parser. Reads GIF content blocks. - */ - protected void readContents() { - // read GIF file content blocks - boolean done = false; - while (!(done || err())) { - int code = read(); - switch (code) { - - case 0x2C : // image separator - readImage(); - break; - - case 0x21 : // extension - code = read(); - switch (code) { - case 0xf9 : // graphics control extension - readGraphicControlExt(); - break; - - case 0xff : // application extension - readBlock(); - StringBuilder app = new StringBuilder(); - for (int i = 0; i < 11; i++) { - app.append((char) block[i]); - } - if (app.toString().equals("NETSCAPE2.0")) { - readNetscapeExt(); - } - else - skip(); // don't care - break; - - default : // uninteresting extension - skip(); - } - break; - - case 0x3b : // terminator - done = true; - break; - - case 0x00 : // bad byte, but keep going and see what happens - break; - - default : - status = STATUS_FORMAT_ERROR; - } - } - } - - /** - * Reads Graphics Control Extension values - */ - protected void readGraphicControlExt() { - read(); // block size - int packed = read(); // packed fields - dispose = (packed & 0x1c) >> 2; // disposal method - if (dispose == 0) { - dispose = 1; // elect to keep old image if discretionary - } - transparency = (packed & 1) != 0; - delay = readShort() * 10; // delay in milliseconds - transIndex = read(); // transparent color index - read(); // block terminator - } - - /** - * Reads GIF file header information. - */ - protected void readHeader() { - StringBuilder id = new StringBuilder(); - for (int i = 0; i < 6; i++) { - id.append((char) read()); - } - if (!id.toString().startsWith("GIF")) { - status = STATUS_FORMAT_ERROR; - return; - } - - readLSD(); - if (gctFlag && !err()) { - gct = readColorTable(gctSize); - bgColor = gct[bgIndex]; - } - } - - /** - * Reads next frame image - */ - protected void readImage() { - ix = readShort(); // (sub)image position & size - iy = readShort(); - iw = readShort(); - ih = readShort(); - - int packed = read(); - lctFlag = (packed & 0x80) != 0; // 1 - local color table flag - interlace = (packed & 0x40) != 0; // 2 - interlace flag - // 3 - sort flag - // 4-5 - reserved - lctSize = 2 << (packed & 7); // 6-8 - local color table size - - if (lctFlag) { - lct = readColorTable(lctSize); // read table - act = lct; // make local table active - } else { - act = gct; // make global table active - if (bgIndex == transIndex) - bgColor = 0; - } - int save = 0; - if (transparency) { - save = act[transIndex]; - act[transIndex] = 0; // set transparent color if specified - } - - if (act == null) { - status = STATUS_FORMAT_ERROR; // no color table defined - } - - if (err()) return; - - decodeImageData(); // decode pixel data - skip(); - - if (err()) return; - - frameCount++; - - // create new image to receive frame data - image = - new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE); - - setPixels(); // transfer pixel data to image - - frames.add(new GifFrame(image, delay)); // add image to frame list - - if (transparency) { - act[transIndex] = save; - } - resetFrame(); - - } - - /** - * Reads Logical Screen Descriptor - */ - protected void readLSD() { - - // logical screen size - width = readShort(); - height = readShort(); - - // packed fields - int packed = read(); - gctFlag = (packed & 0x80) != 0; // 1 : global color table flag - // 2-4 : color resolution - // 5 : gct sort flag - gctSize = 2 << (packed & 7); // 6-8 : gct size - - bgIndex = read(); // background color index - pixelAspect = read(); // pixel aspect ratio - } - - /** - * Reads Netscape extenstion to obtain iteration count - */ - protected void readNetscapeExt() { - do { - readBlock(); - if (block[0] == 1) { - // loop count sub-block - int b1 = (block[1]) & 0xff; - int b2 = (block[2]) & 0xff; - loopCount = (b2 << 8) | b1; - } - } while ((blockSize > 0) && !err()); - } - - /** - * Reads next 16-bit value, LSB first - */ - protected int readShort() { - // read 16-bit value, LSB first - return read() | (read() << 8); - } - - /** - * Resets frame state for reading next image. - */ - protected void resetFrame() { - lastDispose = dispose; - lastRect = new Rectangle(ix, iy, iw, ih); - lastImage = image; - lastBgColor = bgColor; - lct = null; - } - - /** - * Skips variable length blocks up to and including - * next zero length block. - */ - protected void skip() { - do { - readBlock(); - } while ((blockSize > 0) && !err()); - } -} \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java b/Core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java index fa5dfe3..82be39b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java +++ b/Core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java @@ -10,6 +10,8 @@ import java.util.Objects; import com.google.gson.JsonSyntaxException; +import fr.pandacube.lib.util.Log; + public class ServerPropertyFile { private final transient File file; diff --git a/DB/pom.xml b/DB/pom.xml new file mode 100644 index 0000000..3041131 --- /dev/null +++ b/DB/pom.xml @@ -0,0 +1,23 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-db + + + + fr.pandacube.lib + pandalib-util + ${project.version} + + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/DB.java b/DB/src/main/java/fr/pandacube/lib/db/DB.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/db/DB.java rename to DB/src/main/java/fr/pandacube/lib/db/DB.java index 3d40fba..1d3b13c 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/DB.java +++ b/DB/src/main/java/fr/pandacube/lib/db/DB.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -13,13 +13,13 @@ import java.util.Map; import java.util.Objects; import java.util.function.Consumer; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; /** * Static class to handle most of the database operations. * * To use this database library, first call {@link #init(DBConnection, String)} with an appropriate {@link DBConnection}, - * they you can initialize every table you need for your application, using {@link #initTable(Class)}. + * then you can initialize every table you need for your application, using {@link #initTable(Class)}. * * @author Marc Baloup */ diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/DBConnection.java b/DB/src/main/java/fr/pandacube/lib/db/DBConnection.java similarity index 94% rename from Core/src/main/java/fr/pandacube/lib/core/db/DBConnection.java rename to DB/src/main/java/fr/pandacube/lib/db/DBConnection.java index 493a519..029c134 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/DBConnection.java +++ b/DB/src/main/java/fr/pandacube/lib/db/DBConnection.java @@ -1,11 +1,11 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; public class DBConnection { private static final long CONNECTION_CHECK_TIMEOUT = 30000; // in ms @@ -40,7 +40,7 @@ public class DBConnection { } } - public boolean isConnected() + private boolean isConnected() { try { if (conn.isClosed()) diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/DBException.java b/DB/src/main/java/fr/pandacube/lib/db/DBException.java similarity index 88% rename from Core/src/main/java/fr/pandacube/lib/core/db/DBException.java rename to DB/src/main/java/fr/pandacube/lib/db/DBException.java index dff4503..585ac72 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/DBException.java +++ b/DB/src/main/java/fr/pandacube/lib/db/DBException.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; public class DBException extends Exception { diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/DBInitTableException.java b/DB/src/main/java/fr/pandacube/lib/db/DBInitTableException.java similarity index 93% rename from Core/src/main/java/fr/pandacube/lib/core/db/DBInitTableException.java rename to DB/src/main/java/fr/pandacube/lib/db/DBInitTableException.java index d9f426f..45d592d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/DBInitTableException.java +++ b/DB/src/main/java/fr/pandacube/lib/db/DBInitTableException.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; public class DBInitTableException extends DBException { diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java b/DB/src/main/java/fr/pandacube/lib/db/ParameterizedSQLString.java similarity index 75% rename from Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java rename to DB/src/main/java/fr/pandacube/lib/db/ParameterizedSQLString.java index eb8f4a6..a6b9455 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java +++ b/DB/src/main/java/fr/pandacube/lib/db/ParameterizedSQLString.java @@ -1,8 +1,6 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.List; public record ParameterizedSQLString(String sqlString, List parameters) { - - } diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLCustomType.java b/DB/src/main/java/fr/pandacube/lib/db/SQLCustomType.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLCustomType.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLCustomType.java index a0d4d52..b00879b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLCustomType.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLCustomType.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.function.Function; diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLElement.java b/DB/src/main/java/fr/pandacube/lib/db/SQLElement.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLElement.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLElement.java index 393ca1c..270b306 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLElement.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLElement.java @@ -1,11 +1,4 @@ -package fr.pandacube.lib.core.db; - -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.gson.JsonObject; -import fr.pandacube.lib.core.util.EnumUtil; -import fr.pandacube.lib.core.util.Json; -import fr.pandacube.lib.core.util.Log; +package fr.pandacube.lib.db; import java.lang.reflect.Modifier; import java.sql.Date; @@ -23,6 +16,10 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; + +import fr.pandacube.lib.util.EnumUtil; +import fr.pandacube.lib.util.Log; public abstract class SQLElement> { /** cache for fields for each subclass of SQLElement */ @@ -363,16 +360,19 @@ public abstract class SQLElement> { @Override public String toString() { - ToStringHelper b = MoreObjects.toStringHelper(this); - - for (SQLField f : fields.values()) - try { - b.add(f.getName(), get(f)); - } catch (IllegalArgumentException e) { - b.add(f.getName(), "(Undefined)"); - } - - return b.toString(); + StringBuilder sb = new StringBuilder(this.getClass().getName()); + sb.append('{'); + sb.append(fields.values().stream() + .map(f -> { + try { + return f.getName() + "=" + get(f); + } catch (IllegalArgumentException e) { + return f.getName() + "=(Undefined)"; + } + }) + .collect(Collectors.joining(", "))); + sb.append('}'); + return sb.toString(); } @Override @@ -390,16 +390,6 @@ public abstract class SQLElement> { - public JsonObject asJsonObject() { - JsonObject json = new JsonObject(); - for (SQLField f : getFields().values()) { - json.add(f.getName(), Json.gson.toJsonTree(get(f))); - } - return json; - } - - - diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLElementList.java b/DB/src/main/java/fr/pandacube/lib/db/SQLElementList.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLElementList.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLElementList.java index d6b4ff6..b2b0ee1 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLElementList.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLElementList.java @@ -1,7 +1,4 @@ -package fr.pandacube.lib.core.db; - -import com.google.gson.JsonArray; -import fr.pandacube.lib.core.util.Log; +package fr.pandacube.lib.db; import java.util.ArrayList; import java.util.HashMap; @@ -13,6 +10,8 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import fr.pandacube.lib.util.Log; + /** * * @param @@ -183,14 +182,6 @@ public class SQLElementList> extends ArrayList { return map; } - - - - - public JsonArray asJsonArray() { - JsonArray json = new JsonArray(); - forEach(el -> json.add(el.asJsonObject())); - return json; - } + } diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLFKField.java b/DB/src/main/java/fr/pandacube/lib/db/SQLFKField.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLFKField.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLFKField.java index a0c4c98..ca65b77 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLFKField.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLFKField.java @@ -1,6 +1,6 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; /** * diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLField.java b/DB/src/main/java/fr/pandacube/lib/db/SQLField.java similarity index 75% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLField.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLField.java index e3f9033..646207b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLField.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLField.java @@ -1,14 +1,14 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import fr.pandacube.lib.core.db.SQLWhere.SQLWhereComp; -import fr.pandacube.lib.core.db.SQLWhere.SQLWhereComp.SQLComparator; -import fr.pandacube.lib.core.db.SQLWhere.SQLWhereIn; -import fr.pandacube.lib.core.db.SQLWhere.SQLWhereLike; -import fr.pandacube.lib.core.db.SQLWhere.SQLWhereNull; +import fr.pandacube.lib.db.SQLWhere.SQLWhereComp; +import fr.pandacube.lib.db.SQLWhere.SQLWhereComp.SQLComparator; +import fr.pandacube.lib.db.SQLWhere.SQLWhereIn; +import fr.pandacube.lib.db.SQLWhere.SQLWhereLike; +import fr.pandacube.lib.db.SQLWhere.SQLWhereNull; public class SQLField, T> { @@ -91,49 +91,49 @@ public class SQLField, T> { - public SQLWhere eq(T r) { + public fr.pandacube.lib.db.SQLWhere eq(T r) { return comp(SQLComparator.EQ, r); } - public SQLWhere geq(T r) { + public fr.pandacube.lib.db.SQLWhere geq(T r) { return comp(SQLComparator.GEQ, r); } - public SQLWhere gt(T r) { + public fr.pandacube.lib.db.SQLWhere gt(T r) { return comp(SQLComparator.GT, r); } - public SQLWhere leq(T r) { + public fr.pandacube.lib.db.SQLWhere leq(T r) { return comp(SQLComparator.LEQ, r); } - public SQLWhere lt(T r) { + public fr.pandacube.lib.db.SQLWhere lt(T r) { return comp(SQLComparator.LT, r); } - public SQLWhere neq(T r) { + public fr.pandacube.lib.db.SQLWhere neq(T r) { return comp(SQLComparator.NEQ, r); } - private SQLWhere comp(SQLComparator c, T r) { + private fr.pandacube.lib.db.SQLWhere comp(SQLComparator c, T r) { if (r == null) throw new IllegalArgumentException("The value cannot be null. Use SQLField#isNull(value) or SQLField#isNotNull(value) to check for null values"); return new SQLWhereComp<>(this, c, r); } - public SQLWhere like(String like) { + public fr.pandacube.lib.db.SQLWhere like(String like) { return new SQLWhereLike<>(this, like); } - public SQLWhere in(Collection v) { + public fr.pandacube.lib.db.SQLWhere in(Collection v) { return new SQLWhereIn<>(this, v); } - public SQLWhere isNull() { + public fr.pandacube.lib.db.SQLWhere isNull() { return new SQLWhereNull<>(this, true); } - public SQLWhere isNotNull() { + public fr.pandacube.lib.db.SQLWhere isNotNull() { return new SQLWhereNull<>(this, false); } diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLOrderBy.java b/DB/src/main/java/fr/pandacube/lib/db/SQLOrderBy.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLOrderBy.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLOrderBy.java index 84fa916..71a39e1 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLOrderBy.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLOrderBy.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.ArrayList; import java.util.List; diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLType.java b/DB/src/main/java/fr/pandacube/lib/db/SQLType.java similarity index 94% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLType.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLType.java index 4b58ad7..9bf6d5a 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLType.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLType.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; public class SQLType { diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLUpdate.java b/DB/src/main/java/fr/pandacube/lib/db/SQLUpdate.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLUpdate.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLUpdate.java index 6c51546..c3a9f1c 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLUpdate.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLUpdate.java @@ -1,11 +1,11 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; public class SQLUpdate> { diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/SQLWhere.java b/DB/src/main/java/fr/pandacube/lib/db/SQLWhere.java similarity index 94% rename from Core/src/main/java/fr/pandacube/lib/core/db/SQLWhere.java rename to DB/src/main/java/fr/pandacube/lib/db/SQLWhere.java index 2f8ec1a..3f39d3d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/SQLWhere.java +++ b/DB/src/main/java/fr/pandacube/lib/db/SQLWhere.java @@ -1,11 +1,10 @@ -package fr.pandacube.lib.core.db; +package fr.pandacube.lib.db; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.logging.Level; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; public abstract class SQLWhere> { @@ -291,10 +290,11 @@ public abstract class SQLWhere> { * "IS NOT NULL" */ /* package */ SQLWhereNull(SQLField field, boolean isNull) { - if (field == null) throw new IllegalArgumentException("field can't be null"); - if (!field.canBeNull) Log.getLogger().log(Level.WARNING, - "Useless : Trying to check IS [NOT] NULL on the field " + field.getSQLElementType().getName() + "#" - + field.getName() + " which is declared in the ORM as 'can't be null'"); + if (field == null) + throw new IllegalArgumentException("field can't be null"); + if (!field.canBeNull) + Log.warning("Useless : Trying to check IS [NOT] NULL on the field " + field.getSQLElementType().getName() + + "#" + field.getName() + " which is declared in the ORM as 'can't be null'"); this.field = field; this.isNull = isNull; } diff --git a/Net/Readme.md b/Net/Readme.md new file mode 100644 index 0000000..80dddfb --- /dev/null +++ b/Net/Readme.md @@ -0,0 +1,12 @@ +# pandacube-net + +A TCP network library that uses the standard Java socket API, to ease the ommunication between the different processes +running the server network Pandacube. + +It’s still in development (actually not touched since years), and it’s supposed to be a replacement for the old +`pandalib-network-api`. This module is then marked as Beta using the Google Guava annotation. + +- Packet based communication +- Supports Request/Answer packets +- Uses binary packet id and data +* Input streams are handled in separate Threads \ No newline at end of file diff --git a/Net/pom.xml b/Net/pom.xml new file mode 100644 index 0000000..22a4a79 --- /dev/null +++ b/Net/pom.xml @@ -0,0 +1,27 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-net + + + + fr.pandacube.lib + pandalib-util + ${project.version} + + + com.google.guava + guava + 31.0.1-jre + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/Array8Bit.java b/Net/src/main/java/fr/pandacube/lib/net/Array8Bit.java similarity index 92% rename from Core/src/main/java/fr/pandacube/lib/core/net/Array8Bit.java rename to Net/src/main/java/fr/pandacube/lib/net/Array8Bit.java index 798ff21..cb094b7 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/Array8Bit.java +++ b/Net/src/main/java/fr/pandacube/lib/net/Array8Bit.java @@ -1,7 +1,10 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.util.Arrays; +import com.google.common.annotations.Beta; + +@Beta public class Array8Bit { public static final int BIT_COUNT = Byte.SIZE; diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/ByteBuffer.java b/Net/src/main/java/fr/pandacube/lib/net/ByteBuffer.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/net/ByteBuffer.java rename to Net/src/main/java/fr/pandacube/lib/net/ByteBuffer.java index 3638a35..84864af 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/ByteBuffer.java +++ b/Net/src/main/java/fr/pandacube/lib/net/ByteBuffer.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -6,6 +6,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.google.common.annotations.Beta; + +@Beta public final class ByteBuffer implements Cloneable { public static final Charset NETWORK_CHARSET = StandardCharsets.UTF_8; diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PPacket.java b/Net/src/main/java/fr/pandacube/lib/net/PPacket.java similarity index 94% rename from Core/src/main/java/fr/pandacube/lib/core/net/PPacket.java rename to Net/src/main/java/fr/pandacube/lib/net/PPacket.java index 382fa59..c54d330 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PPacket.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PPacket.java @@ -1,7 +1,10 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.util.Arrays; +import com.google.common.annotations.Beta; + +@Beta public class PPacket { public final String name; /* package */ int id; diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PPacketAnswer.java b/Net/src/main/java/fr/pandacube/lib/net/PPacketAnswer.java similarity index 94% rename from Core/src/main/java/fr/pandacube/lib/core/net/PPacketAnswer.java rename to Net/src/main/java/fr/pandacube/lib/net/PPacketAnswer.java index 803a8f3..eb40387 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PPacketAnswer.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PPacketAnswer.java @@ -1,7 +1,10 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.util.Arrays; +import com.google.common.annotations.Beta; + +@Beta public class PPacketAnswer extends PPacket { /* package */ final int answer; diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PPacketListener.java b/Net/src/main/java/fr/pandacube/lib/net/PPacketListener.java similarity index 79% rename from Core/src/main/java/fr/pandacube/lib/core/net/PPacketListener.java rename to Net/src/main/java/fr/pandacube/lib/net/PPacketListener.java index f265e6a..cc6e5d9 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PPacketListener.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PPacketListener.java @@ -1,5 +1,8 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; +import com.google.common.annotations.Beta; + +@Beta @FunctionalInterface public interface PPacketListener

{ diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PServer.java b/Net/src/main/java/fr/pandacube/lib/net/PServer.java similarity index 92% rename from Core/src/main/java/fr/pandacube/lib/core/net/PServer.java rename to Net/src/main/java/fr/pandacube/lib/net/PServer.java index e77fd48..751dd88 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PServer.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PServer.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.io.Closeable; import java.io.IOException; @@ -12,10 +12,11 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import com.google.common.base.MoreObjects; +import com.google.common.annotations.Beta; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; +@Beta public class PServer extends Thread implements Closeable { private static final AtomicInteger connectionCounterId = new AtomicInteger(0); @@ -92,7 +93,7 @@ public class PServer extends Thread implements Closeable { boolean loggedIn; private TCPServerClientConnection(Socket s, int coId) { - super(s, "Conn#" + coId + " via TCPSv " + socketName, password); + super(s, "Conn#" + coId + " via PServer " + socketName, password); addConnectionListener(new PSocketConnectionListener() { @Override public void onDisconnect(PSocket connection) { @@ -150,10 +151,7 @@ public class PServer extends Thread implements Closeable { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("thread", getName()) - .add("socket", socket) - .toString(); + return this.getClass().getName() + "{thread=" + getName() + ", socket=" + socket + "}"; } } diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PSocket.java b/Net/src/main/java/fr/pandacube/lib/net/PSocket.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/net/PSocket.java rename to Net/src/main/java/fr/pandacube/lib/net/PSocket.java index 7b373d8..8589775 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PSocket.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PSocket.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; import java.io.BufferedOutputStream; import java.io.Closeable; @@ -13,12 +13,12 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; +import com.google.common.annotations.Beta; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; /** * A wrapper for a {@link Socket}. The connection must point to a software using {@link PServer} @@ -27,11 +27,12 @@ import fr.pandacube.lib.core.util.Log; * This class provides a simple way to exchange data between client and server : *

  • Maintained connection with the server
  • *
  • Login with a password (send in the first packet)
  • - *
  • Named packets
  • + *
  • Binary packet id
  • *
  • Binary data
  • *
  • Input stream in a separate Thread
  • * */ +@Beta public class PSocket extends Thread implements Closeable { public static final int NETWORK_TCP_BUFFER_SIZE = 1024 * 1024; @@ -103,7 +104,7 @@ public class PSocket extends Thread implements Closeable { } try { String receivedPassword = new ByteBuffer(packet.content).getString(); - if (!Objects.equal(receivedPassword, password)) { + if (!Objects.equals(receivedPassword, password)) { send(PPacket.buildLoginBadPacket()); close(); return; @@ -341,10 +342,7 @@ public class PSocket extends Thread implements Closeable { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("thread", getName()) - .add("socket", socket.getRemoteSocketAddress()) - .toString(); + return this.getClass().getName() + "{thread=" + getName() + ", socket=" + socket + "}"; } } diff --git a/Core/src/main/java/fr/pandacube/lib/core/net/PSocketConnectionListener.java b/Net/src/main/java/fr/pandacube/lib/net/PSocketConnectionListener.java similarity index 79% rename from Core/src/main/java/fr/pandacube/lib/core/net/PSocketConnectionListener.java rename to Net/src/main/java/fr/pandacube/lib/net/PSocketConnectionListener.java index 62bec75..75cd30d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/net/PSocketConnectionListener.java +++ b/Net/src/main/java/fr/pandacube/lib/net/PSocketConnectionListener.java @@ -1,5 +1,8 @@ -package fr.pandacube.lib.core.net; +package fr.pandacube.lib.net; +import com.google.common.annotations.Beta; + +@Beta public interface PSocketConnectionListener { /** diff --git a/NetworkAPI/pom.xml b/NetworkAPI/pom.xml new file mode 100644 index 0000000..622fb67 --- /dev/null +++ b/NetworkAPI/pom.xml @@ -0,0 +1,22 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-network-api + + + + fr.pandacube.lib + pandalib-util + ${project.version} + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/AbstractRequest.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/AbstractRequest.java similarity index 90% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/client/AbstractRequest.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/AbstractRequest.java index 645576c..25d55a3 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/AbstractRequest.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/AbstractRequest.java @@ -1,8 +1,7 @@ -package fr.pandacube.lib.core.network_api.client; +package fr.pandacube.lib.netapi.client; import java.io.PrintStream; -@Deprecated public abstract class AbstractRequest { private final String pass; diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/NetworkAPISender.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/NetworkAPISender.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/client/NetworkAPISender.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/NetworkAPISender.java index 79c3f52..610d4f7 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/NetworkAPISender.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/NetworkAPISender.java @@ -1,11 +1,10 @@ -package fr.pandacube.lib.core.network_api.client; +package fr.pandacube.lib.netapi.client; import java.io.IOException; import java.io.PrintStream; import java.net.InetSocketAddress; import java.net.Socket; -@Deprecated public class NetworkAPISender { public static ResponseAnalyser sendRequest(InetSocketAddress cible, AbstractRequest request) throws IOException { diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/ResponseAnalyser.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/ResponseAnalyser.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/client/ResponseAnalyser.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/ResponseAnalyser.java index d2dab93..1ab5f99 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/client/ResponseAnalyser.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/client/ResponseAnalyser.java @@ -1,11 +1,10 @@ -package fr.pandacube.lib.core.network_api.client; +package fr.pandacube.lib.netapi.client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; -@Deprecated public class ResponseAnalyser { /** * Indique si la requête s'est bien exécutée (l'entête de la réponse est diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/AbstractRequestExecutor.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java similarity index 91% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/server/AbstractRequestExecutor.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java index f5c9a5c..bfb81b0 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/AbstractRequestExecutor.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/AbstractRequestExecutor.java @@ -1,13 +1,12 @@ -package fr.pandacube.lib.core.network_api.server; +package fr.pandacube.lib.netapi.server; import java.io.IOException; import java.io.PrintStream; import java.net.InetAddress; import java.net.Socket; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; -@Deprecated public abstract class AbstractRequestExecutor { public final String command; diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/NetworkAPIListener.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/server/NetworkAPIListener.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java index 6fbb683..6983ea2 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/NetworkAPIListener.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/NetworkAPIListener.java @@ -1,13 +1,12 @@ -package fr.pandacube.lib.core.network_api.server; +package fr.pandacube.lib.netapi.server; import java.io.IOException; import java.net.ServerSocket; import java.util.Arrays; import java.util.HashMap; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; -@Deprecated public class NetworkAPIListener implements Runnable { private final int port; diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/PacketExecutor.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/server/PacketExecutor.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java index 3fcd9f4..4005d60 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/PacketExecutor.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/PacketExecutor.java @@ -1,11 +1,11 @@ -package fr.pandacube.lib.core.network_api.server; +package fr.pandacube.lib.netapi.server; import java.io.IOException; import java.io.PrintStream; import java.net.Socket; -import fr.pandacube.lib.core.network_api.server.RequestAnalyser.BadRequestException; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.netapi.server.RequestAnalyser.BadRequestException; +import fr.pandacube.lib.util.Log; /** * Prends en charge un socket client et le transmet au gestionnaire de paquet @@ -16,7 +16,6 @@ import fr.pandacube.lib.core.util.Log; * @author Marc Baloup * */ -@Deprecated public class PacketExecutor implements Runnable { private final Socket socket; private final NetworkAPIListener networkAPIListener; diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/RequestAnalyser.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/RequestAnalyser.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/server/RequestAnalyser.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/RequestAnalyser.java index 908b94e..65a74f1 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/RequestAnalyser.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/RequestAnalyser.java @@ -1,11 +1,10 @@ -package fr.pandacube.lib.core.network_api.server; +package fr.pandacube.lib.netapi.server; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; -@Deprecated public class RequestAnalyser { public final String command; diff --git a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/Response.java b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/Response.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/network_api/server/Response.java rename to NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/Response.java index 755679d..d371087 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/network_api/server/Response.java +++ b/NetworkAPI/src/main/java/fr/pandacube/lib/netapi/server/Response.java @@ -1,8 +1,7 @@ -package fr.pandacube.lib.core.network_api.server; +package fr.pandacube.lib.netapi.server; import java.io.PrintStream; -@Deprecated public class Response { public boolean good = true; public String data = ""; diff --git a/Paper/pom.xml b/Paper/pom.xml index 993bf8f..a643802 100644 --- a/Paper/pom.xml +++ b/Paper/pom.xml @@ -8,8 +8,7 @@ pandalib-paper - - PandaLib-Paper + jar @@ -27,7 +26,6 @@ fr.pandacube.lib pandalib-core ${project.version} - compile net.kyori @@ -45,15 +43,13 @@ io.papermc.paper paper-api ${paper.version}-SNAPSHOT - compile io.papermc.paper paper-mojangapi ${paper.version}-SNAPSHOT - compile - + net.fabricmc diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java b/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java index 6d7c125..a5fcb72 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIHotBar.java +++ b/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.core.util.Log; +import fr.pandacube.lib.util.Log; import fr.pandacube.lib.paper.util.BukkitEvent; /** diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIInventory.java b/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIInventory.java index 227fba2..33e4e5c 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIInventory.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/gui/GUIInventory.java @@ -21,9 +21,9 @@ import org.bukkit.plugin.Plugin; import com.google.common.collect.ImmutableMap; -import fr.pandacube.lib.core.chat.Chat; +import fr.pandacube.lib.chat.Chat; import fr.pandacube.lib.core.players.IPlayerManager; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; import fr.pandacube.lib.paper.util.ItemStackBuilder; public class GUIInventory implements Listener { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java index 773486b..5529289 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java @@ -19,12 +19,12 @@ import java.util.stream.Collectors; import org.bukkit.Bukkit; -import fr.pandacube.lib.core.util.Log; -import fr.pandacube.lib.core.util.Reflect; -import fr.pandacube.lib.core.util.Reflect.ReflectClass; -import fr.pandacube.lib.core.util.Reflect.ReflectField; -import fr.pandacube.lib.core.util.Reflect.ReflectMember; -import fr.pandacube.lib.core.util.Reflect.ReflectMethod; +import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.reflect.Reflect; +import fr.pandacube.lib.reflect.Reflect.ReflectClass; +import fr.pandacube.lib.reflect.Reflect.ReflectField; +import fr.pandacube.lib.reflect.Reflect.ReflectMember; +import fr.pandacube.lib.reflect.Reflect.ReflectMethod; import net.fabricmc.mappingio.MappingReader; import net.fabricmc.mappingio.format.MappingFormat; import net.fabricmc.mappingio.tree.MappingTree; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java index 212e9b5..72bdb07 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java @@ -2,8 +2,8 @@ package fr.pandacube.lib.paper.reflect; import org.bukkit.Bukkit; -import fr.pandacube.lib.core.util.Reflect; -import fr.pandacube.lib.core.util.Reflect.ReflectClass; +import fr.pandacube.lib.reflect.Reflect; +import fr.pandacube.lib.reflect.Reflect.ReflectClass; public class OBCReflect { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/Type.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/Type.java index 65538d2..fb7ffa8 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/Type.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/Type.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import fr.pandacube.lib.core.util.Reflect.ReflectClass; +import fr.pandacube.lib.reflect.Reflect.ReflectClass; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; public class Type implements Comparable { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java index 5947f4f..a0032be 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; -import fr.pandacube.lib.core.util.MappedListView; +import fr.pandacube.lib.util.MappedListView; public class ReflectListWrapper extends MappedListView implements ReflectWrapperTypedI> { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java index dbb1417..1e3ca2a 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper; import com.google.common.collect.MapMaker; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import java.util.List; import java.util.Map; import java.util.Objects; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public abstract class ReflectWrapper implements ReflectWrapperI { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java index 06c18fc..baa4f3a 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java @@ -1,8 +1,8 @@ package fr.pandacube.lib.paper.reflect.wrapper; -import fr.pandacube.lib.core.util.Log; -import fr.pandacube.lib.core.util.Reflect; -import fr.pandacube.lib.core.util.Reflect.ReflectConstructor; +import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.reflect.Reflect; +import fr.pandacube.lib.reflect.Reflect.ReflectConstructor; import fr.pandacube.lib.paper.reflect.wrapper.brigadier.CommandNode; import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftMapView; import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftNamespacedKey; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java index 971f2a5..e464602 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.brigadier; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CommandNode extends ReflectWrapperTyped> { public static final Reflect.ReflectClass REFLECT = Reflect.ofClass(com.mojang.brigadier.tree.CommandNode.class); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java index 93f0bf8..aa8e4c9 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java @@ -1,14 +1,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.MapItemSavedData; import org.bukkit.entity.Player; import org.bukkit.map.MapView; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftMapView extends ReflectWrapperTyped { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.CraftMapView")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java index 9fe3b8e..e52c80e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; import org.bukkit.NamespacedKey; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftNamespacedKey extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftNamespacedKey")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java index 87b7b49..c53eb50 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; import org.bukkit.entity.Player; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftPlayer extends ReflectWrapperTyped { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("entity.CraftPlayer")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java index 9a4b0b4..530ee5e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java @@ -1,14 +1,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedPlayerList; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServer; import org.bukkit.Server; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftServer extends ReflectWrapperTyped { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftServer")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java index ac43332..538f0eb 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java @@ -1,14 +1,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; import org.bukkit.util.Vector; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftVector extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftVector")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java index a753661..ea55ff1 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerLevel; import org.bukkit.World; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftWorld extends ReflectWrapperTyped { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftWorld")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java index 50e6435..8b3f2a8 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class RenderData extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.RenderData")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java index cfae8c5..0c1ed55 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java @@ -2,15 +2,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.tree.CommandNode; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class VanillaCommandWrapper extends ReflectWrapperTyped { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("command.VanillaCommandWrapper")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java index 69a3e51..9d9396b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class DetectedVersion extends ReflectWrapper implements WorldVersion { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.DetectedVersion")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java index bef1802..3ae5572 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class SharedConstants extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.SharedConstants")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java index 461f359..c2123a5 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java @@ -6,7 +6,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; @ConcreteWrapper(WorldVersion.__concrete.class) public interface WorldVersion extends ReflectWrapperI { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java index db5a752..636c1f0 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class BlockPosArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.BlockPosArgument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java index fe7003b..50c6581 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java @@ -4,7 +4,7 @@ import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class CommandSourceStack extends ReflectWrapperTyped { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.CommandSourceStack")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java index fe2f6f6..118a49b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java @@ -2,12 +2,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.CommandDispatcher; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Commands extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.Commands")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java index 4fbb75d..0bb9431 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ComponentArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.ComponentArgument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java index 8c31f42..edc68c6 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; @@ -9,8 +9,8 @@ import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; import static fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper.wrap; @ConcreteWrapper(Coordinates.__concrete.class) diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java index 987fff5..4fb72b2 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class EntityArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.EntityArgument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java index dbc3368..6eac39b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectListWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; @@ -10,8 +10,8 @@ import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; import java.util.List; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class EntitySelector extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.selector.EntitySelector")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java index 5e5bc30..2e1f57e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class GameProfileArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.GameProfileArgument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java index 4099173..b0d8e33 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ResourceLocationArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.ResourceLocationArgument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java index 447b8fd..ace2b67 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Vec3Argument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.Vec3Argument")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/BlockPos.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/BlockPos.java index 3a368b4..66d378b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/BlockPos.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/BlockPos.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.core; import fr.pandacube.lib.paper.reflect.NMSReflect; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class BlockPos extends Vec3i { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.core.BlockPos")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java index 781cabe..537dc63 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.core; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Vec3i extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.core.Vec3i")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java index f6f0469..5b82c8e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java @@ -1,14 +1,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; -import fr.pandacube.lib.core.util.Reflect.ReflectMethod; +import fr.pandacube.lib.reflect.Reflect.ReflectMethod; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java index 1294e1b..5f5318b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import java.io.File; -import fr.pandacube.lib.core.util.Reflect.ReflectMethod; +import fr.pandacube.lib.reflect.Reflect.ReflectMethod; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java index 92bd30a..2937c0b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java index 35b17a6..46be7dd 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; -import fr.pandacube.lib.core.util.Reflect.ReflectMethod; +import fr.pandacube.lib.reflect.Reflect.ReflectMethod; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java index beebd43..3fb3036 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class FriendlyByteBuf extends ByteBuf { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.FriendlyByteBuf")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java index 54b5498..ce7e6db 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java @@ -5,7 +5,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; @ConcreteWrapper(Component.__concrete.class) public interface Component extends ReflectWrapperI { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java index dccf010..bc55169 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.FriendlyByteBuf; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ClientboundCustomPayloadPacket extends ReflectWrapper implements Packet { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java index 193b773..618485f 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ClientboundGameEventPacket extends ReflectWrapper implements Packet { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.protocol.game.ClientboundGameEventPacket")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java index 2b9a8a3..a59963d 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java @@ -5,7 +5,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; @ConcreteWrapper(Packet.__concrete.class) public interface Packet extends ReflectWrapperI { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java index 0e6a094..c27bbfd 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class ResourceLocation extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.resources.ResourceLocation")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java index 33a0c40..895c551 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkStorage; import fr.pandacube.lib.paper.reflect.wrapper.paper.QueuedChangesMapLong2Object; @@ -8,8 +8,8 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkMap extends ChunkStorage { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ChunkMap")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java index 4ed6477..0a9c976 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class DedicatedPlayerList extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.DedicatedPlayerList")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java index f5ebf63..4d8fe6f 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class DedicatedServer extends MinecraftServer { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.DedicatedServer")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServerProperties.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServerProperties.java index 7915e69..ec94fe6 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServerProperties.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServerProperties.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; import fr.pandacube.lib.paper.reflect.NMSReflect; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class DedicatedServerProperties extends Settings { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.DedicatedServerProperties")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java index 94283fb..a3bcd43 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class MinecraftServer extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.MinecraftServer")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java index c00d85f..f6b8fb7 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerChunkCache extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerChunkCache")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java index d617d63..56575d0 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.Packet; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerGamePacketListenerImpl extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.network.ServerGamePacketListenerImpl")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java index f724db7..18fe6bf 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.util.ProgressListener; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Level; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerLevel extends Level { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerLevel")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java index 8b69e69..bea8b04 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java @@ -2,13 +2,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; import org.bukkit.entity.Player; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.DamageSource; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerPlayer extends Entity { // in NMS, ServerPlayer is not a direct subclass of Entity public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerPlayer")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java index 9d2dddb..f27854c 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java @@ -1,13 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import java.util.Properties; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Settings extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.Settings")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java index 31b8443..694668c 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java @@ -5,7 +5,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; @ConcreteWrapper(ProgressListener.__concrete.class) public interface ProgressListener extends ReflectWrapperI { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java index 79f26bb..557d18b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class AABB extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.phys.AABB")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java index a2fd314..7d3541e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkPos extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.ChunkPos")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java index caa49a5..ce95ca2 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; @@ -8,8 +8,8 @@ import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkStorage extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.chunk.storage.ChunkStorage")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java index 581e810..9acbefd 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class DamageSource extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.damagesource.DamageSource")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java index 7f0a18a..239bde4 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Entity extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.entity.Entity")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java index 2b9d0f0..a533f64 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.WorldConfiguration; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Level extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.Level")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java index ea2adcc..8357b3b 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class MapItemSavedData extends SavedData { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.saveddata.maps.MapItemSavedData")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java index a7323cb..12ae25f 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class SavedData extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.saveddata.SavedData")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java index 1e52d62..aa14f2e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class Vec3 extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.phys.Vec3")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java index b00f074..50fdd21 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class VoxelShape extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.phys.shapes.VoxelShape")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java index 7957ef5..ed16539 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java @@ -1,12 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class BambooBlock extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.block.BambooBlock")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java index 9a6b2a6..aac09dd 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.netty; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class ByteBuf extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.ByteBuf")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java index 1ce0a56..f5d4fd9 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.netty; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Unpooled extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.Unpooled")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java index 0f16d27..b6793b6 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class AABBVoxelShape extends VoxelShape { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.voxel.AABBVoxelShape")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java index d18d674..1ff5e53 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.chat.Component; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class PaperAdventure extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.adventure.PaperAdventure")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java index 991366c..31c411c 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java @@ -1,11 +1,11 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class QueuedChangesMapLong2Object extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java index e85e416..f29826c 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper.configuration; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class FallbackValue_Int extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.type.fallback.FallbackValue$Int")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java index 9fa5e77..ac5ee9f 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java @@ -1,10 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper.configuration; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapEx; -import static fr.pandacube.lib.core.util.ThrowableUtil.wrapReflectEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; +import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class WorldConfiguration extends ReflectWrapper { public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.WorldConfiguration")); diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/scheduler/SchedulerUtil.java b/Paper/src/main/java/fr/pandacube/lib/paper/scheduler/SchedulerUtil.java index 46259e4..4a806d0 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/scheduler/SchedulerUtil.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/scheduler/SchedulerUtil.java @@ -4,7 +4,7 @@ import java.util.concurrent.Callable; import org.bukkit.Bukkit; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.util.Log; import fr.pandacube.lib.paper.PandaLibPaper; public class SchedulerUtil { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlock.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlock.java index 207c4ce..ad6e2de 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlock.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlock.java @@ -10,7 +10,7 @@ import org.bukkit.util.BlockVector; import org.bukkit.util.BoundingBox; import org.bukkit.util.Vector; -import fr.pandacube.lib.core.util.RandomUtil; +import fr.pandacube.lib.util.RandomUtil; /** * Checkpoint represented as a 3D Axis and Block Aligned Bounding Box (sort of AABB). diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlockGroup.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlockGroup.java index 2d8cf4a..933eb8e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlockGroup.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/AABBBlockGroup.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Entity; import org.bukkit.util.BlockVector; import org.bukkit.util.Vector; -import fr.pandacube.lib.core.util.IteratorIterator; -import fr.pandacube.lib.core.util.RandomUtil; +import fr.pandacube.lib.util.IteratorIterator; +import fr.pandacube.lib.util.RandomUtil; public class AABBBlockGroup implements Iterable { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java index fe9f3a7..9922b59 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/AutoUpdatedBossBar.java @@ -14,8 +14,8 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.util.Log; import fr.pandacube.lib.paper.PandaLibPaper; import net.kyori.adventure.bossbar.BossBar; import net.kyori.adventure.bossbar.BossBar.Color; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java index e6f1e77..6012118 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/BukkitEvent.java @@ -1,6 +1,6 @@ package fr.pandacube.lib.paper.util; -import fr.pandacube.lib.core.util.Reflect; +import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.PandaLibPaper; import org.bukkit.Bukkit; import org.bukkit.event.Event; @@ -44,10 +44,10 @@ public class BukkitEvent { HandlerList.unregisterAll(listener); } - + public static List> getAllEventClasses() { - List> classes = Reflect.getAllSubclasses(Event.class); + List> classes = Reflect.ofClass(Event.class).getAllSubclasses(false); classes.removeIf(e -> getHandlerList(e) == null); return classes; } diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java index cbcb186..150eb3e 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/GameWorldUtils.java @@ -10,10 +10,10 @@ import org.bukkit.World.Environment; import org.bukkit.WorldCreator; import org.bukkit.event.Listener; -import fr.pandacube.lib.core.util.BiMap; -import fr.pandacube.lib.core.util.FileUtils; -import fr.pandacube.lib.core.util.Log; -import fr.pandacube.lib.core.util.RandomUtil; +import fr.pandacube.lib.util.BiMap; +import fr.pandacube.lib.util.FileUtils; +import fr.pandacube.lib.util.Log; +import fr.pandacube.lib.util.RandomUtil; public class GameWorldUtils implements Listener { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/ItemStackBuilder.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/ItemStackBuilder.java index 99b4827..4b425e8 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/ItemStackBuilder.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/ItemStackBuilder.java @@ -14,8 +14,8 @@ import org.bukkit.inventory.meta.ItemMeta; import com.google.common.collect.Streams; -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.chat.Chat.FormatableChat; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.chat.Chat.FormatableChat; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.format.TextDecoration.State; diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/LocationUtil.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/LocationUtil.java index ddee624..b6b8b51 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/LocationUtil.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/LocationUtil.java @@ -17,7 +17,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.scheduler.BukkitTask; -import fr.pandacube.lib.core.util.RandomUtil; +import fr.pandacube.lib.util.RandomUtil; import fr.pandacube.lib.paper.PandaLibPaper; public class LocationUtil { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreboardUtil.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreboardUtil.java index 7ed78fb..8ac8ac2 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreboardUtil.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreboardUtil.java @@ -9,7 +9,7 @@ import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; -import fr.pandacube.lib.core.chat.Chat; +import fr.pandacube.lib.chat.Chat; import net.kyori.adventure.text.Component; public class ScoreboardUtil { diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/Skull.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/Skull.java index b11173c..85f7c00 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/Skull.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/util/Skull.java @@ -13,7 +13,7 @@ import org.bukkit.inventory.meta.SkullMeta; import com.destroystokyo.paper.profile.PlayerProfile; import com.destroystokyo.paper.profile.ProfileProperty; -import fr.pandacube.lib.core.chat.Chat; +import fr.pandacube.lib.chat.Chat; /** * Represents some special mob heads, also support creating player skulls and custom skulls. diff --git a/Permissions/pom.xml b/Permissions/pom.xml new file mode 100644 index 0000000..a55834b --- /dev/null +++ b/Permissions/pom.xml @@ -0,0 +1,82 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-permissions + + + + fr.pandacube.lib + pandalib-util + ${project.version} + + + + fr.pandacube.lib + pandalib-chat + ${project.version} + + + + fr.pandacube.lib + pandalib-db + ${project.version} + + + + com.fathzer + javaluator + 3.0.3 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + + package + + shade + + + + + com.fathzer:javaluator + + + + + com.fathzer:javaluator + + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + com.fathzer.soft.javaluator + fr.pandacube.shaded.javaluator + + + + + + + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermEntity.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermEntity.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java index 19c0b90..576eaa3 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermEntity.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermEntity.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.List; import java.util.Map; @@ -7,10 +7,10 @@ import java.util.OptionalLong; import java.util.Set; import java.util.stream.LongStream; -import fr.pandacube.lib.core.chat.ChatUtil.DisplayTreeNode; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedEntity; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.chat.ChatUtil.DisplayTreeNode; +import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedEntity; +import fr.pandacube.lib.permissions.SQLPermissions.EntityType; +import fr.pandacube.lib.util.Log; public abstract class PermEntity { protected final String name; diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermGroup.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermGroup.java similarity index 87% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermGroup.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermGroup.java index c10b87a..5d8a234 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermGroup.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermGroup.java @@ -1,10 +1,10 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.List; import java.util.stream.Collectors; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedGroup; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; +import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedGroup; +import fr.pandacube.lib.permissions.SQLPermissions.EntityType; public class PermGroup extends PermEntity { /* package */ PermGroup(String name) { diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermPlayer.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermPlayer.java similarity index 87% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermPlayer.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermPlayer.java index 1432a1f..bdabecf 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermPlayer.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermPlayer.java @@ -1,12 +1,11 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedPlayer; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.core.players.PlayerFinder; +import fr.pandacube.lib.permissions.PermissionsCachedBackendReader.CachedPlayer; +import fr.pandacube.lib.permissions.SQLPermissions.EntityType; public class PermPlayer extends PermEntity { private final UUID playerId; @@ -43,7 +42,7 @@ public class PermPlayer extends PermEntity { return cachedPlayerName; } private void cachePlayerName() { - cachedPlayerName = PlayerFinder.getLastKnownName(playerId); + cachedPlayerName = Permissions.playerNameGetter.apply(playerId); if (cachedPlayerName == null) cachedPlayerName = playerId.toString(); } diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionExpressionParser.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionExpressionParser.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionExpressionParser.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionExpressionParser.java index 4a43639..0608bba 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionExpressionParser.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionExpressionParser.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.Iterator; import java.util.function.Function; diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/Permissions.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java similarity index 84% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/Permissions.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java index 5983b57..48d1088 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/Permissions.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/Permissions.java @@ -1,25 +1,28 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.Arrays; import java.util.List; import java.util.UUID; +import java.util.function.Function; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBConnection; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.util.Log; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBConnection; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.util.Log; public class Permissions { /* package */ static PermissionsCachedBackendReader backendReader; /* package */ static PermissionsResolver resolver; /* package */ static PermissionsBackendWriter backendWriter; + /* package */ static Function playerNameGetter = UUID::toString; /** * Initialize the permission system. * The connection to the database needs to be initialized first, using {@link DB#init(DBConnection, String)}. */ - public static void init() throws DBException { + public static void init(Function playerNameGetter) throws DBException { + Permissions.playerNameGetter = playerNameGetter == null ? UUID::toString : playerNameGetter; if (backendReader != null) return; try { diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsBackendWriter.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsBackendWriter.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsBackendWriter.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsBackendWriter.java index 21b93d3..6869bf7 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsBackendWriter.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsBackendWriter.java @@ -1,12 +1,12 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.Objects; import com.google.common.base.Preconditions; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; +import fr.pandacube.lib.db.DB; +import fr.pandacube.lib.db.DBException; +import fr.pandacube.lib.permissions.SQLPermissions.EntityType; /* package */ class PermissionsBackendWriter { diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsCachedBackendReader.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsCachedBackendReader.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java index cbcdfcb..a6dc496 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsCachedBackendReader.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsCachedBackendReader.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -14,11 +14,11 @@ import java.util.stream.Collectors; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import fr.pandacube.lib.core.db.DB; -import fr.pandacube.lib.core.db.DBException; -import fr.pandacube.lib.core.db.SQLElementList; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.core.util.Log; +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; /* package */ class PermissionsCachedBackendReader { diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsResolver.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsResolver.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java index 828752f..3d74bae 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/PermissionsResolver.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/PermissionsResolver.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.ArrayList; import java.util.EnumSet; @@ -15,18 +15,17 @@ import java.util.stream.Collectors; import com.google.common.base.Preconditions; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; - -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.chat.ChatUtil; -import fr.pandacube.lib.core.chat.ChatUtil.DisplayTreeNode; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedEntity; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedGroup; -import fr.pandacube.lib.core.permissions.PermissionsCachedBackendReader.CachedPlayer; -import fr.pandacube.lib.core.permissions.SQLPermissions.EntityType; -import fr.pandacube.lib.core.players.PlayerFinder; -import fr.pandacube.lib.core.util.Log; import net.md_5.bungee.api.ChatColor; +import fr.pandacube.lib.chat.Chat; +import fr.pandacube.lib.chat.ChatUtil; +import fr.pandacube.lib.chat.ChatUtil.DisplayTreeNode; +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; + public class PermissionsResolver { private final PermissionsCachedBackendReader backendReader; @@ -488,7 +487,7 @@ public class PermissionsResolver { public DisplayTreeNode toDisplayTreeNode() { Chat c = Chat.chat() .then(result == PermState.UNDEFINED ? Chat.dataText("■") : result == PermState.GRANTED ? Chat.successText("✔") : Chat.failureText("✘")) - .then(Chat.text(entity instanceof CachedPlayer ? PlayerFinder.getLastKnownName(((CachedPlayer)entity).playerId) : entity.name) + .then(Chat.text(entity instanceof CachedPlayer cp ? Permissions.playerNameGetter.apply(cp.playerId) : entity.name) .color(entity instanceof CachedPlayer ? ChatColor.GOLD : ChatColor.DARK_AQUA) ); if (server != null) diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/SQLPermissions.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/SQLPermissions.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/SQLPermissions.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/SQLPermissions.java index 3bec2d7..ecb497b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/SQLPermissions.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/SQLPermissions.java @@ -1,7 +1,7 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; -import fr.pandacube.lib.core.db.SQLElement; -import fr.pandacube.lib.core.db.SQLField; +import fr.pandacube.lib.db.SQLElement; +import fr.pandacube.lib.db.SQLField; public class SQLPermissions extends SQLElement { diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/ServerWorldKey.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/ServerWorldKey.java similarity index 95% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/ServerWorldKey.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/ServerWorldKey.java index b98bb18..08ba378 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/ServerWorldKey.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/ServerWorldKey.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; import java.util.Comparator; import java.util.Objects; diff --git a/Core/src/main/java/fr/pandacube/lib/core/permissions/SpecialPermission.java b/Permissions/src/main/java/fr/pandacube/lib/permissions/SpecialPermission.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/permissions/SpecialPermission.java rename to Permissions/src/main/java/fr/pandacube/lib/permissions/SpecialPermission.java index d398c11..976a2e2 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/permissions/SpecialPermission.java +++ b/Permissions/src/main/java/fr/pandacube/lib/permissions/SpecialPermission.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.permissions; +package fr.pandacube.lib.permissions; /** * Represents a permission node that is based on an arbitrary player state. diff --git a/Reflect/pom.xml b/Reflect/pom.xml new file mode 100644 index 0000000..2bf918b --- /dev/null +++ b/Reflect/pom.xml @@ -0,0 +1,64 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-reflect + + + + io.github.classgraph + classgraph + 4.8.149 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + + package + + shade + + + + + io.github.classgraph:classgraph + + + + + io.github.classgraph:classgraph + + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + io.github.classgraph + fr.pandacube.shaded.classgraph + + + + + + + + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Reflect.java b/Reflect/src/main/java/fr/pandacube/lib/reflect/Reflect.java similarity index 89% rename from Core/src/main/java/fr/pandacube/lib/core/util/Reflect.java rename to Reflect/src/main/java/fr/pandacube/lib/reflect/Reflect.java index f80d862..1449dbc 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/Reflect.java +++ b/Reflect/src/main/java/fr/pandacube/lib/reflect/Reflect.java @@ -1,23 +1,20 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.reflect; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; +import java.util.concurrent.atomic.AtomicReference; import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassGraphException; +import io.github.classgraph.ClassInfoList; import io.github.classgraph.ScanResult; import sun.misc.Unsafe; @@ -172,6 +169,36 @@ public class Reflect { public ReflectField filteredField(String name) throws NoSuchFieldException { return field0(name, true); } + + private final AtomicReference>> cachedSubclasses = new AtomicReference<>(); + + /** + * Get all subclasses of the current class, using the ClassGraph library. + *

    + * If the returned list is not yet cached, or {@code forceUpdateCache} is true, then the cache is updated before + * being returned. This may take some time. + *

    + * The ClassGraph library scan all class files in the class path, then loads those which will be returned by + * this method. + * + * @param forceUpdateCache to force the update of the cache, even if it already filled. + * @return the list of all subclasses found in all loaded class loader. + * @throws ClassGraphException if any of the worker threads throws an uncaught exception, or the scan was interrupted. (see {@link ClassGraph#scan}) + * @throws IllegalArgumentException f an exception or error was thrown while trying to load any of the classes. (see {@link ClassInfoList#loadClasses()}) + */ + public List> getAllSubclasses(boolean forceUpdateCache) { + synchronized (cachedSubclasses) { + if (forceUpdateCache || cachedSubclasses.get() == null) { + try (ScanResult scanResult = new ClassGraph().enableClassInfo().ignoreClassVisibility().scan()) { + cachedSubclasses.set(scanResult.getSubclasses(clazz).loadClasses()); + } + } + @SuppressWarnings("unchecked") + List> ret = (List>) (List) cachedSubclasses.get(); + return ret; + } + + } } @@ -432,41 +459,7 @@ public class Reflect { } - - - - - - - - - - - - - - private static final Cache, List>> subClassesLists = CacheBuilder.newBuilder() - .expireAfterAccess(10, TimeUnit.MINUTES) - .build(); - - public static List> getAllSubclasses(Class clazz) { - try { - @SuppressWarnings("unchecked") - List> classes = (List>) (List) subClassesLists.get(clazz, () -> { - try (ScanResult scanResult = new ClassGraph().enableClassInfo().ignoreClassVisibility().scan()) { - return scanResult.getSubclasses(clazz.getName()).loadClasses(); - } - }); - return classes; - } catch(ExecutionException e) { - Log.severe(e); - return new ArrayList<>(); - } - - } - - } diff --git a/Util/pom.xml b/Util/pom.xml new file mode 100644 index 0000000..aeeda89 --- /dev/null +++ b/Util/pom.xml @@ -0,0 +1,19 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + + 4.0.0 + + pandalib-util + + + 17 + 17 + + + \ No newline at end of file diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java b/Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java rename to Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java index e6d4772..633d491 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/AmountPerTimeLimiter.java +++ b/Util/src/main/java/fr/pandacube/lib/util/AmountPerTimeLimiter.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.ArrayList; import java.util.List; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java b/Util/src/main/java/fr/pandacube/lib/util/BiMap.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java rename to Util/src/main/java/fr/pandacube/lib/util/BiMap.java index e47f613..ef7990d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/BiMap.java +++ b/Util/src/main/java/fr/pandacube/lib/util/BiMap.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Collections; import java.util.HashMap; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java b/Util/src/main/java/fr/pandacube/lib/util/CronExpression.java similarity index 99% rename from Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java rename to Util/src/main/java/fr/pandacube/lib/util/CronExpression.java index 9400220..ea46150 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/CronExpression.java +++ b/Util/src/main/java/fr/pandacube/lib/util/CronExpression.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; // from https://github.com/frode-carlsen/cron/blob/master/java8/src/main/java/fc/cron/CronExpression.java diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java b/Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java index da3d462..92028ec 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/DistanceUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/DistanceUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.text.DecimalFormat; import java.util.Arrays; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java b/Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java index 02954fb..c750d55 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/EnumUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/EnumUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Arrays; import java.util.stream.Collectors; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java b/Util/src/main/java/fr/pandacube/lib/util/FileUtils.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java rename to Util/src/main/java/fr/pandacube/lib/util/FileUtils.java index d0ba161..4a4c03b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/FileUtils.java +++ b/Util/src/main/java/fr/pandacube/lib/util/FileUtils.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.io.File; import java.io.IOException; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java b/Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java rename to Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java index ba0fc24..d68ddec 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/IteratorIterator.java +++ b/Util/src/main/java/fr/pandacube/lib/util/IteratorIterator.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.ArrayList; import java.util.Arrays; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java b/Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java similarity index 99% rename from Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java rename to Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java index bd13ecb..30fed8b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/JArithmeticInterpreter.java +++ b/Util/src/main/java/fr/pandacube/lib/util/JArithmeticInterpreter.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; //****************************************************************************** //*** diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java b/Util/src/main/java/fr/pandacube/lib/util/Lazy.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java rename to Util/src/main/java/fr/pandacube/lib/util/Lazy.java index a50373a..432090e 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/Lazy.java +++ b/Util/src/main/java/fr/pandacube/lib/util/Lazy.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Objects; import java.util.function.Supplier; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java b/Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java similarity index 91% rename from Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java rename to Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java index b699809..a4b964d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/LazyOrException.java +++ b/Util/src/main/java/fr/pandacube/lib/util/LazyOrException.java @@ -1,8 +1,8 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Objects; -import fr.pandacube.lib.core.util.ThrowableUtil.SupplierException; +import fr.pandacube.lib.util.ThrowableUtil.SupplierException; /** * Represents a lazy loaded value. diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java b/Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java rename to Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java index a69c9bc..ca15ba9 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/LevenshteinDistance.java +++ b/Util/src/main/java/fr/pandacube/lib/util/LevenshteinDistance.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Objects; import java.util.function.ToIntBiFunction; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java b/Util/src/main/java/fr/pandacube/lib/util/ListUtil.java similarity index 84% rename from Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/ListUtil.java index f4ce7c7..bc1ab3d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/ListUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/ListUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.List; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Log.java b/Util/src/main/java/fr/pandacube/lib/util/Log.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/util/Log.java rename to Util/src/main/java/fr/pandacube/lib/util/Log.java index d84d91a..6ef1119 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/Log.java +++ b/Util/src/main/java/fr/pandacube/lib/util/Log.java @@ -1,10 +1,10 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; -public class Log { +public final class Log { private static Logger logger = Logger.getGlobal(); private static final AtomicBoolean logDebug = new AtomicBoolean(false); diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java b/Util/src/main/java/fr/pandacube/lib/util/MappedListView.java similarity index 99% rename from Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java rename to Util/src/main/java/fr/pandacube/lib/util/MappedListView.java index 34d08af..c256a06 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/MappedListView.java +++ b/Util/src/main/java/fr/pandacube/lib/util/MappedListView.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.AbstractList; import java.util.Iterator; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java b/Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java similarity index 97% rename from Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java index 52abf37..f1bde7e 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/MemoryUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/MemoryUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.text.DecimalFormat; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java b/Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java similarity index 77% rename from Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java rename to Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java index d157b2c..c70546b 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftVersion.java +++ b/Util/src/main/java/fr/pandacube/lib/util/MinecraftVersion.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.ArrayList; import java.util.Arrays; @@ -8,8 +8,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.google.common.collect.ImmutableList; - public enum MinecraftVersion { v1_7_2_to_1_7_5(4, "1.7.2-1.7.5"), v1_7_6_to_1_7_10(5, "1.7.6-1.7.10"), @@ -65,92 +63,92 @@ public enum MinecraftVersion { versionMergeDisplay = new HashMap<>(); versionMergeDisplay.put(EnumSet.of(v1_7_2_to_1_7_5, v1_7_6_to_1_7_10), - ImmutableList.of("1.7.2-1.7.10")); + List.of("1.7.2-1.7.10")); versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1, v1_9_2, v1_9_3_to_1_9_4), - ImmutableList.of("1.9.x")); + List.of("1.9.x")); versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1, v1_9_2), - ImmutableList.of("1.9-1.9.2")); + List.of("1.9-1.9.2")); versionMergeDisplay.put(EnumSet.of(v1_9, v1_9_1), - ImmutableList.of("1.9", "1.9.1")); + List.of("1.9", "1.9.1")); versionMergeDisplay.put(EnumSet.of(v1_9_1, v1_9_2, v1_9_3_to_1_9_4), - ImmutableList.of("1.9.1-1.9.4")); + List.of("1.9.1-1.9.4")); versionMergeDisplay.put(EnumSet.of(v1_9_1, v1_9_2), - ImmutableList.of("1.9.1", "1.9.2")); + List.of("1.9.1", "1.9.2")); versionMergeDisplay.put(EnumSet.of(v1_9_2, v1_9_3_to_1_9_4), - ImmutableList.of("1.9.2-1.9.4")); + List.of("1.9.2-1.9.4")); versionMergeDisplay.put(EnumSet.of(v1_11, v1_11_1_to_1_11_2), - ImmutableList.of("1.11.x")); + List.of("1.11.x")); versionMergeDisplay.put(EnumSet.of(v1_12, v1_12_1, v1_12_2), - ImmutableList.of("1.12.x")); + List.of("1.12.x")); versionMergeDisplay.put(EnumSet.of(v1_12, v1_12_1), - ImmutableList.of("1.12", "1.12.1")); + List.of("1.12", "1.12.1")); versionMergeDisplay.put(EnumSet.of(v1_12_1, v1_12_2), - ImmutableList.of("1.12.1", "1.12.2")); + List.of("1.12.1", "1.12.2")); versionMergeDisplay.put(EnumSet.of(v1_13, v1_13_1, v1_13_2), - ImmutableList.of("1.13.x")); + List.of("1.13.x")); versionMergeDisplay.put(EnumSet.of(v1_13, v1_13_1), - ImmutableList.of("1.13", "1.13.1")); + List.of("1.13", "1.13.1")); versionMergeDisplay.put(EnumSet.of(v1_13_1, v1_13_2), - ImmutableList.of("1.13.1", "1.13.2")); + List.of("1.13.1", "1.13.2")); versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2, v1_14_3, v1_14_4), - ImmutableList.of("1.14.x")); + List.of("1.14.x")); versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2, v1_14_3), - ImmutableList.of("1.14-1.14.3")); + List.of("1.14-1.14.3")); versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2, v1_14_3, v1_14_4), - ImmutableList.of("1.14.1-1.14.4")); + List.of("1.14.1-1.14.4")); versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1, v1_14_2), - ImmutableList.of("1.14-1.14.2")); + List.of("1.14-1.14.2")); versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2, v1_14_3), - ImmutableList.of("1.14.1-1.14.3")); + List.of("1.14.1-1.14.3")); versionMergeDisplay.put(EnumSet.of(v1_14_2, v1_14_3, v1_14_4), - ImmutableList.of("1.14.2-1.14.4")); + List.of("1.14.2-1.14.4")); versionMergeDisplay.put(EnumSet.of(v1_14, v1_14_1), - ImmutableList.of("1.14", "1.14.1")); + List.of("1.14", "1.14.1")); versionMergeDisplay.put(EnumSet.of(v1_14_1, v1_14_2), - ImmutableList.of("1.14.1", "1.14.2")); + List.of("1.14.1", "1.14.2")); versionMergeDisplay.put(EnumSet.of(v1_14_2, v1_14_3), - ImmutableList.of("1.14.2", "1.14.3")); + List.of("1.14.2", "1.14.3")); versionMergeDisplay.put(EnumSet.of(v1_14_3, v1_14_4), - ImmutableList.of("1.14.3", "1.14.4")); + List.of("1.14.3", "1.14.4")); versionMergeDisplay.put(EnumSet.of(v1_15, v1_15_1, v1_15_2), - ImmutableList.of("1.15.x")); + List.of("1.15.x")); versionMergeDisplay.put(EnumSet.of(v1_15, v1_15_1), - ImmutableList.of("1.15", "1.15.1")); + List.of("1.15", "1.15.1")); versionMergeDisplay.put(EnumSet.of(v1_15_1, v1_15_2), - ImmutableList.of("1.15.1", "1.15.2")); + List.of("1.15.1", "1.15.2")); versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2, v1_16_3, v1_16_4_to_1_16_5), - ImmutableList.of("1.16.x")); + List.of("1.16.x")); versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2, v1_16_3), - ImmutableList.of("1.16-1.16.3")); + List.of("1.16-1.16.3")); versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2, v1_16_3, v1_16_4_to_1_16_5), - ImmutableList.of("1.16.1-1.16.5")); + List.of("1.16.1-1.16.5")); versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1, v1_16_2), - ImmutableList.of("1.16-1.16.2")); + List.of("1.16-1.16.2")); versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2, v1_16_3), - ImmutableList.of("1.16.1-1.16.3")); + List.of("1.16.1-1.16.3")); versionMergeDisplay.put(EnumSet.of(v1_16_2, v1_16_3, v1_16_4_to_1_16_5), - ImmutableList.of("1.16.2-1.16.5")); + List.of("1.16.2-1.16.5")); versionMergeDisplay.put(EnumSet.of(v1_16, v1_16_1), - ImmutableList.of("1.16", "1.16.1")); + List.of("1.16", "1.16.1")); versionMergeDisplay.put(EnumSet.of(v1_16_1, v1_16_2), - ImmutableList.of("1.16.1", "1.16.2")); + List.of("1.16.1", "1.16.2")); versionMergeDisplay.put(EnumSet.of(v1_16_2, v1_16_3), - ImmutableList.of("1.16.2", "1.16.3")); + List.of("1.16.2", "1.16.3")); versionMergeDisplay.put(EnumSet.of(v1_16_3, v1_16_4_to_1_16_5), - ImmutableList.of("1.16.3-1.16.5")); + List.of("1.16.3-1.16.5")); versionMergeDisplay.put(EnumSet.of(v1_17, v1_17_1), - ImmutableList.of("1.17.x")); + List.of("1.17.x")); versionMergeDisplay.put(EnumSet.of(v1_18_to_1_18_1, v1_18_2), - ImmutableList.of("1.18.x")); + List.of("1.18.x")); } diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java b/Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java index 5e03417..0d5afaf 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/MinecraftWebUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/MinecraftWebUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; public class MinecraftWebUtil { diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java b/Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java rename to Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java index d515d0d..fce80c2 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/OfflineUUID.java +++ b/Util/src/main/java/fr/pandacube/lib/util/OfflineUUID.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.nio.charset.StandardCharsets; import java.util.Objects; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java b/Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java similarity index 98% rename from Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java index f1283e1..24fcb56 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/RandomUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/RandomUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.List; import java.util.Random; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java b/Util/src/main/java/fr/pandacube/lib/util/StringUtil.java similarity index 96% rename from Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/StringUtil.java index 11b47fc..020030d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/StringUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/StringUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.util.Arrays; import java.util.List; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java b/Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java similarity index 99% rename from Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java index 2095c35..5d241d2 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/ThrowableUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/ThrowableUtil.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/Tick.java b/Util/src/main/java/fr/pandacube/lib/util/Tick.java similarity index 93% rename from Core/src/main/java/fr/pandacube/lib/core/util/Tick.java rename to Util/src/main/java/fr/pandacube/lib/util/Tick.java index 9b1593e..21a54f4 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/Tick.java +++ b/Util/src/main/java/fr/pandacube/lib/util/Tick.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.util; public class Tick { diff --git a/Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java b/Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java similarity index 90% rename from Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java rename to Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java index dcf77d7..280fcd1 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/util/TimeUtil.java +++ b/Util/src/main/java/fr/pandacube/lib/util/TimeUtil.java @@ -1,14 +1,10 @@ -package fr.pandacube.lib.core.util; - -import fr.pandacube.lib.core.commands.SuggestionsSupplier; +package fr.pandacube.lib.util; import java.time.Instant; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Comparator; import java.util.GregorianCalendar; import java.util.List; @@ -332,46 +328,12 @@ public class TimeUtil { if (c.after(max)) return max.getTimeInMillis(); return c.getTimeInMillis(); } - - - - - - public static SuggestionsSupplier suggestDuration() { - return (s, ti, token, args) -> { - if (token.isEmpty()) { - return emptyTokenSuggestions; - } - List remainingSuffixes = new ArrayList<>(allSuffixes); - char[] tokenChars = token.toCharArray(); - String accSuffix = ""; - for (char c : tokenChars) { - if (Character.isDigit(c)) { - scanAndRemovePastSuffixes(remainingSuffixes, accSuffix); - accSuffix = ""; - } else if (Character.isLetter(c)) { - accSuffix += c; - } else - return Collections.emptyList(); - } - String prefixToken = token.substring(0, token.length() - accSuffix.length()); - return SuggestionsSupplier.collectFilteredStream(remainingSuffixes.stream(), accSuffix) - .stream() - .map(str -> prefixToken + str) - .collect(Collectors.toList()); - }; - } - - private static final List allSuffixes = Arrays.asList("y", "mo", "w", "d", "h", "m", "s"); - private static final List emptyTokenSuggestions = allSuffixes.stream().map(p -> "1" + p).collect(Collectors.toList()); - private static void scanAndRemovePastSuffixes(List suffixes, String foundSuffix) { - for (int i = 0; i < suffixes.size(); i++) { - if (foundSuffix.startsWith(suffixes.get(i))) { - suffixes.subList(0, i + 1).clear(); - return; - } - } - } + + + + + public static final List DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s"); + } diff --git a/pom.xml b/pom.xml index 1b05f7b..2174bfa 100644 --- a/pom.xml +++ b/pom.xml @@ -8,8 +8,6 @@ pandalib-parent 1.0-SNAPSHOT pom - - PandaLib-Parent Pandacube @@ -48,9 +46,16 @@ Bungee + Chat CLI Core + DB + Net + NetworkAPI Paper + Permissions + Reflect + Util @@ -68,9 +73,10 @@ net.md-5 scriptus - 0.3.1 + 0.4.1 git:${project.name}:${project.version}:%s:${build.number} + true @@ -95,51 +101,19 @@ + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - net.md-5 - scriptus - [0.3.1,) - - describe - - - - - false - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - [1.0.0,) - - enforce - - - - - - - - - - - -