From 3bcd8d315b620c7a4fa6e51fec093ac4aec12ae3 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 3 Aug 2022 01:45:18 +0200 Subject: [PATCH] Progress javadoc, various refactor + new module pandalib-commands --- pandalib-cli/pom.xml | 12 +- .../pandacube/lib/cli/BrigadierCommand.java | 2 +- pandalib-commands/pom.xml | 43 +++ .../lib}/commands/SuggestionsSupplier.java | 268 +++++++++++++----- .../lib/core/commands/AbstractCommand.java | 40 --- .../lib/core/commands/BadCommandUsage.java | 30 -- .../lib/core/config/AbstractConfig.java | 105 +++---- .../core/config/AbstractConfigManager.java | 35 ++- .../lib/core/{util => json}/Json.java | 33 ++- .../core/{util => json}/TypeConverter.java | 86 ++++-- .../lib/core/search/SearchEngine.java | 47 ++- .../lib/core/search/SearchResult.java | 16 +- .../lib/core/util/ServerPropertyFile.java | 129 --------- .../paper/reflect/PandalibPaperReflect.java | 157 +++++++++- .../reflect/wrapper/WrapperRegistry.java | 233 --------------- .../wrapper/brigadier/CommandNode.java | 2 +- .../wrapper/craftbukkit/CraftMapView.java | 2 +- .../craftbukkit/CraftNamespacedKey.java | 2 +- .../wrapper/craftbukkit/CraftPlayer.java | 2 +- .../wrapper/craftbukkit/CraftServer.java | 2 +- .../wrapper/craftbukkit/CraftVector.java | 2 +- .../wrapper/craftbukkit/CraftWorld.java | 2 +- .../wrapper/craftbukkit/RenderData.java | 2 +- .../craftbukkit/VanillaCommandWrapper.java | 2 +- .../wrapper/minecraft/DetectedVersion.java | 2 +- .../wrapper/minecraft/SharedConstants.java | 2 +- .../wrapper/minecraft/WorldVersion.java | 6 +- .../minecraft/commands/BlockPosArgument.java | 2 +- .../commands/CommandSourceStack.java | 2 +- .../wrapper/minecraft/commands/Commands.java | 2 +- .../minecraft/commands/ComponentArgument.java | 2 +- .../minecraft/commands/Coordinates.java | 8 +- .../minecraft/commands/EntityArgument.java | 2 +- .../minecraft/commands/EntitySelector.java | 4 +- .../commands/GameProfileArgument.java | 2 +- .../commands/ResourceLocationArgument.java | 2 +- .../minecraft/commands/Vec3Argument.java | 2 +- .../reflect/wrapper/minecraft/core/Vec3i.java | 2 +- .../wrapper/minecraft/nbt/CompoundTag.java | 2 +- .../reflect/wrapper/minecraft/nbt/NbtIo.java | 2 +- .../wrapper/minecraft/nbt/StringTag.java | 2 +- .../reflect/wrapper/minecraft/nbt/Tag.java | 6 +- .../minecraft/network/chat/Component.java | 6 +- .../ClientboundCustomPayloadPacket.java | 2 +- .../protocol/ClientboundGameEventPacket.java | 2 +- .../minecraft/network/protocol/Packet.java | 6 +- .../minecraft/resources/ResourceLocation.java | 2 +- .../minecraft/server/DedicatedPlayerList.java | 2 +- .../minecraft/server/MinecraftServer.java | 2 +- .../minecraft/server/ServerChunkCache.java | 2 +- .../server/ServerGamePacketListenerImpl.java | 2 +- .../wrapper/minecraft/server/Settings.java | 2 +- .../minecraft/util/ProgressListener.java | 6 +- .../reflect/wrapper/minecraft/world/AABB.java | 2 +- .../wrapper/minecraft/world/ChunkPos.java | 2 +- .../wrapper/minecraft/world/ChunkStorage.java | 2 +- .../wrapper/minecraft/world/DamageSource.java | 2 +- .../wrapper/minecraft/world/Entity.java | 2 +- .../wrapper/minecraft/world/Level.java | 2 +- .../wrapper/minecraft/world/SavedData.java | 2 +- .../reflect/wrapper/minecraft/world/Vec3.java | 2 +- .../wrapper/minecraft/world/VoxelShape.java | 2 +- .../minecraft/world/block/BambooBlock.java | 2 +- .../paper/reflect/wrapper/netty/ByteBuf.java | 2 +- .../paper/reflect/wrapper/netty/Unpooled.java | 2 +- .../reflect/wrapper/paper/PaperAdventure.java | 2 +- .../paper/QueuedChangesMapLong2Object.java | 2 +- .../configuration/FallbackValue_Int.java | 2 +- .../configuration/WorldConfiguration.java | 2 +- pandalib-reflect/pom.xml | 10 + .../lib}/reflect/wrapper/ConcreteWrapper.java | 2 +- .../reflect/wrapper/ReflectListWrapper.java | 2 +- .../lib}/reflect/wrapper/ReflectWrapper.java | 2 +- .../lib}/reflect/wrapper/ReflectWrapperI.java | 2 +- .../reflect/wrapper/ReflectWrapperTyped.java | 2 +- .../reflect/wrapper/ReflectWrapperTypedI.java | 2 +- .../lib/reflect/wrapper/WrapperRegistry.java | 79 ++++++ pom.xml | 1 + 78 files changed, 791 insertions(+), 683 deletions(-) create mode 100644 pandalib-commands/pom.xml rename {pandalib-core/src/main/java/fr/pandacube/lib/core => pandalib-commands/src/main/java/fr/pandacube/lib}/commands/SuggestionsSupplier.java (60%) delete mode 100644 pandalib-core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java delete mode 100644 pandalib-core/src/main/java/fr/pandacube/lib/core/commands/BadCommandUsage.java rename pandalib-core/src/main/java/fr/pandacube/lib/core/{util => json}/Json.java (82%) rename pandalib-core/src/main/java/fr/pandacube/lib/core/{util => json}/TypeConverter.java (71%) delete mode 100644 pandalib-core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java delete mode 100644 pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ConcreteWrapper.java (90%) rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ReflectListWrapper.java (96%) rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ReflectWrapper.java (98%) rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ReflectWrapperI.java (79%) rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ReflectWrapperTyped.java (90%) rename {pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper => pandalib-reflect/src/main/java/fr/pandacube/lib}/reflect/wrapper/ReflectWrapperTypedI.java (86%) create mode 100644 pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java diff --git a/pandalib-cli/pom.xml b/pandalib-cli/pom.xml index 7450e08..0c2f5a6 100644 --- a/pandalib-cli/pom.xml +++ b/pandalib-cli/pom.xml @@ -49,12 +49,12 @@ bungeecord-config ${bungeecord.version} - - - com.mojang - brigadier - 1.0.17 - + + + fr.pandacube.lib + pandalib-commands + ${project.version} + diff --git a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java index 0739595..1eb692c 100644 --- a/pandalib-cli/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java +++ b/pandalib-cli/src/main/java/fr/pandacube/lib/cli/BrigadierCommand.java @@ -16,7 +16,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.tree.LiteralCommandNode; import fr.pandacube.lib.chat.ChatStatic; -import fr.pandacube.lib.core.commands.SuggestionsSupplier; +import fr.pandacube.lib.commands.SuggestionsSupplier; import fr.pandacube.lib.util.Log; import fr.pandacube.lib.reflect.Reflect; diff --git a/pandalib-commands/pom.xml b/pandalib-commands/pom.xml new file mode 100644 index 0000000..eac787a --- /dev/null +++ b/pandalib-commands/pom.xml @@ -0,0 +1,43 @@ + + + + pandalib-parent + fr.pandacube.lib + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + pandalib-commands + jar + + + + minecraft-libraries + Minecraft Libraries + https://libraries.minecraft.net + + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + + + + + + fr.pandacube.lib + pandalib-util + ${project.version} + + + + com.mojang + brigadier + 1.0.18 + + + + + \ No newline at end of file diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java similarity index 60% rename from pandalib-core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java rename to pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java index e6631c5..22f1ec9 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/SuggestionsSupplier.java +++ b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java @@ -1,4 +1,6 @@ -package fr.pandacube.lib.core.commands; +package fr.pandacube.lib.commands; + +import fr.pandacube.lib.util.ListUtil; import java.util.ArrayList; import java.util.Arrays; @@ -11,25 +13,51 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; import java.util.stream.Stream; -import fr.pandacube.lib.util.ListUtil; -import fr.pandacube.lib.util.TimeUtil; - +/** + * Functionnal interface providing suggestions for an argument of a command. + * @param the type of the command sender. + */ @FunctionalInterface public interface SuggestionsSupplier { + + + /** + * Gets the suggestion based on the parameters. + * @param sender the sender of the command + * @param tokenIndex the index, in {@code args}, of the currently typed token + * @param token the token current value. + * @param args all the space-separated parameters. + * @return the suggestions to show to the user. + */ + List getSuggestions(S sender, int tokenIndex, String token, String[] args); + + + + + + + /** - * Number of suggestion visible at once without having to scroll + * Number of suggestion visible at once without having to scroll IG. */ int VISIBLE_SUGGESTION_COUNT = 10; - - - List getSuggestions(S sender, int tokenIndex, String token, String[] args); - - - - - - + + + + + + + + + + + + /** + * Provides a filter that only accepts Strings that starts with the provided token, ignoring the case. + * @param token the token to filter with. + * @return a filter for the provided token. + */ static Predicate filter(String token) { return suggestion -> suggestion != null && suggestion.toLowerCase().startsWith(token.toLowerCase()); } @@ -37,49 +65,122 @@ public interface SuggestionsSupplier { /** * Filter the provided {@link Stream} of string according to the provided token, using the filter returned by {@link #filter(String)}, * then returns the strings collected into a {@link List}. - * + *

* This methods consume the provided stream, so will not be usable anymore. + * @param stream the stream to filter and collet. + * @param token the token to consider for filtering. + * @return the stream, filtered and collected into a {@link List}. */ static List collectFilteredStream(Stream stream, String token) { return stream.filter(filter(token)).sorted().collect(Collectors.toList()); } - - - - - + + + + + + + + + + + /** + * Creates a {@link SuggestionsSupplier} that suggest nothing. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier empty() { return (s, ti, t, a) -> Collections.emptyList(); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the supplied {@link Collection}. + * The provided {@link Supplier} will be called on each request for suggestions. + * @param streamSupplier a {@link Supplier} that provide an instance of {@link Collection} to iterate through for + * suggestions. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier fromCollectionsSupplier(Supplier> streamSupplier) { return (s, ti, token, a) -> collectFilteredStream(streamSupplier.get().stream(), token); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the supplied {@link Stream}. + * The provided {@link Supplier} will be called on each request for suggestions. + * @param streamSupplier a {@link Supplier} that provide an instance of {@link Stream} to iterate through for + * suggestions. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier fromStreamSupplier(Supplier> streamSupplier) { return (s, ti, token, a) -> collectFilteredStream(streamSupplier.get(), token); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the provided {@link Collection}. + * If the provided collection is modified, the changes will not be reflected on the suggestions. + * @param suggestions the list of suggestion. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier fromCollection(Collection suggestions) { return fromStreamSupplier(suggestions::stream); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the provided strings. + * If the provided array is modified, the changes will not be reflected on the suggestions. + * @param suggestions the suggestions. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier fromArray(String... suggestions) { return fromStreamSupplier(() -> Arrays.stream(suggestions)); } - - + + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the provided enum. + * @param enumClass the class of the enum from which to suggest its values. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + * @param the enum type. + */ static , S> SuggestionsSupplier fromEnum(Class enumClass) { return fromEnumValues(enumClass.getEnumConstants()); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the values from the provided enum. + * @param enumClass the class of the enum from which to suggest its values. + * @param lowerCase true to lowercase the enum values names, false to keep the case. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + * @param the enum type. + */ static , S> SuggestionsSupplier fromEnum(Class enumClass, boolean lowerCase) { return fromEnumValues(lowerCase, enumClass.getEnumConstants()); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the provided enum values. + * @param enumValues the values from an enum. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + * @param the enum type. + */ @SafeVarargs static , S> SuggestionsSupplier fromEnumValues(E... enumValues) { return fromEnumValues(false, enumValues); } - + + /** + * Creates a {@link SuggestionsSupplier} that suggest the provided enum values. + * @param lowerCase true to lowercase the enum values names, false to keep the case. + * @param enumValues the values from an enum. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + * @param the enum type. + */ @SafeVarargs static , S> SuggestionsSupplier fromEnumValues(boolean lowerCase, E... enumValues) { return (s, ti, token, a) -> { @@ -89,21 +190,31 @@ public interface SuggestionsSupplier { return collectFilteredStream(st, token); }; } - - - + + + + /** + * Creates a {@link SuggestionsSupplier} that suggest {@code "true"} or {@code "false"}. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier booleanValues() { return fromCollection(Arrays.asList("true", "false")); } - - - - + + + + /** - * Create a {@link SuggestionsSupplier} that suggest numbers according to the provided range. - * - * The current implementation only support range that include either -1 or 1. + * Creates a {@link SuggestionsSupplier} that suggest numbers according to the provided int range. + * The current implementation only support ranges that include either -1 or 1. + * @param min the minimum value of the interval, included. + * @param max the maximum value of the interval, included. + * @param compact if the suggestion must be compact. Disabling this feature may have big performance impact + * on large intervals. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. */ static SuggestionsSupplier fromIntRange(int min, int max, boolean compact) { return fromLongRange(min, max, compact); @@ -113,9 +224,14 @@ public interface SuggestionsSupplier { /** - * Create a {@link SuggestionsSupplier} that suggest numbers according to the provided range. - * - * The current implementation only support range that include either -1 or 1. + * Creates a {@link SuggestionsSupplier} that suggest numbers according to the provided long range. + * The current implementation only support ranges that include either -1 or 1. + * @param min the minimum value of the interval, included. + * @param max the maximum value of the interval, included. + * @param compact if the suggestion must be compact. Disabling this feature may have big performance impact + * on large intervals. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. */ static SuggestionsSupplier fromLongRange(long min, long max, boolean compact) { if (max < min) { @@ -186,9 +302,11 @@ public interface SuggestionsSupplier { } - - - + /** + * Creates a {@link SuggestionsSupplier} that suggests duration strings, like "3d" for 3 days, or "1h" for 1 hour. + * @return a new {@link SuggestionsSupplier}. + * @param the type of the command sender. + */ static SuggestionsSupplier suggestDuration() { final List emptyTokenSuggestions = DURATION_SUFFIXES.stream().map(p -> "1" + p).collect(Collectors.toList()); return (s, ti, token, args) -> { @@ -232,13 +350,15 @@ public interface SuggestionsSupplier { - - - - + + + + /** - * Create a {@link SuggestionsSupplier} that support greedy strings argument using the suggestion from this {@link SuggestionsSupplier}. - * @param index the index of the first argument of the greedy string argument + * Creates a {@link SuggestionsSupplier} that provides the suggestions of this instance, but with support for + * greedy string (arguments that goes until the end of the command). + * @param index the index of the first argument of the greedy string argument. + * @return a {@link SuggestionsSupplier} that supports quotable strings. */ default SuggestionsSupplier greedyString(int index) { @@ -246,8 +366,8 @@ public interface SuggestionsSupplier { if (ti < index) return Collections.emptyList(); - - String gToken = AbstractCommand.getLastParams(args, index); + + String gToken = String.join(" ", Arrays.copyOfRange(args, index, args.length)); String[] splitGToken = gToken.split(" ", -1); int currentTokenPosition = splitGToken.length - 1; String[] prevWordsGToken = Arrays.copyOf(splitGToken, currentTokenPosition); @@ -270,11 +390,13 @@ public interface SuggestionsSupplier { return currentTokenProposal; }; } - - - - + + /** + * Creates a {@link SuggestionsSupplier} that provides the suggestions of this instance, but with support for + * quotable strings, as used by the Brigadier argument type StringArgumentType.string(). + * @return a {@link SuggestionsSupplier} that supports quotable strings. + */ default SuggestionsSupplier quotableString() { return (s, ti, token, a) -> { boolean startWithQuote = token.length() > 0 && (token.charAt(0) == '"' || token.charAt(0) == '\''); @@ -298,7 +420,7 @@ public interface SuggestionsSupplier { } // inspired from com.mojang.brigadier.StringReader#readQuotedString() - static String unescapeBrigadierQuotable(String input, char quote) { + private static String unescapeBrigadierQuotable(String input, char quote) { StringBuilder builder = new StringBuilder(input.length()); boolean escaped = false; for (char c : input.toCharArray()) { @@ -321,18 +443,18 @@ public interface SuggestionsSupplier { } // from com.mojang.brigadier.StringReader#isAllowedInUnquotedString(char) - static boolean isAllowedInBrigadierUnquotedString(char c) { + private static boolean isAllowedInBrigadierUnquotedString(char c) { return c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c == '_' || c == '-' || c == '.' || c == '+'; } - static boolean isAllowedInBrigadierUnquotedString(String s) { + private static boolean isAllowedInBrigadierUnquotedString(String s) { for (char c : s.toCharArray()) if (!isAllowedInBrigadierUnquotedString(c)) return false; return true; } - static String escapeBrigadierQuotable(final String input) { + private static String escapeBrigadierQuotable(final String input) { final StringBuilder result = new StringBuilder("\""); for (int i = 0; i < input.length(); i++) { @@ -346,11 +468,17 @@ public interface SuggestionsSupplier { result.append("\""); return result.toString(); } - - - - - + + + + + + /** + * Creates a new {@link SuggestionsSupplier} that provides the suggestions of this instance, if and only if the + * provided predicate returns true for the command sender. + * @param check the predicate to test. + * @return a new {@link SuggestionsSupplier}. + */ default SuggestionsSupplier requires(Predicate check) { return (s, ti, to, a) -> check.test(s) ? getSuggestions(s, ti, to, a) : Collections.emptyList(); } @@ -358,8 +486,10 @@ public interface SuggestionsSupplier { /** - * Returns a new {@link SuggestionsSupplier} containing all the element of this instance then the element of the provided one, + * Creates a new {@link SuggestionsSupplier} containing all the element of this instance then the element of the provided one, * with all duplicated values removed using {@link Stream#distinct()}. + * @param other another {@link SuggestionsSupplier} to merge with. + * @return a new {@link SuggestionsSupplier}. */ default SuggestionsSupplier merge(SuggestionsSupplier other) { return (s, ti, to, a) -> { @@ -373,8 +503,10 @@ public interface SuggestionsSupplier { /** - * Returns a new {@link SuggestionsSupplier} containing all the suggestions of this instance, + * Creates a new {@link SuggestionsSupplier} containing all the suggestions of this instance, * but if this list is still empty, returns the suggestions from the provided one. + * @param other another {@link SuggestionsSupplier} to fallback to. + * @return a new {@link SuggestionsSupplier}. */ default SuggestionsSupplier orIfEmpty(SuggestionsSupplier other) { return (s, ti, to, a) -> { diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java deleted file mode 100644 index a1e4729..0000000 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/AbstractCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.pandacube.lib.core.commands; - -import java.util.Arrays; - -import fr.pandacube.lib.chat.ChatStatic; - -public class AbstractCommand extends ChatStatic { - - public final String commandName; - - public AbstractCommand(String cmdName) { - commandName = cmdName; - } - - - /** - *

- * Concatène les chaines de caractères passés dans args (avec - * " " comme séparateur), en ommettant - * celles qui se trouvent avant index.
- * Par exemple : - *

- * - * getLastParams(new String[] {"test", "bouya", "chaka", "bukkit"}, 1); - * - *

- * retournera la chaine "bouya chaka bukkit" - * - * @param args liste des arguments d'une commandes.
- * Le premier élément est l'argument qui suit le nom de la commande. - * Usuellement, ce paramètre correspond au paramètre - * args de la méthode onCommand - */ - public static String getLastParams(String[] args, int index) { - return String.join(" ", Arrays.copyOfRange(args, index, args.length)); - } - - - -} diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/BadCommandUsage.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/BadCommandUsage.java deleted file mode 100644 index 5ac04e1..0000000 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/commands/BadCommandUsage.java +++ /dev/null @@ -1,30 +0,0 @@ -package fr.pandacube.lib.core.commands; - -import java.util.logging.Logger; - -/** - * Throw an instance of this exception to indicate to the plugin command handler - * that the user has missused the command. The message, if provided, must indicate - * the reason of the mussusage of the command. It will be displayed on the screen - * with eventually indication of how to use the command (help command for example). - * If a {@link Throwable} cause is provided, it will be relayed to the plugin {@link Logger}. - * - */ -public class BadCommandUsage extends RuntimeException { - - public BadCommandUsage() { - super(); - } - - public BadCommandUsage(Throwable cause) { - super(cause); - } - - public BadCommandUsage(String message) { - super(message); - } - - public BadCommandUsage(String message, Throwable cause) { - super(message, cause); - } -} \ No newline at end of file diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java index 9d7dabd..2d7ab4b 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfig.java @@ -12,24 +12,23 @@ import fr.pandacube.lib.chat.ChatColorUtil; import fr.pandacube.lib.util.Log; /** - * Class tht loads a specific config file or directory - * + * Class that loads a specific config file or directory. */ public abstract class AbstractConfig { /** - * Correspond au dossier ou au fichier de configuration traité par la sous-classe - * courante de {@link AbstractConfig} + * The {@link File} corresponging to this config file or directory. */ protected final File configFile; /** + * Creates a new {@link AbstractConfig}. * @param configDir the parent directory * @param fileOrDirName The name of the config file or folder * @param type if the provided name is a file or a directory - * @throws IOException if we cannot create the file + * @throws IOException if we cannot create the file or directory. */ - public AbstractConfig(File configDir, String fileOrDirName, FileType type) throws IOException { + protected AbstractConfig(File configDir, String fileOrDirName, FileType type) throws IOException { configFile = new File(configDir, fileOrDirName); if (type == FileType.DIR) configFile.mkdir(); @@ -38,14 +37,15 @@ public abstract class AbstractConfig { } /** - * Gets the lines from the config file - * @param ignoreEmpty true if we ignore the empty lines - * @param ignoreHashtagComment true if we ignore the comment lines (starting with {@code #}) - * @param trimOutput true if we want to trim all lines using {@link String#trim()} - * @param f the file to read - * @return the list of lines, filtered according to the parameters + * Gets the lines from the provided file. + * @param ignoreEmpty {@code true} if we ignore the empty lines. + * @param ignoreHashtagComment {@code true} if we ignore the comment lines (starting with {@code #}). + * @param trimOutput {@code true} if we want to trim all lines using {@link String#trim()}. + * @param f the file to read. + * @return the list of lines, filtered according to the parameters, or null if it’s not a regular file. + * @throws IOException if an IO error occurs. */ - protected List getFileLines(boolean ignoreEmpty, boolean ignoreHashtagComment, boolean trimOutput, File f) throws IOException { + protected static List getFileLines(boolean ignoreEmpty, boolean ignoreHashtagComment, boolean trimOutput, File f) throws IOException { if (!f.isFile()) return null; @@ -74,26 +74,27 @@ public abstract class AbstractConfig { return lines; } - - + + /** - * Retourne toutes les lignes du fichier de configuration - * @param ignoreEmpty true si on doit ignorer les lignes vides - * @param ignoreHashtagComment true si on doit ignorer les lignes commentés (commençant par un #) - * @param trimOutput true si on doit appeller la méthode String.trim() sur chaque ligne retournée - * @return la liste des lignes utiles + * Gets the lines from the config file. + * @param ignoreEmpty {@code true} if we ignore the empty lines. + * @param ignoreHashtagComment {@code true} if we ignore the comment lines (starting with {@code #}). + * @param trimOutput {@code true} if we want to trim all lines using {@link String#trim()}. + * @return the list of lines, filtered according to the parameters, or null if it’s not a regular file. + * @throws IOException if an IO error occurs. */ protected List getFileLines(boolean ignoreEmpty, boolean ignoreHashtagComment, boolean trimOutput) throws IOException { return getFileLines(ignoreEmpty, ignoreHashtagComment, trimOutput, configFile); } - - - + + + /** + * Gets the list of files in the config directory. + * @return the list of files in the config directory, or null if this config is not a directory. + */ protected List getFileList() { - if (!configFile.isDirectory()) - return null; - - return Arrays.asList(configFile.listFiles()); + return configFile.isDirectory() ? Arrays.asList(configFile.listFiles()) : null; } @@ -101,43 +102,45 @@ public abstract class AbstractConfig { /** - * Découpe une chaine de caractère contenant une série de noeuds - * de permissions séparés par des point-virgules et la retourne sous forme d'une liste. - * @param perms la chaine de permissions à traiter - * @return null si le paramètre est nulle ou si perms.equals("*"), ou alors la chaine splittée. + * Splits the provided string into a list of permission nodes. + * The permission nodes must be separated by {@code ";"}. + * @param perms one or more permissions nodes, separated by {@code ";"}. + * @return {@code null} if the parameter is null or is equal to {@code "*"}, or the string splitted using {@code ";"}. */ public static List splitPermissionsString(String perms) { if (perms == null || perms.equals("*")) return null; - return getSplittedString(perms, ";"); + return List.of(perms.split(";")); } - - - - - - public static List getSplittedString(String value, String split) { - return List.of(value.split(split)); - } - + /** + * Utility method to that translate the {@code '&'} formated string to the legacy format. + * @param string the string to convert. + * @return a legacy formated string (using {@code '§'}). + */ public static String getTranslatedColorCode(String string) { return ChatColorUtil.translateAlternateColorCodes('&', string); } - - - - + + + /** + * Logs the message as a warning into console, prefixed with the context of this config. + * @param message the message to log. + */ protected void warning(String message) { - Log.warning("Erreur dans la configuration de '"+configFile.getName()+"' : "+message); + Log.warning("Error in configuration '"+configFile.getName()+"': " + message); } - - - - + + + /** + * The type of config. + */ protected enum FileType { - FILE, DIR + /** A config file. */ + FILE, + /** A config directory. */ + DIR } } diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfigManager.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfigManager.java index b379b66..35ece54 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfigManager.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/config/AbstractConfigManager.java @@ -3,10 +3,23 @@ package fr.pandacube.lib.core.config; import java.io.File; import java.io.IOException; +/** + * An abstract manager for a set of configuration files and folders. + * Its uses is to manage the loading/reloading of the configuration of a plugin. + */ public abstract class AbstractConfigManager { - + + /** + * The global configuration directory. + * May be the one provided by the environmenet API (like Plugin.getPluginFolder() in Bukkit). + */ protected final File configDir; - + + /** + * Create a new instance of config manager. + * @param configD the config directory. + * @throws IOException if an IO error occurs. + */ public AbstractConfigManager(File configD) throws IOException { configDir = configD; @@ -16,18 +29,24 @@ public abstract class AbstractConfigManager { } /** - * Implementation must close all closeable configuration (saving for example) + * Closes the configuration. May handle saving of any non-saved data. + * @throws IOException if an IO error occurs. */ public abstract void close() throws IOException; /** - * Implementation must init all config data + * Loads (or reloads) the configuration data. + * @throws IOException if an IO error occurs. */ public abstract void init() throws IOException; - - - - + + + /** + * Utility method to close then reload the config. + * @throws IOException if an IO error occurs. + * @see #close() + * @see #init() + */ public synchronized void reloadConfig() throws IOException { close(); init(); diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/Json.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/Json.java similarity index 82% rename from pandalib-core/src/main/java/fr/pandacube/lib/core/util/Json.java rename to pandalib-core/src/main/java/fr/pandacube/lib/core/json/Json.java index d3237d1..ae18175 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/Json.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/Json.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.core.json; import java.io.IOException; import java.lang.reflect.Constructor; @@ -17,13 +17,40 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; +/** + * Provides pre-instanciated {@link Gson} instances, all with support for Java records. + */ public class Json { + + /** + * {@link Gson} instance with {@link GsonBuilder#setLenient()} and support for Java records. + */ public static final Gson gson = build(Function.identity()); + + /** + * {@link Gson} instance with {@link GsonBuilder#setLenient()}, {@link GsonBuilder#setPrettyPrinting()} + * and support for Java records. + */ public static final Gson gsonPrettyPrinting = build(GsonBuilder::setPrettyPrinting); + + /** + * {@link Gson} instance with {@link GsonBuilder#setLenient()}, {@link GsonBuilder#serializeNulls()} + * and support for Java records. + */ public static final Gson gsonSerializeNulls = build(GsonBuilder::serializeNulls); + + /** + * {@link Gson} instance with {@link GsonBuilder#setLenient()}, {@link GsonBuilder#serializeNulls()}, + * {@link GsonBuilder#setPrettyPrinting()} and support for Java records. + */ public static final Gson gsonSerializeNullsPrettyPrinting = build(b -> b.serializeNulls().setPrettyPrinting()); + + + + + private static Gson build(Function builderModifier) { return builderModifier .apply(new GsonBuilder().registerTypeAdapterFactory(new RecordAdapterFactory()).setLenient()).create(); @@ -32,6 +59,10 @@ public class Json { + + + + // from https://github.com/google/gson/issues/1794#issuecomment-812964421 private static class RecordAdapterFactory implements TypeAdapterFactory { @Override diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/TypeConverter.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/TypeConverter.java similarity index 71% rename from pandalib-core/src/main/java/fr/pandacube/lib/core/util/TypeConverter.java rename to pandalib-core/src/main/java/fr/pandacube/lib/core/json/TypeConverter.java index 25237dd..765b61c 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/TypeConverter.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/json/TypeConverter.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.core.util; +package fr.pandacube.lib.core.json; import java.util.ArrayList; import java.util.HashMap; @@ -8,13 +8,16 @@ import java.util.Map; import com.google.gson.JsonElement; /** - * Utility for conversion of basic Java types and JsonElements types - * @author Marc - * + * Provides conversion between Java types and {@link JsonElement} types. */ public class TypeConverter { - - + + /** + * Converts the provided object to an {@link Integer}. + * @param o the object to convert. + * @return a the object converted to an {@link Integer}. + * @throws ConvertionException is a conversion error occurs. + */ public static Integer toInteger(Object o) { if (o == null) { return null; @@ -44,14 +47,26 @@ public class TypeConverter { throw new ConvertionException("No integer convertion available for an instance of "+o.getClass()); } - + + /** + * Converts the provided object to a primitive int. + * @param o the object to convert. + * @return a the object converted to a primitive int. + * @throws ConvertionException is a conversion error occurs. + */ public static int toPrimInt(Object o) { Integer val = toInteger(o); if (val == null) throw new ConvertionException("null values can't be converted to primitive int"); return val; } - + + /** + * Converts the provided object to a {@link Double}. + * @param o the object to convert. + * @return a the object converted to a {@link Double}. + * @throws ConvertionException is a conversion error occurs. + */ public static Double toDouble(Object o) { if (o == null) { return null; @@ -82,14 +97,26 @@ public class TypeConverter { throw new ConvertionException("No double convertion available for an instance of "+o.getClass()); } - + + /** + * Converts the provided object to a primitive double. + * @param o the object to convert. + * @return a the object converted to a primitive double. + * @throws ConvertionException is a conversion error occurs. + */ public static double toPrimDouble(Object o) { Double val = toDouble(o); if (val == null) throw new ConvertionException("null values can't converted to primitive int"); return val; } - + + /** + * Converts the provided object to a {@link String}. + * @param o the object to convert. + * @return a the object converted to a {@link String}. + * @throws ConvertionException is a conversion error occurs. + */ public static String toString(Object o) { if (o == null) { return null; @@ -112,11 +139,13 @@ public class TypeConverter { } /** - * - * @param o the object to convert to good type + * Converts the provided object to a {@link Map}. + * @param o the object to convert. * @param mapIntKeys if the String key representing an int should be duplicated as integer type, * which map to the same value as the original String key. For example, if a key is "12" and map - * to the object o, an integer key 12 will be added and map to the same object o + * to the object o, an integer key 12 will be added and map to the same object o. + * @return a the object converted to a {@link Map}. + * @throws ConvertionException is a conversion error occurs. */ @SuppressWarnings("unchecked") public static Map toMap(Object o, boolean mapIntKeys) { @@ -156,14 +185,17 @@ public class TypeConverter { } return map; } - throw new ConvertionException("No Map convertion available for an instance of "+o.getClass()); - - } - - + + + /** + * Converts the provided object to a {@link List}. + * @param o the object to convert. + * @return a the object converted to a {@link List}. + * @throws ConvertionException is a conversion error occurs. + */ @SuppressWarnings("unchecked") public static List toList(Object o) { if (o == null) { @@ -190,23 +222,19 @@ public class TypeConverter { } - - - - - - + + + /** + * Thrown when a convertion error occurs. + */ public static class ConvertionException extends RuntimeException { - public ConvertionException(String m) { + private ConvertionException(String m) { super(m); } - public ConvertionException(Throwable t) { + private ConvertionException(Throwable t) { super(t); } - public ConvertionException(String m, Throwable t) { - super(m, t); - } } diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java index e8d6ad4..26d7027 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchEngine.java @@ -15,9 +15,11 @@ import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; /** - * Utility class to manage searching among a set of - * SearchResult instances, using case insensitive - * keywords. + * Utility class to manage searching among a set of {@link SearchResult} instances, using case insensitive keywords. + * The search engine is responsible for storing a database of entries ({@link SearchResult}) that can be searched using + * keywords. This class provides methods to returns a list of results for provided keywords, a list of keyword + * suggestions based on pre-typed keywords. + * @param the type of search result. */ public class SearchEngine { @@ -30,13 +32,21 @@ public class SearchEngine { private final Set resultSet = new HashSet<>(); private final Cache, List> suggestionsCache; - + + /** + * Creates a new search engine. + * @param suggestionsCacheSize the size of the cache for keyword suggestions (for optimization). + */ public SearchEngine(int suggestionsCacheSize) { suggestionsCache = CacheBuilder.newBuilder() .maximumSize(suggestionsCacheSize) .build(); } - + + /** + * Adds an entry in this search engine. + * @param result the new entry. + */ public synchronized void addResult(R result) { if (result == null) throw new IllegalArgumentException("Provided result cannot be null."); @@ -83,7 +93,11 @@ public class SearchEngine { suggestionsCache.invalidateAll(); } - + + /** + * Removes the provided entry from this search engine. + * @param result the new entry. + */ public synchronized void removeResult(R result) { if (result == null || !resultSet.contains(result)) return; @@ -118,7 +132,12 @@ public class SearchEngine { suggestionsCache.invalidateAll(); } - + + /** + * Provides all the search results that correspond to all the provided keywords. + * @param searchTerms all the search terms (keywords). + * @return all the search results that correspond to all the provided keywords. + */ public synchronized Set search(Set searchTerms) { if (searchTerms == null) searchTerms = new HashSet<>(); @@ -130,7 +149,12 @@ public class SearchEngine { return retainedResults; } - + + /** + * Provides all the search results that correspond to the provided keyword. + * @param searchTerm the search term (keyword). If null, all the possible results are returned. + * @return all the search results that correspond to the provided keyword. + */ public synchronized Set search(String searchTerm) { if (searchTerm == null || searchTerm.isEmpty()) { return new HashSet<>(resultSet); @@ -145,7 +169,12 @@ public class SearchEngine { return retainedResults; } - + + /** + * Provides the next keyword to suggest, based on the already typed keywords. + * @param prevSearchTerms the already typed keywords. + * @return the next keywords to suggest. + */ public synchronized List suggestKeywords(List prevSearchTerms) { if (prevSearchTerms == null || prevSearchTerms.isEmpty()) { return new ArrayList<>(suggestionsKeywordsResultMap.keySet()); diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchResult.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchResult.java index d38b1f4..fbf0504 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchResult.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/search/SearchResult.java @@ -2,10 +2,22 @@ package fr.pandacube.lib.core.search; import java.util.Set; +/** + * An entry in the {@link SearchEngine}. + */ public interface SearchResult { - + + /** + * Returns the keywords corresponding to this search result. + * @return the keywords corresponding to this search result. + */ Set getSearchKeywords(); - + + /** + * Returns the keywords to suggest corresponding to this search result. + * It may be different from the search keywords. + * @return the keywords to suggest corresponding to this search result. + */ Set getSuggestionKeywords(); } diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java deleted file mode 100644 index 82be39b..0000000 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/util/ServerPropertyFile.java +++ /dev/null @@ -1,129 +0,0 @@ -package fr.pandacube.lib.core.util; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Objects; - -import com.google.gson.JsonSyntaxException; - -import fr.pandacube.lib.util.Log; - -public class ServerPropertyFile { - - private final transient File file; - - private String name = "default_name"; - private String memory = "512M"; - private String javaArgs = ""; - private String MinecraftArgs = ""; - private String jarFile = ""; - private long startupDelay = 0; - private boolean run = true; - - public ServerPropertyFile(File f) { - file = Objects.requireNonNull(f, "f"); - - } - - /** - * Charge le fichier de configuration dans cette instance de la classe - * - * @return true si le chargement a réussi, false sinon - */ - public boolean loadFromFile() { - try (BufferedReader in = new BufferedReader(new FileReader(file))) { - - ServerPropertyFile dataFile = Json.gsonPrettyPrinting.fromJson(in, getClass()); - - name = dataFile.name; - memory = dataFile.memory; - javaArgs = dataFile.javaArgs; - MinecraftArgs = dataFile.MinecraftArgs; - jarFile = dataFile.jarFile; - run = dataFile.run; - startupDelay = dataFile.startupDelay; - - return true; - } catch(JsonSyntaxException e) { - Log.severe("Error in config file " + file + ": backed up and creating a new one from previous or default values.", e); - return save(); - } catch (IOException e) { - Log.severe(e); - return false; - } - } - - public boolean save() { - try (BufferedWriter out = new BufferedWriter(new FileWriter(file, false))) { - Json.gsonPrettyPrinting.toJson(this, out); - out.flush(); - return true; - } catch (IOException e) { - Log.severe(e); - } - - return false; - } - - public String getName() { - return name; - } - - public String getMemory() { - return memory; - } - - public String getJavaArgs() { - return javaArgs; - } - - public String getMinecraftArgs() { - return MinecraftArgs; - } - - public String getJarFile() { - return jarFile; - } - - public boolean isRun() { - return run; - } - - public long getStartupDelay() { - return startupDelay; - } - - public void setName(String n) { - if (n == null || !n.matches("^[a-zA-Z]$")) throw new IllegalArgumentException(); - name = n; - } - - public void setMemory(String m) { - if (m == null || !m.matches("^\\d+[mgMG]$")) throw new IllegalArgumentException(); - memory = m; - } - - public void setJavaArgs(String ja) { - if (ja == null) throw new IllegalArgumentException(); - javaArgs = ja; - } - - public void setMinecraftArgs(String ma) { - if (ma == null) throw new IllegalArgumentException(); - MinecraftArgs = ma; - } - - public void setJarFile(String j) { - if (j == null) throw new IllegalArgumentException(); - jarFile = j; - } - - public void setRun(boolean r) { - run = r; - } - -} diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/PandalibPaperReflect.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/PandalibPaperReflect.java index 025e445..77dc687 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/PandalibPaperReflect.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/PandalibPaperReflect.java @@ -1,11 +1,164 @@ package fr.pandacube.lib.paper.reflect; -import fr.pandacube.lib.paper.reflect.wrapper.WrapperRegistry; +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; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftPlayer; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftServer; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftVector; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftWorld; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.RenderData; +import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.VanillaCommandWrapper; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.DetectedVersion; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.SharedConstants; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.WorldVersion; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.BlockPosArgument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.CommandSourceStack; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.ComponentArgument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Coordinates; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.EntityArgument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.EntitySelector; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.GameProfileArgument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.ResourceLocationArgument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Vec3Argument; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.Vec3i; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.NbtIo; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.StringTag; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.Tag; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.FriendlyByteBuf; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.chat.Component; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.ClientboundCustomPayloadPacket; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.ClientboundGameEventPacket; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.Packet; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ChunkMap; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedPlayerList; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServer; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServerProperties; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.MinecraftServer; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerChunkCache; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerGamePacketListenerImpl; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerLevel; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.Settings; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.util.ProgressListener; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkPos; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkStorage; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.DamageSource; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Level; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.MapItemSavedData; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.SavedData; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; +import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooBlock; +import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf; +import fr.pandacube.lib.paper.reflect.wrapper.netty.Unpooled; +import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; +import fr.pandacube.lib.paper.reflect.wrapper.paper.PaperAdventure; +import fr.pandacube.lib.paper.reflect.wrapper.paper.QueuedChangesMapLong2Object; +import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.FallbackValue_Int; +import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.WorldConfiguration; + +import static fr.pandacube.lib.reflect.wrapper.WrapperRegistry.initWrapper; public class PandalibPaperReflect { public static void init() { NMSReflect.init(); - WrapperRegistry.init(); + initWrapperClasses(); + } + + private static void initWrapperClasses() { + // brigadier + initWrapper(CommandNode.class, CommandNode.REFLECT.get()); + + // craftbukkit + initWrapper(CraftMapView.class, CraftMapView.REFLECT.get()); + initWrapper(CraftNamespacedKey.class, CraftNamespacedKey.REFLECT.get()); + initWrapper(CraftPlayer.class, CraftPlayer.REFLECT.get()); + initWrapper(CraftServer.class, CraftServer.REFLECT.get()); + initWrapper(CraftVector.class, CraftVector.REFLECT.get()); + initWrapper(CraftWorld.class, CraftWorld.REFLECT.get()); + initWrapper(RenderData.class, RenderData.REFLECT.get()); + initWrapper(VanillaCommandWrapper.class, VanillaCommandWrapper.REFLECT.get()); + + // minecraft.commands + initWrapper(BlockPosArgument.class, BlockPosArgument.MAPPING.runtimeClass()); + initWrapper(Commands.class, Commands.MAPPING.runtimeClass()); + initWrapper(CommandSourceStack.class, CommandSourceStack.MAPPING.runtimeClass()); + initWrapper(ComponentArgument.class, ComponentArgument.MAPPING.runtimeClass()); + initWrapper(Coordinates.class, Coordinates.MAPPING.runtimeClass()); + initWrapper(EntityArgument.class, EntityArgument.MAPPING.runtimeClass()); + initWrapper(EntitySelector.class, EntitySelector.MAPPING.runtimeClass()); + initWrapper(GameProfileArgument.class, GameProfileArgument.MAPPING.runtimeClass()); + initWrapper(ResourceLocationArgument.class, ResourceLocationArgument.MAPPING.runtimeClass()); + initWrapper(Vec3Argument.class, Vec3Argument.MAPPING.runtimeClass()); + // minecraft.core + initWrapper(BlockPos.class, BlockPos.MAPPING.runtimeClass()); + initWrapper(Vec3i.class, Vec3i.MAPPING.runtimeClass()); + // minecraft.nbt + initWrapper(CompoundTag.class, CompoundTag.MAPPING.runtimeClass()); + initWrapper(NbtIo.class, NbtIo.MAPPING.runtimeClass()); + initWrapper(StringTag.class, StringTag.MAPPING.runtimeClass()); + initWrapper(Tag.class, Tag.MAPPING.runtimeClass()); + // minecraft.network.chat + initWrapper(Component.class, Component.MAPPING.runtimeClass()); + // minecraft.network.protocol + initWrapper(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket.MAPPING.runtimeClass()); + initWrapper(ClientboundGameEventPacket.class, ClientboundGameEventPacket.MAPPING.runtimeClass()); + initWrapper(ClientboundGameEventPacket.Type.class, ClientboundGameEventPacket.Type.MAPPING.runtimeClass()); + initWrapper(Packet.class, Packet.MAPPING.runtimeClass()); + // minecraft.network + initWrapper(FriendlyByteBuf.class, FriendlyByteBuf.MAPPING.runtimeClass()); + // minecraft.resources + initWrapper(ResourceLocation.class, ResourceLocation.MAPPING.runtimeClass()); + // minecraft.server + initWrapper(ChunkMap.class, ChunkMap.MAPPING.runtimeClass()); + initWrapper(DedicatedPlayerList.class, DedicatedPlayerList.MAPPING.runtimeClass()); + initWrapper(DedicatedServer.class, DedicatedServer.MAPPING.runtimeClass()); + initWrapper(DedicatedServerProperties.class, DedicatedServerProperties.MAPPING.runtimeClass()); + initWrapper(MinecraftServer.class, MinecraftServer.MAPPING.runtimeClass()); + initWrapper(ServerChunkCache.class, ServerChunkCache.MAPPING.runtimeClass()); + initWrapper(ServerGamePacketListenerImpl.class, ServerGamePacketListenerImpl.MAPPING.runtimeClass()); + initWrapper(ServerLevel.class, ServerLevel.MAPPING.runtimeClass()); + initWrapper(ServerPlayer.class, ServerPlayer.MAPPING.runtimeClass()); + initWrapper(Settings.class, Settings.MAPPING.runtimeClass()); + // minecraft.util + initWrapper(ProgressListener.class, ProgressListener.MAPPING.runtimeClass()); + // minecraft.world.block + initWrapper(BambooBlock.class, BambooBlock.MAPPING.runtimeClass()); + // minecraft.world + initWrapper(AABB.class, AABB.MAPPING.runtimeClass()); + initWrapper(ChunkPos.class, ChunkPos.MAPPING.runtimeClass()); + initWrapper(ChunkStorage.class, ChunkStorage.MAPPING.runtimeClass()); + initWrapper(DamageSource.class, DamageSource.MAPPING.runtimeClass()); + initWrapper(Entity.class, Entity.MAPPING.runtimeClass()); + initWrapper(Level.class, Level.MAPPING.runtimeClass()); + initWrapper(MapItemSavedData.class, MapItemSavedData.MAPPING.runtimeClass()); + initWrapper(SavedData.class, SavedData.MAPPING.runtimeClass()); + initWrapper(Vec3.class, Vec3.MAPPING.runtimeClass()); + initWrapper(VoxelShape.class, VoxelShape.MAPPING.runtimeClass()); + // minecraft + initWrapper(DetectedVersion.class, DetectedVersion.MAPPING.runtimeClass()); + initWrapper(SharedConstants.class, SharedConstants.MAPPING.runtimeClass()); + initWrapper(WorldVersion.class, WorldVersion.MAPPING.runtimeClass()); + + // netty + initWrapper(ByteBuf.class, ByteBuf.REFLECT.get()); + initWrapper(Unpooled.class, Unpooled.REFLECT.get()); + + // paper.configuration + initWrapper(FallbackValue_Int.class, FallbackValue_Int.REFLECT.get()); + initWrapper(WorldConfiguration.class, WorldConfiguration.REFLECT.get()); + initWrapper(WorldConfiguration.Chunks.class, WorldConfiguration.Chunks.REFLECT.get()); + // paper + initWrapper(AABBVoxelShape.class, AABBVoxelShape.REFLECT.get()); + initWrapper(PaperAdventure.class, PaperAdventure.REFLECT.get()); + initWrapper(QueuedChangesMapLong2Object.class, QueuedChangesMapLong2Object.REFLECT.get()); } } diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java deleted file mode 100644 index 9caee21..0000000 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/WrapperRegistry.java +++ /dev/null @@ -1,233 +0,0 @@ -package fr.pandacube.lib.paper.reflect.wrapper; - -import fr.pandacube.lib.util.Log; -import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.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; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftPlayer; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftServer; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftVector; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftWorld; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.RenderData; -import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.VanillaCommandWrapper; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.DetectedVersion; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.SharedConstants; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.WorldVersion; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.BlockPosArgument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.CommandSourceStack; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.ComponentArgument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Coordinates; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.EntityArgument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.EntitySelector; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.GameProfileArgument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.ResourceLocationArgument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Vec3Argument; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.Vec3i; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.NbtIo; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.StringTag; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.Tag; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.FriendlyByteBuf; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.chat.Component; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.ClientboundCustomPayloadPacket; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.ClientboundGameEventPacket; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.Packet; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ChunkMap; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedPlayerList; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServer; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServerProperties; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.MinecraftServer; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerChunkCache; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerGamePacketListenerImpl; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerLevel; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.Settings; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.util.ProgressListener; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkPos; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkStorage; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.DamageSource; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Level; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.MapItemSavedData; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.SavedData; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; -import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooBlock; -import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf; -import fr.pandacube.lib.paper.reflect.wrapper.netty.Unpooled; -import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; -import fr.pandacube.lib.paper.reflect.wrapper.paper.PaperAdventure; -import fr.pandacube.lib.paper.reflect.wrapper.paper.QueuedChangesMapLong2Object; -import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.FallbackValue_Int; -import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.WorldConfiguration; - -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Map; - -public class WrapperRegistry { - - public static void init() { - - // craftbukkit - initWrapper(CommandNode.class, CommandNode.REFLECT.get()); - - // craftbukkit - initWrapper(CraftMapView.class, CraftMapView.REFLECT.get()); - initWrapper(CraftNamespacedKey.class, CraftNamespacedKey.REFLECT.get()); - initWrapper(CraftPlayer.class, CraftPlayer.REFLECT.get()); - initWrapper(CraftServer.class, CraftServer.REFLECT.get()); - initWrapper(CraftVector.class, CraftVector.REFLECT.get()); - initWrapper(CraftWorld.class, CraftWorld.REFLECT.get()); - initWrapper(RenderData.class, RenderData.REFLECT.get()); - initWrapper(VanillaCommandWrapper.class, VanillaCommandWrapper.REFLECT.get()); - - // minecraft.commands - initWrapper(BlockPosArgument.class, BlockPosArgument.MAPPING.runtimeClass()); - initWrapper(Commands.class, Commands.MAPPING.runtimeClass()); - initWrapper(CommandSourceStack.class, CommandSourceStack.MAPPING.runtimeClass()); - initWrapper(ComponentArgument.class, ComponentArgument.MAPPING.runtimeClass()); - initWrapper(Coordinates.class, Coordinates.MAPPING.runtimeClass()); - initWrapper(EntityArgument.class, EntityArgument.MAPPING.runtimeClass()); - initWrapper(EntitySelector.class, EntitySelector.MAPPING.runtimeClass()); - initWrapper(GameProfileArgument.class, GameProfileArgument.MAPPING.runtimeClass()); - initWrapper(ResourceLocationArgument.class, ResourceLocationArgument.MAPPING.runtimeClass()); - initWrapper(Vec3Argument.class, Vec3Argument.MAPPING.runtimeClass()); - // minecraft.core - initWrapper(BlockPos.class, BlockPos.MAPPING.runtimeClass()); - initWrapper(Vec3i.class, Vec3i.MAPPING.runtimeClass()); - // minecraft.nbt - initWrapper(CompoundTag.class, CompoundTag.MAPPING.runtimeClass()); - initWrapper(NbtIo.class, NbtIo.MAPPING.runtimeClass()); - initWrapper(StringTag.class, StringTag.MAPPING.runtimeClass()); - initWrapper(Tag.class, Tag.MAPPING.runtimeClass()); - // minecraft.network.chat - initWrapper(Component.class, Component.MAPPING.runtimeClass()); - // minecraft.network.protocol - initWrapper(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket.MAPPING.runtimeClass()); - initWrapper(ClientboundGameEventPacket.class, ClientboundGameEventPacket.MAPPING.runtimeClass()); - initWrapper(ClientboundGameEventPacket.Type.class, ClientboundGameEventPacket.Type.MAPPING.runtimeClass()); - initWrapper(Packet.class, Packet.MAPPING.runtimeClass()); - // minecraft.network - initWrapper(FriendlyByteBuf.class, FriendlyByteBuf.MAPPING.runtimeClass()); - // minecraft.resources - initWrapper(ResourceLocation.class, ResourceLocation.MAPPING.runtimeClass()); - // minecraft.server - initWrapper(ChunkMap.class, ChunkMap.MAPPING.runtimeClass()); - initWrapper(DedicatedPlayerList.class, DedicatedPlayerList.MAPPING.runtimeClass()); - initWrapper(DedicatedServer.class, DedicatedServer.MAPPING.runtimeClass()); - initWrapper(DedicatedServerProperties.class, DedicatedServerProperties.MAPPING.runtimeClass()); - initWrapper(MinecraftServer.class, MinecraftServer.MAPPING.runtimeClass()); - initWrapper(ServerChunkCache.class, ServerChunkCache.MAPPING.runtimeClass()); - initWrapper(ServerGamePacketListenerImpl.class, ServerGamePacketListenerImpl.MAPPING.runtimeClass()); - initWrapper(ServerLevel.class, ServerLevel.MAPPING.runtimeClass()); - initWrapper(ServerPlayer.class, ServerPlayer.MAPPING.runtimeClass()); - initWrapper(Settings.class, Settings.MAPPING.runtimeClass()); - // minecraft.util - initWrapper(ProgressListener.class, ProgressListener.MAPPING.runtimeClass()); - // minecraft.world.block - initWrapper(BambooBlock.class, BambooBlock.MAPPING.runtimeClass()); - // minecraft.world - initWrapper(AABB.class, AABB.MAPPING.runtimeClass()); - initWrapper(ChunkPos.class, ChunkPos.MAPPING.runtimeClass()); - initWrapper(ChunkStorage.class, ChunkStorage.MAPPING.runtimeClass()); - initWrapper(DamageSource.class, DamageSource.MAPPING.runtimeClass()); - initWrapper(Entity.class, Entity.MAPPING.runtimeClass()); - initWrapper(Level.class, Level.MAPPING.runtimeClass()); - initWrapper(MapItemSavedData.class, MapItemSavedData.MAPPING.runtimeClass()); - initWrapper(SavedData.class, SavedData.MAPPING.runtimeClass()); - initWrapper(Vec3.class, Vec3.MAPPING.runtimeClass()); - initWrapper(VoxelShape.class, VoxelShape.MAPPING.runtimeClass()); - // minecraft - initWrapper(DetectedVersion.class, DetectedVersion.MAPPING.runtimeClass()); - initWrapper(SharedConstants.class, SharedConstants.MAPPING.runtimeClass()); - initWrapper(WorldVersion.class, WorldVersion.MAPPING.runtimeClass()); - - // netty - initWrapper(ByteBuf.class, ByteBuf.REFLECT.get()); - initWrapper(Unpooled.class, Unpooled.REFLECT.get()); - - // paper.configuration - initWrapper(FallbackValue_Int.class, FallbackValue_Int.REFLECT.get()); - initWrapper(WorldConfiguration.class, WorldConfiguration.REFLECT.get()); - initWrapper(WorldConfiguration.Chunks.class, WorldConfiguration.Chunks.REFLECT.get()); - // paper - initWrapper(AABBVoxelShape.class, AABBVoxelShape.REFLECT.get()); - initWrapper(PaperAdventure.class, PaperAdventure.REFLECT.get()); - initWrapper(QueuedChangesMapLong2Object.class, QueuedChangesMapLong2Object.REFLECT.get()); - } - - - /* package */ static Class getWrapperOfRuntimeClass(Class runtime) { - RegistryEntry e = WRAPPER_DATA_BY_RUNTIME_CLASS.get(runtime); - return e == null ? null : e.wrapperClass; - } - - /* package */ static Class getRuntimeClassOfWrapperClass(Class wrapperClass) { - RegistryEntry e = WRAPPER_DATA_BY_WRAPPER_CLASS.get(wrapperClass); - return e == null ? null : e.runtimeClass; - } - - /* package */ static ReflectConstructor getWrapperConstructorOfWrapperClass(Class wrapperClass) { - RegistryEntry e = WRAPPER_DATA_BY_WRAPPER_CLASS.get(wrapperClass); - return e == null ? null : e.objectWrapperConstructor; - } - - - - - private static final Map, RegistryEntry> WRAPPER_DATA_BY_RUNTIME_CLASS = new HashMap<>(); - private static final Map, RegistryEntry> WRAPPER_DATA_BY_WRAPPER_CLASS = new HashMap<>(); - - - - - - - - - public static void initWrapper(Class wrapper, Class runtime) { - Class concreteWrapper = wrapper; - ReflectConstructor objectWrapperConstructor; - if (wrapper.isInterface() || Modifier.isAbstract(wrapper.getModifiers())) { - ConcreteWrapper concreteWrapperAnnotation = wrapper.getAnnotation(ConcreteWrapper.class); - if (concreteWrapperAnnotation == null || concreteWrapperAnnotation.value() == null) { - Log.severe("The provided non-concrete (interface or abstract class) wrapper " + wrapper + " does not" + - " provide any concrete wrapper."); - return; - } - concreteWrapper = concreteWrapperAnnotation.value(); - if (!wrapper.isAssignableFrom(concreteWrapper)) { - Log.severe("The concrete wrapper " + concreteWrapper + " does not extends or implements " + wrapper + "."); - return; - } - } - try { - objectWrapperConstructor = Reflect.ofClass(concreteWrapper).constructor(Object.class); - } catch (NoSuchMethodException e) { - Log.severe("The wrapper " + concreteWrapper + " does not provide a constructor that takes a unique" + - " Object parameter.", e); - return; - } - RegistryEntry e = new RegistryEntry(runtime, wrapper, concreteWrapper, objectWrapperConstructor); - WRAPPER_DATA_BY_RUNTIME_CLASS.put(runtime, e); - WRAPPER_DATA_BY_WRAPPER_CLASS.put(wrapper, e); - if (concreteWrapper != wrapper) { - WRAPPER_DATA_BY_WRAPPER_CLASS.put(concreteWrapper, e); - } - } - - - private record RegistryEntry(Class runtimeClass, - Class wrapperClass, - Class concreteWrapperClass, - ReflectConstructor objectWrapperConstructor) { - } - -} diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java index 691bf9d..c89d14e 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/brigadier/CommandNode.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.brigadier; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java index cfb6b8c..cf671ef 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftMapView.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.MapItemSavedData; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java index 21b3401..ff23bd2 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftNamespacedKey.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java index 3f49ff0..2c038b2 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftPlayer.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java index 3fe622d..808899c 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftServer.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedPlayerList; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServer; import fr.pandacube.lib.reflect.ReflectClass; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java index c49825b..97c1f7e 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftVector.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; import fr.pandacube.lib.reflect.ReflectClass; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java index 8f3c200..adb49c2 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/CraftWorld.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerLevel; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java index 2d3d202..15f5a94 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/RenderData.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java index 48ba41c..e9f56b3 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/craftbukkit/VanillaCommandWrapper.java @@ -4,7 +4,7 @@ import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.tree.CommandNode; import fr.pandacube.lib.paper.reflect.OBCReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectConstructor; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java index 9d9396b..11d4484 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/DetectedVersion.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java index 8247b1e..262eab8 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/SharedConstants.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java index c2123a5..d1aefcd 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/WorldVersion.java @@ -2,9 +2,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; -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 fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java index dde0c24..6ec7a6a 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/BlockPosArgument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java index 50c6581..5416cc0 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/CommandSourceStack.java @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java index 601f16f..fe7db81 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Commands.java @@ -4,7 +4,7 @@ import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.CommandDispatcher; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java index fc45008..f4e4542 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ComponentArgument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java index 9abf32d..17a9b9c 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Coordinates.java @@ -3,16 +3,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import fr.pandacube.lib.paper.reflect.NMSReflect; -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 fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; import fr.pandacube.lib.reflect.ReflectMethod; 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; +import static fr.pandacube.lib.reflect.wrapper.ReflectWrapper.wrap; @ConcreteWrapper(Coordinates.__concrete.class) public interface Coordinates extends ReflectWrapperI { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java index f305fd6..0244246 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntityArgument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java index 4086f2f..678c245 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/EntitySelector.java @@ -3,8 +3,8 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectListWrapper; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectListWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java index 794bfa5..67a02bc 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/GameProfileArgument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java index 88a19a8..f8b62e3 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/ResourceLocationArgument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java index 2e8db12..0e58b8b 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/commands/Vec3Argument.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java index 671e6b9..ad09f5e 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/core/Vec3i.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.core; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java index 6b999c9..9a3d899 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CompoundTag.java @@ -11,7 +11,7 @@ import java.util.UUID; import fr.pandacube.lib.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; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; public class CompoundTag extends ReflectWrapper implements Tag { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.nbt.CompoundTag")); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java index 48a3b9c..ee0b67f 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/NbtIo.java @@ -7,7 +7,7 @@ import java.io.File; import fr.pandacube.lib.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; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; public class NbtIo extends ReflectWrapper { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.nbt.NbtIo")); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java index 2937c0b..526bd98 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/StringTag.java @@ -4,7 +4,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; public class StringTag extends ReflectWrapper implements Tag { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.nbt.StringTag")); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java index aa997b0..26d6697 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/Tag.java @@ -6,9 +6,9 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; import fr.pandacube.lib.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; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; +import fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; @ConcreteWrapper(Tag.__concrete.class) public interface Tag extends ReflectWrapperI { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java index ce7e6db..2bf2f3b 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/chat/Component.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.chat; import fr.pandacube.lib.paper.reflect.NMSReflect; -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 fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java index 03c4cdb..91fa00b 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundCustomPayloadPacket.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.FriendlyByteBuf; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; import fr.pandacube.lib.reflect.ReflectConstructor; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java index 38c63f3..461c5bf 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/ClientboundGameEventPacket.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectConstructor; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java index a59963d..be8f602 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/protocol/Packet.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; import fr.pandacube.lib.paper.reflect.NMSReflect; -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 fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java index c27bbfd..3936905 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/resources/ResourceLocation.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java index 0a9c976..ad93b88 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedPlayerList.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java index 8223baf..db4bec9 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/MinecraftServer.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java index bef99cc..26f9e74 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerChunkCache.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java index a24e3eb..b0cebaf 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerGamePacketListenerImpl.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.Packet; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java index b7968bb..f0fb492 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/Settings.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectField; import java.util.Properties; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java index 694668c..d6c6178 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/util/ProgressListener.java @@ -1,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.util; import fr.pandacube.lib.paper.reflect.NMSReflect; -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 fr.pandacube.lib.reflect.wrapper.ConcreteWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java index 3d1fffc..16aac02 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/AABB.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectConstructor; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java index 22eb67b..ebe497a 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkPos.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectConstructor; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java index b71fd21..89802e7 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/ChunkStorage.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java index 9b99b16..12f0e77 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/DamageSource.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java index a2e76c1..eaed87c 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Entity.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java index 4ec78f4..ea77832 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Level.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.WorldConfiguration; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java index a91b9eb..7b9f511 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/SavedData.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java index aa14f2e..18096f5 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/Vec3.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java index 50fdd21..c14ecf2 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/VoxelShape.java @@ -1,7 +1,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 fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java index 4988d56..d00af14 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/block/BambooBlock.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block; import fr.pandacube.lib.paper.reflect.NMSReflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java index e407ff6..b6b1ebb 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/ByteBuf.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.netty; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java index 02d3490..0a6cb02 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/netty/Unpooled.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.netty; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java index 3cad172..46fcfba 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/PaperAdventure.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.chat.Component; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java index 0f9bcf7..a5e7f9b 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/QueuedChangesMapLong2Object.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java index 97177ee..d939c5f 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/FallbackValue_Int.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper.configuration; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectMethod; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java index c588971..12e6d00 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/configuration/WorldConfiguration.java @@ -1,7 +1,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper.configuration; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.reflect.ReflectField; diff --git a/pandalib-reflect/pom.xml b/pandalib-reflect/pom.xml index 338d83b..db1d1a1 100644 --- a/pandalib-reflect/pom.xml +++ b/pandalib-reflect/pom.xml @@ -19,6 +19,16 @@ classgraph 4.8.149 + + fr.pandacube.lib + pandalib-util + ${project.version} + + + com.google.guava + guava + 31.0.1-jre + diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ConcreteWrapper.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ConcreteWrapper.java similarity index 90% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ConcreteWrapper.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ConcreteWrapper.java index da089a4..fb14858 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ConcreteWrapper.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ConcreteWrapper.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectListWrapper.java similarity index 96% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectListWrapper.java index a0032be..bc9fe88 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectListWrapper.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectListWrapper.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; import java.util.ArrayList; import java.util.List; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java similarity index 98% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java index fde336e..e10bf1f 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; import com.google.common.collect.MapMaker; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperI.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperI.java similarity index 79% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperI.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperI.java index 7f5209d..bf441a2 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperI.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperI.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; public interface ReflectWrapperI { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTyped.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTyped.java similarity index 90% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTyped.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTyped.java index 7f5c14e..50b06f3 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTyped.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTyped.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; public abstract class ReflectWrapperTyped extends ReflectWrapper implements ReflectWrapperTypedI { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTypedI.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTypedI.java similarity index 86% rename from pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTypedI.java rename to pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTypedI.java index b18ef7d..186e879 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapperTypedI.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapperTypedI.java @@ -1,4 +1,4 @@ -package fr.pandacube.lib.paper.reflect.wrapper; +package fr.pandacube.lib.reflect.wrapper; public interface ReflectWrapperTypedI extends ReflectWrapperI { @SuppressWarnings("unchecked") diff --git a/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java new file mode 100644 index 0000000..bfd5c21 --- /dev/null +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/WrapperRegistry.java @@ -0,0 +1,79 @@ +package fr.pandacube.lib.reflect.wrapper; + +import fr.pandacube.lib.reflect.Reflect; +import fr.pandacube.lib.reflect.ReflectConstructor; +import fr.pandacube.lib.util.Log; + +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.Map; + +public class WrapperRegistry { + + /* package */ static Class getWrapperOfRuntimeClass(Class runtime) { + RegistryEntry e = WRAPPER_DATA_BY_RUNTIME_CLASS.get(runtime); + return e == null ? null : e.wrapperClass; + } + + /* package */ static Class getRuntimeClassOfWrapperClass(Class wrapperClass) { + RegistryEntry e = WRAPPER_DATA_BY_WRAPPER_CLASS.get(wrapperClass); + return e == null ? null : e.runtimeClass; + } + + /* package */ static ReflectConstructor getWrapperConstructorOfWrapperClass(Class wrapperClass) { + RegistryEntry e = WRAPPER_DATA_BY_WRAPPER_CLASS.get(wrapperClass); + return e == null ? null : e.objectWrapperConstructor; + } + + + + + private static final Map, RegistryEntry> WRAPPER_DATA_BY_RUNTIME_CLASS = new HashMap<>(); + private static final Map, RegistryEntry> WRAPPER_DATA_BY_WRAPPER_CLASS = new HashMap<>(); + + + + + + + + + public static void initWrapper(Class wrapper, Class runtime) { + Class concreteWrapper = wrapper; + ReflectConstructor objectWrapperConstructor; + if (wrapper.isInterface() || Modifier.isAbstract(wrapper.getModifiers())) { + ConcreteWrapper concreteWrapperAnnotation = wrapper.getAnnotation(ConcreteWrapper.class); + if (concreteWrapperAnnotation == null || concreteWrapperAnnotation.value() == null) { + Log.severe("The provided non-concrete (interface or abstract class) wrapper " + wrapper + " does not" + + " provide any concrete wrapper."); + return; + } + concreteWrapper = concreteWrapperAnnotation.value(); + if (!wrapper.isAssignableFrom(concreteWrapper)) { + Log.severe("The concrete wrapper " + concreteWrapper + " does not extends or implements " + wrapper + "."); + return; + } + } + try { + objectWrapperConstructor = Reflect.ofClass(concreteWrapper).constructor(Object.class); + } catch (NoSuchMethodException e) { + Log.severe("The wrapper " + concreteWrapper + " does not provide a constructor that takes a unique" + + " Object parameter.", e); + return; + } + RegistryEntry e = new RegistryEntry(runtime, wrapper, concreteWrapper, objectWrapperConstructor); + WRAPPER_DATA_BY_RUNTIME_CLASS.put(runtime, e); + WRAPPER_DATA_BY_WRAPPER_CLASS.put(wrapper, e); + if (concreteWrapper != wrapper) { + WRAPPER_DATA_BY_WRAPPER_CLASS.put(concreteWrapper, e); + } + } + + + private record RegistryEntry(Class runtimeClass, + Class wrapperClass, + Class concreteWrapperClass, + ReflectConstructor objectWrapperConstructor) { + } + +} diff --git a/pom.xml b/pom.xml index f577a3d..0a3bf3a 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,7 @@ pandalib-bungee-players pandalib-chat pandalib-cli + pandalib-commands pandalib-core pandalib-db pandalib-net