From 5ff9a40f19289431c5ac5d7dae8f6c96233745b5 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Thu, 28 Jul 2022 01:11:28 +0200 Subject: [PATCH] pandalib-chat API changes (+ some javadoc) and pandalib-reflect imports fixes --- .../main/java/fr/pandacube/lib/chat/Chat.java | 28 +-- .../fr/pandacube/lib/chat/ChatStatic.java | 90 ++++++-- .../java/fr/pandacube/lib/chat/ChatUtil.java | 213 ++++++++++++------ .../lib/paper/reflect/NMSReflect.java | 8 +- .../lib/paper/reflect/NMSTypeWrapper.java | 2 +- .../lib/paper/reflect/OBCReflect.java | 2 +- .../paper/reflect/wrapper/ReflectWrapper.java | 5 +- .../reflect/wrapper/WrapperRegistry.java | 2 +- .../wrapper/brigadier/CommandNode.java | 6 +- .../wrapper/craftbukkit/CraftMapView.java | 11 +- .../craftbukkit/CraftNamespacedKey.java | 10 +- .../wrapper/craftbukkit/CraftPlayer.java | 8 +- .../wrapper/craftbukkit/CraftServer.java | 10 +- .../wrapper/craftbukkit/CraftVector.java | 14 +- .../wrapper/craftbukkit/CraftWorld.java | 8 +- .../wrapper/craftbukkit/RenderData.java | 7 +- .../craftbukkit/VanillaCommandWrapper.java | 15 +- .../wrapper/minecraft/SharedConstants.java | 6 +- .../minecraft/commands/BlockPosArgument.java | 5 +- .../wrapper/minecraft/commands/Commands.java | 5 +- .../minecraft/commands/ComponentArgument.java | 5 +- .../minecraft/commands/Coordinates.java | 7 +- .../minecraft/commands/EntityArgument.java | 11 +- .../minecraft/commands/EntitySelector.java | 11 +- .../commands/GameProfileArgument.java | 5 +- .../commands/ResourceLocationArgument.java | 5 +- .../minecraft/commands/Vec3Argument.java | 5 +- .../reflect/wrapper/minecraft/core/Vec3i.java | 8 +- .../wrapper/minecraft/nbt/CompoundTag.java | 2 +- .../reflect/wrapper/minecraft/nbt/NbtIo.java | 2 +- .../reflect/wrapper/minecraft/nbt/Tag.java | 2 +- .../minecraft/network/FriendlyByteBuf.java | 7 +- .../ClientboundCustomPayloadPacket.java | 7 +- .../protocol/ClientboundGameEventPacket.java | 9 +- .../wrapper/minecraft/server/ChunkMap.java | 13 +- .../minecraft/server/DedicatedServer.java | 6 +- .../minecraft/server/MinecraftServer.java | 4 +- .../minecraft/server/ServerChunkCache.java | 4 +- .../server/ServerGamePacketListenerImpl.java | 4 +- .../wrapper/minecraft/server/ServerLevel.java | 6 +- .../minecraft/server/ServerPlayer.java | 11 +- .../wrapper/minecraft/server/Settings.java | 4 +- .../reflect/wrapper/minecraft/world/AABB.java | 4 +- .../wrapper/minecraft/world/ChunkPos.java | 4 +- .../wrapper/minecraft/world/ChunkStorage.java | 4 +- .../wrapper/minecraft/world/DamageSource.java | 4 +- .../wrapper/minecraft/world/Entity.java | 4 +- .../wrapper/minecraft/world/Level.java | 8 +- .../minecraft/world/MapItemSavedData.java | 6 +- .../wrapper/minecraft/world/SavedData.java | 4 +- .../minecraft/world/block/BambooBlock.java | 4 +- .../paper/reflect/wrapper/netty/ByteBuf.java | 3 +- .../paper/reflect/wrapper/netty/Unpooled.java | 6 +- .../reflect/wrapper/paper/AABBVoxelShape.java | 6 +- .../reflect/wrapper/paper/PaperAdventure.java | 6 +- .../paper/QueuedChangesMapLong2Object.java | 7 +- .../configuration/FallbackValue_Int.java | 6 +- .../configuration/WorldConfiguration.java | 10 +- 58 files changed, 428 insertions(+), 251 deletions(-) diff --git a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/Chat.java b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/Chat.java index 4e7b654..568db4c 100644 --- a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/Chat.java +++ b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/Chat.java @@ -90,8 +90,8 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource public Chat then(BaseComponent subComponent) { return then(toAdventure(subComponent)); } - public Chat then(Chat comp) { - return then(comp.getAdv()); + public Chat then(ComponentLike comp) { + return then(comp.asComponent()); } public Chat then(BaseComponent[] components) { return then(toAdventure(components)); @@ -112,20 +112,20 @@ public abstract sealed class Chat extends ChatStatic implements HoverEventSource public Chat thenKeyBind(String key) { return then(keybind(key)); } public Chat thenScore(String name, String objective) { return then(score(name, objective)); } - public Chat thenURLLink(Chat inner, String url, Chat hover) { return then(ChatUtil.createURLLink(inner, url, hover)); } - public Chat thenURLLink(Chat inner, String url) { return thenURLLink(inner, url, null); } - public Chat thenURLLink(String url, Chat hover) { return thenURLLink(text(url), url, hover); } - public Chat thenURLLink(String url) { return thenURLLink(text(url), url); } + public Chat thenURLLink(Chat inner, String url, Chat hover) { return then(clickableURL(inner, url, hover)); } + public Chat thenURLLink(Chat inner, String url) { return then(clickableURL(inner, url)); } + public Chat thenURLLink(String url, Chat hover) { return then(clickableURL(url, hover)); } + public Chat thenURLLink(String url) { return then(clickableURL(url)); } - public Chat thenCommandLink(Chat inner, String cmdWithSlash, Chat hover) { return then(ChatUtil.createCommandLink(inner, cmdWithSlash, hover)); } - public Chat thenCommandLink(Chat inner, String cmdWithSlash) { return thenCommandLink(inner, cmdWithSlash, null); } - public Chat thenCommandLink(String cmdWithSlash, Chat hover) { return thenCommandLink(text(cmdWithSlash), cmdWithSlash, hover); } - public Chat thenCommandLink(String cmdWithSlash) { return thenCommandLink(text(cmdWithSlash), cmdWithSlash); } + public Chat thenCommandLink(Chat inner, String cmdWithSlash, Chat hover) { return then(clickableCommand(inner, cmdWithSlash, hover)); } + public Chat thenCommandLink(Chat inner, String cmdWithSlash) { return then(clickableCommand(inner, cmdWithSlash)); } + public Chat thenCommandLink(String cmdWithSlash, Chat hover) { return then(clickableCommand(cmdWithSlash, hover)); } + public Chat thenCommandLink(String cmdWithSlash) { return then(clickableCommand(cmdWithSlash)); } - public Chat thenCommandSuggest(Chat inner, String cmdWithSlash, Chat hover) { return then(ChatUtil.createCommandSuggest(inner, cmdWithSlash, hover)); } - public Chat thenCommandSuggest(Chat inner, String cmdWithSlash) { return thenCommandSuggest(inner, cmdWithSlash, null); } - public Chat thenCommandSuggest(String cmdWithSlash, Chat hover) { return thenCommandSuggest(text(cmdWithSlash), cmdWithSlash, hover); } - public Chat thenCommandSuggest(String cmdWithSlash) { return thenCommandSuggest(text(cmdWithSlash), cmdWithSlash); } + public Chat thenCommandSuggest(Chat inner, String cmdWithSlash, Chat hover) { return then(clickableSuggest(inner, cmdWithSlash, hover)); } + public Chat thenCommandSuggest(Chat inner, String cmdWithSlash) { return then(clickableSuggest(inner, cmdWithSlash)); } + public Chat thenCommandSuggest(String cmdWithSlash, Chat hover) { return then(clickableSuggest(cmdWithSlash, hover)); } + public Chat thenCommandSuggest(String cmdWithSlash) { return then(clickableSuggest(cmdWithSlash)); } diff --git a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java index a15c539..f74883e 100644 --- a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java +++ b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatStatic.java @@ -40,8 +40,7 @@ public abstract class ChatStatic { * * @param plainText the text to use as he content of the new Chat instance. * @return a Chat instance with the provided text as its main text content. - * - * @throws IllegalArgumentException If the {@code plainText} parameter is instance of {@link Chat} or + * @throws IllegalArgumentException if the {@code plainText} parameter is instance of {@link Chat} or * {@link Component}. The caller should use {@link #chatComponent(ComponentLike)} * instead. */ @@ -58,7 +57,6 @@ public abstract class ChatStatic { * * @param legacyText the text to use as he content of the new Chat instance. * @return a Chat instance with the provided text as its main text content. - * * @throws IllegalArgumentException If the {@code plainText} parameter is instance of {@link Chat} or * {@link Component}. The caller should use {@link #chatComponent(ComponentLike)} * instead. @@ -107,34 +105,90 @@ public abstract class ChatStatic { } public static FormatableChat translation(String key, Object... with) { - return new FormatableChat(Component.translatable() - .key(key) - .args(Chat.filterObjToComponentLike(with)) - ); + return new FormatableChat(Component.translatable().key(key).args(Chat.filterObjToComponentLike(with))); } public static FormatableChat keybind(String key) { - return new FormatableChat(Component.keybind() - .keybind(key) - ); + return new FormatableChat(Component.keybind().keybind(key)); } public static FormatableChat score(String name, String objective) { - return new FormatableChat(Component.score() - .name(name) - .objective(objective) - ); + return new FormatableChat(Component.score().name(name).objective(objective)); + } + + public static FormatableChat clickableURL(Chat inner, String url, Chat hover) { + Objects.requireNonNull(url, "url"); + if (inner == null) + inner = text(url); + if (hover == null) + hover = text(ChatUtil.wrapInLimitedPixels(url, 240)); + return (FormatableChat) chat().clickURL(url).urlColor().hover(hover).then(inner); + } + + public static FormatableChat clickableURL(Chat inner, String url) { + return clickableURL(inner, url, null); + } + + public static FormatableChat clickableURL(String url, Chat hover) { + return clickableURL(null, url, hover); + } + + public static FormatableChat clickableURL(String url) { + return clickableURL(null, url, null); + } + + public static FormatableChat clickableCommand(Chat inner, String commandWithSlash, Chat hover) { + Objects.requireNonNull(commandWithSlash, "commandWithSlash"); + if (!commandWithSlash.startsWith("/")) + throw new IllegalArgumentException("commandWithSlash must start with a '/' character."); + if (inner == null) + inner = text(commandWithSlash); + if (hover == null) + hover = text(ChatUtil.wrapInLimitedPixels(commandWithSlash, 240)); + return (FormatableChat) chat().clickCommand(commandWithSlash).commandColor().hover(hover).then(inner); + } + + public static FormatableChat clickableCommand(Chat inner, String commandWithSlash) { + return clickableCommand(inner, commandWithSlash, null); + } + + public static FormatableChat clickableCommand(String commandWithSlash, Chat hover) { + return clickableCommand(null, commandWithSlash, hover); + } + + public static FormatableChat clickableCommand(String commandWithSlash) { + return clickableCommand(null, commandWithSlash, null); + } + + public static FormatableChat clickableSuggest(Chat inner, String commandWithSlash, Chat hover) { + Objects.requireNonNull(commandWithSlash, "commandWithSlash"); + if (!commandWithSlash.startsWith("/")) + throw new IllegalArgumentException("commandWithSlash must start with a '/' character."); + if (inner == null) + inner = text(commandWithSlash); + if (hover == null) + hover = text(ChatUtil.wrapInLimitedPixels(commandWithSlash, 240)); + return (FormatableChat) chat().clickSuggest(commandWithSlash).commandColor().hover(hover).then(inner); + } + + public static FormatableChat clickableSuggest(Chat inner, String commandWithSlash) { + return clickableSuggest(inner, commandWithSlash, null); + } + + public static FormatableChat clickableSuggest(String commandWithSlash, Chat hover) { + return clickableSuggest(null, commandWithSlash, hover); + } + + public static FormatableChat clickableSuggest(String commandWithSlash) { + return clickableSuggest(null, commandWithSlash, null); } - public static Component prefixedAndColored(ComponentLike message) { - return prefixedAndColored(Chat.chatComponent(message)).getAdv(); - } - public static Chat prefixedAndColored(Chat message) { + public static Chat prefixedAndColored(ComponentLike message) { return Chat.chat() .broadcastColor() .then(Chat.getConfig().prefix.get()) diff --git a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java index 6c5560a..49bea7d 100644 --- a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java +++ b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatUtil.java @@ -2,6 +2,8 @@ package fr.pandacube.lib.chat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -19,10 +21,16 @@ import net.md_5.bungee.api.ChatColor; import fr.pandacube.lib.chat.Chat.FormatableChat; +/** + * Provides various methods and properties to manipulate text displayed in chat an other parts of the game. + */ public class ChatUtil { - public static final int DEFAULT_CHAR_SIZE = 6; - public static final Map CHARS_SIZE = Map.ofEntries( + /* + * Note : this field is for easy listing of all characters with special sizes. It will all be reported to + * #CHAR_SIZES on class initialization for optimization. + */ + private static final Map SIZE_CHARS_MAPPING = Map.ofEntries( Map.entry(-6, "§"), Map.entry(2, "!.,:;i|¡'"), Map.entry(3, "`lìí’‘"), @@ -31,88 +39,146 @@ public class ChatUtil { Map.entry(7, "@~®©«»"), Map.entry(9, "├└") ); - - + /** + * The default text pixel width for a character in the default Minecraft font. + * If a character has another width, it should be found in {@link #CHAR_SIZES}. + */ + public static final int DEFAULT_CHAR_SIZE = 6; + + /** + * Mapping indicating the text pixel with for specific characters in the default Minecraft font. + * If a character doesn’t have a mapping in this map, then its width is {@link #DEFAULT_CHAR_SIZE}. + */ + public static final Map CHAR_SIZES; + static { + Map charSizes = new HashMap<>(); + for (var e : SIZE_CHARS_MAPPING.entrySet()) { + int size = e.getKey(); + for (char c : e.getValue().toCharArray()) { + charSizes.put(c, size); + } + } + CHAR_SIZES = Collections.unmodifiableMap(charSizes); + } + + + /** + * The default width of the Minecraft Java Edition chat window, in text pixels. + */ public static final int DEFAULT_CHAT_WIDTH = 320; + + /** + * The width of a Minecraft sign, in text pixels. + */ public static final int SIGN_WIDTH = 90; + + /** + * The width of a Minecraft book content, in text pixels. + */ public static final int BOOK_WIDTH = 116; + + /** + * The width of a Minecraft server MOTD message, in text pixels. + */ public static final int MOTD_WIDTH = 270; + + /** + * The width of a Minecraft Bedrock Edition form button, in text pixels. + */ public static final int BEDROCK_FORM_WIDE_BUTTON = 178; + /** + * The default number of character per lines for the console. + */ public static final int CONSOLE_NB_CHAR_DEFAULT = 50; - - - - - - + + + + + + /** + * Create a {@link Chat} that is a cliquable URL link. + * It is equivalent to the HTML {@code } tag pointing to another page. + * @param text the link text. + * @param url the destination url. must starts with {@code http} or {@code https}. + * @return a {@link Chat} that is a cliquable URL link. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableURL(Chat, String)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") public static FormatableChat createURLLink(String text, String url) { - return createURLLink(ChatStatic.legacyText(text), url, null); + return Chat.clickableURL(text == null ? null : Chat.legacyText(text), url); } - + + /** + * Create a {@link Chat} that is a cliquable URL link. + * It is equivalent to the HTML {@code } tag pointing to another page. + * @param text the link text. + * @param url the destination url. must starts with {@code http} or {@code https}. + * @param hoverText the text displayed when hovering the link. + * @return a {@link Chat} that is a cliquable URL link. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableURL(Chat, String, Chat)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") public static FormatableChat createURLLink(String text, String url, String hoverText) { - return createURLLink(ChatStatic.legacyText(text), url, hoverText != null ? ChatStatic.legacyText(hoverText) : null); + return Chat.clickableURL(text == null ? null : Chat.legacyText(text), url, hoverText == null ? null : Chat.legacyText(hoverText)); } - - /* package */ static FormatableChat createURLLink(Chat element, String url, Chat hover) { - String dispURL = (url.length() > 50) ? (url.substring(0, 48) + "...") : url; - return (FormatableChat) ChatStatic.chat() - .clickURL(url) - .urlColor() - .hover( - hover != null ? hover : Chat.text(dispURL) - ) - .then(element); - } - - - - - - - + /** + * Create a {@link Chat} that is a cliquable command link. + * When the players clicks on it, they will execute the command. + * @param text the link text. + * @param commandWithSlash the command to execute when clicked. + * @param hoverText the text displayed when hovering the link. + * @return a {@link Chat} that is a cliquable command link. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableCommand(Chat, String, Chat)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") public static FormatableChat createCommandLink(String text, String commandWithSlash, String hoverText) { - return createCommandLink(text, commandWithSlash, hoverText == null ? null : ChatStatic.legacyText(hoverText)); + return Chat.clickableCommand(text == null ? null : Chat.legacyText(text), commandWithSlash, hoverText == null ? null : Chat.legacyText(hoverText)); } + + /** + * Create a {@link Chat} that is a cliquable command link. + * When the players clicks on it, they will execute the command. + * @param text the link text. + * @param commandWithSlash the command to execute when clicked. + * @param hoverText the text displayed when hovering the link. + * @return a {@link Chat} that is a cliquable command link. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableCommand(Chat, String, Chat)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") public static FormatableChat createCommandLink(String text, String commandWithSlash, Chat hoverText) { - return createCommandLink(ChatStatic.legacyText(text), commandWithSlash, hoverText); - } - - /* package */ static FormatableChat createCommandLink(Chat d, String commandWithSlash, Chat hoverText) { - FormatableChat c = ChatStatic.chat() - .clickCommand(commandWithSlash) - .commandColor(); - if (hoverText != null) - c.hover(hoverText); - return (FormatableChat) c.then(d); + return Chat.clickableCommand(text == null ? null : Chat.legacyText(text), commandWithSlash, hoverText); } - - - - - - - - + /** + * Create a {@link Chat} that is a cliquable command suggestion. + * When the players clicks on it, they will execute the command. + * @param inner the link text. + * @param commandWithSlash the command to put in the chat box when clicked. + * @param hover the text displayed when hovering the link. + * @return a {@link Chat} that is a cliquable command suggestion. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableSuggest(Chat, String, Chat)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") + public static FormatableChat createCommandSuggest(String inner, String commandWithSlash, String hover) { + return Chat.clickableSuggest(inner == null ? null : Chat.legacyText(inner), commandWithSlash, hover == null ? null : Chat.legacyText(hover)); + } - public static FormatableChat createCommandSuggest(String text, String commandWithSlash, String hoverText) { - return createCommandSuggest(text, commandWithSlash, hoverText == null ? null : ChatStatic.legacyText(hoverText)); - } - public static FormatableChat createCommandSuggest(String text, String commandWithSlash, Chat hoverText) { - return createCommandSuggest(ChatStatic.legacyText(text), commandWithSlash, hoverText); - } - - /* package */ static FormatableChat createCommandSuggest(Chat d, String commandWithSlash, Chat hoverText) { - FormatableChat c = ChatStatic.chat() - .clickSuggest(commandWithSlash) - .commandColor(); - if (hoverText != null) - c.hover(hoverText); - return (FormatableChat) c.then(d); + /** + * Create a {@link Chat} that is a cliquable command suggestion. + * When the players clicks on it, they will execute the command. + * @param inner the link text. + * @param commandWithSlash the command to put in the chat box when clicked. + * @param hover the text displayed when hovering the link. + * @return a {@link Chat} that is a cliquable command suggestion. + * @deprecated it uses String for displayed text. Use {@link Chat#clickableSuggest(Chat, String, Chat)} instead. + */ + @Deprecated(forRemoval = true, since = "2022-07-27") + public static FormatableChat createCommandSuggest(String inner, String commandWithSlash, Chat hover) { + return Chat.clickableSuggest(inner == null ? null : Chat.legacyText(inner), commandWithSlash, hover); } @@ -123,7 +189,15 @@ public class ChatUtil { /** + * Create a page navigator with clickable page numbers for the chat. + * @param prefix the text to put before the * @param cmdFormat the command with %d inside to be replaced with the page number (must start with slash) + * @param currentPage the current page number (it is highlighted, and the pages around are displayed, according to + * {@code nbPagesToDisplay}). + * @param nbPages the number of pages. + * @param nbPagesToDisplay the number of pages to display around the first page, the last page and the + * {@code currentPage}. + * @return a {@link Chat} containging the created page navigator. */ public static Chat createPagination(String prefix, String cmdFormat, int currentPage, int nbPages, int nbPagesToDisplay) { Set pagesToDisplay = new TreeSet<>(); @@ -150,7 +224,7 @@ public class ChatUtil { else { if (cmdFormat.endsWith("%d")) { d.thenText(" "); - d.then(createCommandSuggest("...", cmdFormat.substring(0, cmdFormat.length() - 2), "Choisir la page")); + d.then(Chat.clickableSuggest(Chat.text("..."), cmdFormat.substring(0, cmdFormat.length() - 2), Chat.text("Choisir la page"))); d.thenText(" "); } else @@ -160,7 +234,7 @@ public class ChatUtil { else first = false; - FormatableChat pDisp = createCommandLink(Integer.toString(page), String.format(cmdFormat, page), "Aller à la page " + page); + FormatableChat pDisp = Chat.clickableCommand(Chat.text(page), String.format(cmdFormat, page), Chat.text("Aller à la page " + page)); if (page == currentPage) { pDisp.highlightedCommandColor(); } @@ -342,10 +416,9 @@ public class ChatUtil { } public static int charW(char c, boolean console, boolean bold) { - if (console) return (c == '§') ? -1 : 1; - for (int px : CHARS_SIZE.keySet()) - if (CHARS_SIZE.get(px).indexOf(c) >= 0) return px + (bold ? 1 : 0); - return 6 + (bold ? 1 : 0); + if (console) + return (c == '§') ? -1 : 1; + return CHAR_SIZES.getOrDefault(c, DEFAULT_CHAR_SIZE); } diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java index cbca1ed..3dad204 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java @@ -21,10 +21,10 @@ import org.bukkit.Bukkit; import fr.pandacube.lib.util.Log; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.reflect.Reflect.ReflectClass; -import fr.pandacube.lib.reflect.Reflect.ReflectField; -import fr.pandacube.lib.reflect.Reflect.ReflectMember; -import fr.pandacube.lib.reflect.Reflect.ReflectMethod; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectField; +import fr.pandacube.lib.reflect.ReflectMember; +import fr.pandacube.lib.reflect.ReflectMethod; import net.fabricmc.mappingio.MappingReader; import net.fabricmc.mappingio.format.MappingFormat; import net.fabricmc.mappingio.tree.MappingTree; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSTypeWrapper.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSTypeWrapper.java index dedf0ae..4148045 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSTypeWrapper.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/NMSTypeWrapper.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import fr.pandacube.lib.reflect.Reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectClass; import fr.pandacube.lib.paper.reflect.NMSReflect.ClassMapping; /* package */ class NMSTypeWrapper implements Comparable { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java index 72bdb07..466c717 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/OBCReflect.java @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect; import org.bukkit.Bukkit; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.reflect.Reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectClass; public class OBCReflect { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java index 1e3ca2a..fde336e 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/ReflectWrapper.java @@ -1,7 +1,8 @@ package fr.pandacube.lib.paper.reflect.wrapper; import com.google.common.collect.MapMaker; -import fr.pandacube.lib.reflect.Reflect; + +import fr.pandacube.lib.reflect.ReflectConstructor; import java.util.List; import java.util.Map; @@ -60,7 +61,7 @@ public abstract class ReflectWrapper implements ReflectWrapperI { if (expectedWrapperClass != null && !expectedWrapperClass.isAssignableFrom(wrapperClass)) { throw new ClassCastException("Wrapper class " + wrapperClass + " is not a sub-class or a sub-interface of expected wrapper class" + expectedWrapperClass); } - Reflect.ReflectConstructor constructor = WrapperRegistry.getWrapperConstructorOfWrapperClass(wrapperClass); + ReflectConstructor constructor = WrapperRegistry.getWrapperConstructorOfWrapperClass(wrapperClass); if (constructor == null) { throw new IllegalStateException("Unable to find a constructor to instanciate " + wrapperClass + " to wrap an instance of " + runtimeObj); } 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 index baa4f3a..9caee21 100644 --- 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 @@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.reflect.wrapper; import fr.pandacube.lib.util.Log; import fr.pandacube.lib.reflect.Reflect; -import fr.pandacube.lib.reflect.Reflect.ReflectConstructor; +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; 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 e464602..691bf9d 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 @@ -2,13 +2,15 @@ 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.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CommandNode extends ReflectWrapperTyped> { - public static final Reflect.ReflectClass REFLECT = Reflect.ofClass(com.mojang.brigadier.tree.CommandNode.class); - private static final Reflect.ReflectMethod removeCommand = wrapEx(() -> REFLECT.method("removeCommand", String.class)); + public static final ReflectClass REFLECT = Reflect.ofClass(com.mojang.brigadier.tree.CommandNode.class); + private static final ReflectMethod removeCommand = wrapEx(() -> REFLECT.method("removeCommand", String.class)); public void removeCommand(String cmd) { wrapReflectEx(() -> removeCommand.invoke(__getRuntimeInstance(), cmd)); 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 aa8e4c9..cfb6b8c 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,9 +1,12 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.MapItemSavedData; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectField; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.entity.Player; import org.bukkit.map.MapView; @@ -11,9 +14,9 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftMapView extends ReflectWrapperTyped { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.CraftMapView")); - public static final Reflect.ReflectField worldMap = wrapEx(() -> REFLECT.field("worldMap")); - public static final Reflect.ReflectMethod render = wrapEx(() -> REFLECT.method("render", CraftPlayer.REFLECT.get())); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.CraftMapView")); + public static final ReflectField worldMap = wrapEx(() -> REFLECT.field("worldMap")); + public static final ReflectMethod render = wrapEx(() -> REFLECT.method("render", CraftPlayer.REFLECT.get())); protected CraftMapView(Object obj) { super(obj); 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 e52c80e..21b3401 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,18 +1,20 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.NamespacedKey; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftNamespacedKey extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftNamespacedKey")); - public static final Reflect.ReflectMethod toMinecraft = wrapEx(() -> REFLECT.method("toMinecraft", NamespacedKey.class)); - public static final Reflect.ReflectMethod fromMinecraft = wrapEx(() -> REFLECT.method("fromMinecraft", ResourceLocation.MAPPING.runtimeClass())); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftNamespacedKey")); + public static final ReflectMethod toMinecraft = wrapEx(() -> REFLECT.method("toMinecraft", NamespacedKey.class)); + public static final ReflectMethod fromMinecraft = wrapEx(() -> REFLECT.method("fromMinecraft", ResourceLocation.MAPPING.runtimeClass())); public static ResourceLocation toMinecraft(NamespacedKey key) { return wrap(wrapReflectEx(() -> toMinecraft.invokeStatic(key)), ResourceLocation.class); 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 c53eb50..3f49ff0 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,17 +1,19 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerPlayer; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.entity.Player; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftPlayer extends ReflectWrapperTyped { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("entity.CraftPlayer")); - public static final Reflect.ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("entity.CraftPlayer")); + public static final ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); public ServerPlayer getHandle() { return wrap(wrapReflectEx(() -> getHandle.invoke(__getRuntimeInstance())), ServerPlayer.class); 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 530ee5e..3fe622d 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,19 +1,21 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedPlayerList; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.DedicatedServer; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.Server; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftServer extends ReflectWrapperTyped { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftServer")); - public static final Reflect.ReflectMethod getServer = wrapEx(() -> REFLECT.method("getServer")); - public static final Reflect.ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftServer")); + public static final ReflectMethod getServer = wrapEx(() -> REFLECT.method("getServer")); + public static final ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); public DedicatedServer getServer() { return wrap(wrapReflectEx(() -> getServer.invoke(__getRuntimeInstance())), DedicatedServer.class); 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 538f0eb..c49825b 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,21 +1,23 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.util.Vector; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftVector extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftVector")); - public static final Reflect.ReflectMethod toBukkit_Vec3 = wrapEx(() -> REFLECT.method("toBukkit", Vec3.MAPPING.runtimeClass())); - public static final Reflect.ReflectMethod toBukkit_BlockPos = wrapEx(() -> REFLECT.method("toBukkit", BlockPos.MAPPING.runtimeClass())); - public static final Reflect.ReflectMethod toNMS = wrapEx(() -> REFLECT.method("toNMS", Vector.class)); - public static final Reflect.ReflectMethod toBlockPos = wrapEx(() -> REFLECT.method("toNMS", Vector.class)); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftVector")); + public static final ReflectMethod toBukkit_Vec3 = wrapEx(() -> REFLECT.method("toBukkit", Vec3.MAPPING.runtimeClass())); + public static final ReflectMethod toBukkit_BlockPos = wrapEx(() -> REFLECT.method("toBukkit", BlockPos.MAPPING.runtimeClass())); + public static final ReflectMethod toNMS = wrapEx(() -> REFLECT.method("toNMS", Vector.class)); + public static final ReflectMethod toBlockPos = wrapEx(() -> REFLECT.method("toNMS", Vector.class)); public static Vector toBukkit(Vec3 nms) { return (Vector) wrapReflectEx(() -> toBukkit_Vec3.invokeStatic(unwrap(nms))); 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 ea55ff1..8f3c200 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,17 +1,19 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.server.ServerLevel; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.World; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class CraftWorld extends ReflectWrapperTyped { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftWorld")); - public static final Reflect.ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("CraftWorld")); + public static final ReflectMethod getHandle = wrapEx(() -> REFLECT.method("getHandle")); public ServerLevel getHandle() { return wrap(wrapReflectEx(() -> getHandle.invoke(__getRuntimeInstance())), ServerLevel.class); 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 8b3f2a8..2d3d202 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,15 +1,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class RenderData extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.RenderData")); - private static final Reflect.ReflectField buffer = wrapEx(() -> REFLECT.field("buffer")); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("map.RenderData")); + private static final ReflectField buffer = wrapEx(() -> REFLECT.field("buffer")); protected RenderData(Object obj) { super(obj); 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 0c1ed55..48ba41c 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 @@ -2,10 +2,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.craftbukkit; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.tree.CommandNode; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.OBCReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectConstructor; +import fr.pandacube.lib.reflect.ReflectField; +import fr.pandacube.lib.reflect.ReflectMethod; + import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; @@ -13,10 +18,10 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class VanillaCommandWrapper extends ReflectWrapperTyped { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("command.VanillaCommandWrapper")); - public static final Reflect.ReflectConstructor CONSTRUTOR = wrapEx(() -> REFLECT.constructor(Commands.MAPPING.runtimeClass(), CommandNode.class)); - public static final Reflect.ReflectField vanillaCommand = wrapEx(() -> REFLECT.field("vanillaCommand")); - public static final Reflect.ReflectMethod getListener = wrapEx(() -> REFLECT.method("getListener", CommandSender.class)); + public static final ReflectClass REFLECT = wrapEx(() -> OBCReflect.ofClass("command.VanillaCommandWrapper")); + public static final ReflectConstructor CONSTRUTOR = wrapEx(() -> REFLECT.constructor(Commands.MAPPING.runtimeClass(), CommandNode.class)); + public static final ReflectField vanillaCommand = wrapEx(() -> REFLECT.field("vanillaCommand")); + public static final ReflectMethod getListener = wrapEx(() -> REFLECT.method("getListener", CommandSender.class)); public VanillaCommandWrapper(Commands dispatcher, CommandNode vanillaCommand) { this(wrapReflectEx(() -> CONSTRUTOR.instanciate(unwrap(dispatcher), vanillaCommand))); 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 3ae5572..8247b1e 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,16 +1,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class SharedConstants extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.SharedConstants")); - private static final Reflect.ReflectMethod getCurrentVersion = wrapEx(() -> MAPPING.mojMethod("getCurrentVersion")); - private static final Reflect.ReflectMethod getProtocolVersion = wrapEx(() -> MAPPING.mojMethod("getProtocolVersion")); + private static final ReflectMethod getCurrentVersion = wrapEx(() -> MAPPING.mojMethod("getCurrentVersion")); + private static final ReflectMethod getProtocolVersion = wrapEx(() -> MAPPING.mojMethod("getProtocolVersion")); 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 636c1f0..dde0c24 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 @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class BlockPosArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.BlockPosArgument")); - private static final Reflect.ReflectMethod blockPos = wrapEx(() -> MAPPING.mojMethod("blockPos")); + private static final ReflectMethod blockPos = wrapEx(() -> MAPPING.mojMethod("blockPos")); @SuppressWarnings("unchecked") public static ArgumentType blockPos() { 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 118a49b..601f16f 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 @@ -2,16 +2,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; import com.mojang.brigadier.CommandDispatcher; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Commands extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.Commands")); - public static final Reflect.ReflectField dispatcher = wrapEx(() -> MAPPING.mojField("dispatcher")); + public static final ReflectField dispatcher = wrapEx(() -> MAPPING.mojField("dispatcher")); @SuppressWarnings("unchecked") public CommandDispatcher dispatcher() { 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 0bb9431..fc45008 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 @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ComponentArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.ComponentArgument")); - private static final Reflect.ReflectMethod textComponent = wrapEx(() -> MAPPING.mojMethod("textComponent")); + private static final ReflectMethod textComponent = wrapEx(() -> MAPPING.mojMethod("textComponent")); @SuppressWarnings("unchecked") public static ArgumentType textComponent() { 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 edc68c6..9abf32d 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 @@ -1,13 +1,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ConcreteWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperI; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.core.BlockPos; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; @@ -16,8 +17,8 @@ import static fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper.wrap; @ConcreteWrapper(Coordinates.__concrete.class) public interface Coordinates extends ReflectWrapperI { NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.Coordinates")); - Reflect.ReflectMethod getPosition = wrapEx(() -> MAPPING.mojMethod("getPosition", CommandSourceStack.MAPPING)); - Reflect.ReflectMethod getBlockPos = wrapEx(() -> MAPPING.mojMethod("getBlockPos", CommandSourceStack.MAPPING)); + ReflectMethod getPosition = wrapEx(() -> MAPPING.mojMethod("getPosition", CommandSourceStack.MAPPING)); + ReflectMethod getBlockPos = wrapEx(() -> MAPPING.mojMethod("getBlockPos", CommandSourceStack.MAPPING)); default Vec3 getPosition(BukkitBrigadierCommandSource source) { return wrap(wrapReflectEx(() -> getPosition.invoke(__getRuntimeInstance(), source)), Vec3.class); 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 4fb72b2..f305fd6 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 @@ -1,19 +1,20 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class EntityArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.EntityArgument")); - private static final Reflect.ReflectMethod entity = wrapEx(() -> MAPPING.mojMethod("entity")); - private static final Reflect.ReflectMethod entities = wrapEx(() -> MAPPING.mojMethod("entities")); - private static final Reflect.ReflectMethod player = wrapEx(() -> MAPPING.mojMethod("player")); - private static final Reflect.ReflectMethod players = wrapEx(() -> MAPPING.mojMethod("players")); + private static final ReflectMethod entity = wrapEx(() -> MAPPING.mojMethod("entity")); + private static final ReflectMethod entities = wrapEx(() -> MAPPING.mojMethod("entities")); + private static final ReflectMethod player = wrapEx(() -> MAPPING.mojMethod("player")); + private static final ReflectMethod players = wrapEx(() -> MAPPING.mojMethod("players")); @SuppressWarnings("unchecked") public static ArgumentType entity() { 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 6eac39b..4086f2f 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 @@ -1,12 +1,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectListWrapper; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; 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; import java.util.List; @@ -15,10 +16,10 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class EntitySelector extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.selector.EntitySelector")); - private static final Reflect.ReflectMethod findEntities = wrapEx(() -> MAPPING.mojMethod("findEntities", CommandSourceStack.MAPPING)); - private static final Reflect.ReflectMethod findPlayers = wrapEx(() -> MAPPING.mojMethod("findPlayers", CommandSourceStack.MAPPING)); - private static final Reflect.ReflectMethod findSingleEntity = wrapEx(() -> MAPPING.mojMethod("findSingleEntity", CommandSourceStack.MAPPING)); - private static final Reflect.ReflectMethod findSinglePlayer = wrapEx(() -> MAPPING.mojMethod("findSinglePlayer", CommandSourceStack.MAPPING)); + private static final ReflectMethod findEntities = wrapEx(() -> MAPPING.mojMethod("findEntities", CommandSourceStack.MAPPING)); + private static final ReflectMethod findPlayers = wrapEx(() -> MAPPING.mojMethod("findPlayers", CommandSourceStack.MAPPING)); + private static final ReflectMethod findSingleEntity = wrapEx(() -> MAPPING.mojMethod("findSingleEntity", CommandSourceStack.MAPPING)); + private static final ReflectMethod findSinglePlayer = wrapEx(() -> MAPPING.mojMethod("findSinglePlayer", CommandSourceStack.MAPPING)); @SuppressWarnings("unchecked") public ReflectListWrapper findEntities(BukkitBrigadierCommandSource source) { 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 2e1f57e..794bfa5 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 @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class GameProfileArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.GameProfileArgument")); - private static final Reflect.ReflectMethod gameProfile = wrapEx(() -> MAPPING.mojMethod("gameProfile")); + private static final ReflectMethod gameProfile = wrapEx(() -> MAPPING.mojMethod("gameProfile")); @SuppressWarnings("unchecked") public static ArgumentType gameProfile() { 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 b0d8e33..88a19a8 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 @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ResourceLocationArgument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.ResourceLocationArgument")); - private static final Reflect.ReflectMethod id = wrapEx(() -> MAPPING.mojMethod("id")); + private static final ReflectMethod id = wrapEx(() -> MAPPING.mojMethod("id")); @SuppressWarnings("unchecked") public static ArgumentType id() { 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 ace2b67..2e8db12 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 @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands; import com.mojang.brigadier.arguments.ArgumentType; -import fr.pandacube.lib.reflect.Reflect; + import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapperTyped; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Vec3Argument extends ReflectWrapperTyped> { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.Vec3Argument")); - private static final Reflect.ReflectMethod vec3 = wrapEx(() -> MAPPING.mojMethod("vec3", boolean.class)); + private static final ReflectMethod vec3 = wrapEx(() -> MAPPING.mojMethod("vec3", boolean.class)); @SuppressWarnings("unchecked") public static ArgumentType vec3(boolean centerIntegers) { 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 537dc63..671e6b9 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,17 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.core; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Vec3i extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.core.Vec3i")); - public static final Reflect.ReflectMethod getX = wrapEx(() -> MAPPING.mojMethod("getX")); - public static final Reflect.ReflectMethod getY = wrapEx(() -> MAPPING.mojMethod("getY")); - public static final Reflect.ReflectMethod getZ = wrapEx(() -> MAPPING.mojMethod("getZ")); + public static final ReflectMethod getX = wrapEx(() -> MAPPING.mojMethod("getX")); + public static final ReflectMethod getY = wrapEx(() -> MAPPING.mojMethod("getY")); + public static final ReflectMethod getZ = wrapEx(() -> MAPPING.mojMethod("getZ")); public int getX() { return (int) wrapReflectEx(() -> getX.invoke(__getRuntimeInstance())); 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 f63a6c8..6b999c9 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 @@ -8,7 +8,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import fr.pandacube.lib.reflect.Reflect.ReflectMethod; +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; 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 5f5318b..48a3b9c 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 @@ -4,7 +4,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import java.io.File; -import fr.pandacube.lib.reflect.Reflect.ReflectMethod; +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; 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 46be7dd..aa997b0 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 @@ -3,7 +3,7 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; -import fr.pandacube.lib.reflect.Reflect.ReflectMethod; +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; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java index 3fb3036..251d775 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/network/FriendlyByteBuf.java @@ -1,16 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf; +import fr.pandacube.lib.reflect.ReflectConstructor; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class FriendlyByteBuf extends ByteBuf { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.FriendlyByteBuf")); - private static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(ByteBuf.REFLECT.get())); - private static final Reflect.ReflectMethod writeUtf = wrapEx(() -> MAPPING.mojMethod("writeUtf", String.class)); + private static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(ByteBuf.REFLECT.get())); + private static final ReflectMethod writeUtf = wrapEx(() -> MAPPING.mojMethod("writeUtf", String.class)); public FriendlyByteBuf(ByteBuf parent) { this(wrapReflectEx(() -> CONSTRUCTOR.instanciate(unwrap(parent)))); 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 bc55169..03c4cdb 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,18 +1,19 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.FriendlyByteBuf; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocation; +import fr.pandacube.lib.reflect.ReflectConstructor; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ClientboundCustomPayloadPacket extends ReflectWrapper implements Packet { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket")); - private static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(ResourceLocation.MAPPING.runtimeClass(), FriendlyByteBuf.MAPPING.runtimeClass())); - private static final Reflect.ReflectField FIELD_BRAND = wrapEx(() -> MAPPING.mojField("BRAND")); + private static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(ResourceLocation.MAPPING.runtimeClass(), FriendlyByteBuf.MAPPING.runtimeClass())); + private static final ReflectField FIELD_BRAND = wrapEx(() -> MAPPING.mojField("BRAND")); public static ResourceLocation BRAND() { return wrap(wrapReflectEx(FIELD_BRAND::getStaticValue), ResourceLocation.class); 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 618485f..38c63f3 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,17 +1,18 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectConstructor; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ClientboundGameEventPacket extends ReflectWrapper implements Packet { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.network.protocol.game.ClientboundGameEventPacket")); - private static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(Type.MAPPING.runtimeClass(), float.class)); - private static final Reflect.ReflectField FIELD_RAIN_LEVEL_CHANGE = wrapEx(() -> MAPPING.mojField("RAIN_LEVEL_CHANGE")); - private static final Reflect.ReflectField FIELD_THUNDER_LEVEL_CHANGE = wrapEx(() -> MAPPING.mojField("THUNDER_LEVEL_CHANGE")); + private static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(Type.MAPPING.runtimeClass(), float.class)); + private static final ReflectField FIELD_RAIN_LEVEL_CHANGE = wrapEx(() -> MAPPING.mojField("RAIN_LEVEL_CHANGE")); + private static final ReflectField FIELD_THUNDER_LEVEL_CHANGE = wrapEx(() -> MAPPING.mojField("THUNDER_LEVEL_CHANGE")); public static Type RAIN_LEVEL_CHANGE() { return wrap(wrapReflectEx(FIELD_RAIN_LEVEL_CHANGE::getStaticValue), Type.class); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java index 895c551..7ebbbfc 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ChunkMap.java @@ -1,9 +1,10 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkStorage; import fr.pandacube.lib.paper.reflect.wrapper.paper.QueuedChangesMapLong2Object; +import fr.pandacube.lib.reflect.ReflectField; + import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; @@ -13,11 +14,11 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkMap extends ChunkStorage { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ChunkMap")); - private static final Reflect.ReflectField FIELD_autoSaveQueue = wrapEx(() -> MAPPING.runtimeReflect().field("autoSaveQueue")); // spigot/paper field - public static final Reflect.ReflectField FIELD_level = wrapEx(() -> MAPPING.mojField("level")); - public static final Reflect.ReflectField FIELD_pendingUnloads = wrapEx(() -> MAPPING.mojField("pendingUnloads")); - public static final Reflect.ReflectField FIELD_toDrop = wrapEx(() -> MAPPING.mojField("toDrop")); - public static final Reflect.ReflectField FIELD_updatingChunks = wrapEx(() -> MAPPING.runtimeReflect().field("updatingChunks")); // spigot/paper field + private static final ReflectField FIELD_autoSaveQueue = wrapEx(() -> MAPPING.runtimeReflect().field("autoSaveQueue")); // spigot/paper field + public static final ReflectField FIELD_level = wrapEx(() -> MAPPING.mojField("level")); + public static final ReflectField FIELD_pendingUnloads = wrapEx(() -> MAPPING.mojField("pendingUnloads")); + public static final ReflectField FIELD_toDrop = wrapEx(() -> MAPPING.mojField("toDrop")); + public static final ReflectField FIELD_updatingChunks = wrapEx(() -> MAPPING.runtimeReflect().field("updatingChunks")); // spigot/paper field /** This field in unmapped */ public final ObjectRBTreeSet autoSaveQueue; diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java index 4d8fe6f..0b62b0a 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/DedicatedServer.java @@ -1,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class DedicatedServer extends MinecraftServer { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.DedicatedServer")); - private static final Reflect.ReflectMethod getLevelIdName = wrapEx(() -> MAPPING.mojMethod("getLevelIdName")); - private static final Reflect.ReflectMethod getProperties = wrapEx(() -> MAPPING.mojMethod("getProperties")); + private static final ReflectMethod getLevelIdName = wrapEx(() -> MAPPING.mojMethod("getLevelIdName")); + private static final ReflectMethod getProperties = wrapEx(() -> MAPPING.mojMethod("getProperties")); public String getLevelIdName() { return (String) wrapReflectEx(() -> getLevelIdName.invoke(__getRuntimeInstance())); 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 a3bcd43..8223baf 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,16 +1,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.commands.Commands; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class MinecraftServer extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.MinecraftServer")); - private static final Reflect.ReflectField vanillaCommandDispatcher = wrapEx(() -> MAPPING.runtimeReflect().field("vanillaCommandDispatcher")); + private static final ReflectField vanillaCommandDispatcher = wrapEx(() -> MAPPING.runtimeReflect().field("vanillaCommandDispatcher")); public Commands vanillaCommandDispatcher() { return wrap(wrapReflectEx(() -> vanillaCommandDispatcher.getValue(__getRuntimeInstance())), Commands.class); 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 f6b8fb7..bef99cc 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerChunkCache extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerChunkCache")); - private static final Reflect.ReflectField FIELD_chunkMap = wrapEx(() -> MAPPING.mojField("chunkMap")); + private static final ReflectField FIELD_chunkMap = wrapEx(() -> MAPPING.mojField("chunkMap")); public final ChunkMap chunkMap; 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 56575d0..a24e3eb 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,16 +1,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.network.protocol.Packet; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerGamePacketListenerImpl extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.network.ServerGamePacketListenerImpl")); - public static final Reflect.ReflectMethod send = wrapEx(() -> MAPPING.mojMethod("send", Packet.MAPPING)); + public static final ReflectMethod send = wrapEx(() -> MAPPING.mojMethod("send", Packet.MAPPING)); public void send(Packet packet) { wrapReflectEx(() -> send.invoke(__getRuntimeInstance(), unwrap(packet))); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java index 18fe6bf..7035313 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerLevel.java @@ -1,17 +1,17 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.util.ProgressListener; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Level; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerLevel extends Level { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerLevel")); - public static final Reflect.ReflectMethod save = wrapEx(() -> MAPPING.mojMethod("save", ProgressListener.MAPPING, boolean.class, boolean.class)); - public static final Reflect.ReflectMethod getChunkSource = wrapEx(() -> MAPPING.mojMethod("getChunkSource")); + public static final ReflectMethod save = wrapEx(() -> MAPPING.mojMethod("save", ProgressListener.MAPPING, boolean.class, boolean.class)); + public static final ReflectMethod getChunkSource = wrapEx(() -> MAPPING.mojMethod("getChunkSource")); public ServerChunkCache getChunkSource() { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java index bea8b04..d5da469 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/server/ServerPlayer.java @@ -2,20 +2,21 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; import org.bukkit.entity.Player; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.DamageSource; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Entity; +import fr.pandacube.lib.reflect.ReflectField; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ServerPlayer extends Entity { // in NMS, ServerPlayer is not a direct subclass of Entity public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.level.ServerPlayer")); - public static final Reflect.ReflectField connection = wrapEx(() -> MAPPING.mojField("connection")); - public static final Reflect.ReflectMethod hurt = wrapEx(() -> MAPPING.mojMethod("hurt", DamageSource.MAPPING, float.class)); - public static final Reflect.ReflectMethod isTextFilteringEnabled = wrapEx(() -> MAPPING.mojMethod("isTextFilteringEnabled")); - public static final Reflect.ReflectMethod allowsListing = wrapEx(() -> MAPPING.mojMethod("allowsListing")); + public static final ReflectField connection = wrapEx(() -> MAPPING.mojField("connection")); + public static final ReflectMethod hurt = wrapEx(() -> MAPPING.mojMethod("hurt", DamageSource.MAPPING, float.class)); + public static final ReflectMethod isTextFilteringEnabled = wrapEx(() -> MAPPING.mojMethod("isTextFilteringEnabled")); + public static final ReflectMethod allowsListing = wrapEx(() -> MAPPING.mojMethod("allowsListing")); public boolean hurt(DamageSource source, float amount) { return (boolean) wrapReflectEx(() -> hurt.invoke(__getRuntimeInstance(), unwrap(source), amount)); 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 f27854c..b7968bb 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,8 +1,8 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectField; import java.util.Properties; @@ -11,7 +11,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Settings extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.server.dedicated.Settings")); - public static final Reflect.ReflectField properties = wrapEx(() -> MAPPING.mojField("properties")); + public static final ReflectField properties = wrapEx(() -> MAPPING.mojField("properties")); public Properties properties() { return (Properties) wrapReflectEx(() -> properties.getValue(__getRuntimeInstance())); 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 557d18b..3d1fffc 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectConstructor; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class AABB extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.phys.AABB")); - private static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(double.class, double.class, double.class, double.class, double.class, double.class)); + private static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(double.class, double.class, double.class, double.class, double.class, double.class)); public AABB(double x1, double y1, double z1, double x2, double y2, double z2) { this(wrapReflectEx(() -> CONSTRUCTOR.instanciate(x1, y1, z1, x2, y2, z2))); 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 7d3541e..22eb67b 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectConstructor; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkPos extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.ChunkPos")); - public static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(int.class, int.class)); + public static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor(int.class, int.class)); public ChunkPos(int x, int z) { this(wrapReflectEx(() -> CONSTRUCTOR.instanciate(x, z))); 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 b3db311..b71fd21 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,9 +1,9 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; +import fr.pandacube.lib.reflect.ReflectMethod; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -13,7 +13,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class ChunkStorage extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.chunk.storage.ChunkStorage")); - private static final Reflect.ReflectMethod readSync = wrapEx(() -> MAPPING.runtimeReflect().method("readSync", ChunkPos.MAPPING.runtimeReflect().get())); // spigot/paper method + private static final ReflectMethod readSync = wrapEx(() -> MAPPING.runtimeReflect().method("readSync", ChunkPos.MAPPING.runtimeReflect().get())); // spigot/paper method public CompoundTag readSync(ChunkPos pos) { return wrap(wrapReflectEx(() -> readSync.invoke(__getRuntimeInstance(), unwrap(pos))), CompoundTag.class); 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 9acbefd..9b99b16 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class DamageSource extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.damagesource.DamageSource")); - private static final Reflect.ReflectField FIELD_OUT_OF_WORLD = wrapEx(() -> MAPPING.mojField("OUT_OF_WORLD")); + private static final ReflectField FIELD_OUT_OF_WORLD = wrapEx(() -> MAPPING.mojField("OUT_OF_WORLD")); public static DamageSource OUT_OF_WORLD() { return wrap(wrapReflectEx(FIELD_OUT_OF_WORLD::getStaticValue), DamageSource.class); 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 239bde4..a2e76c1 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Entity extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.entity.Entity")); - public static final Reflect.ReflectMethod getBukkitEntity = wrapEx(() -> MAPPING.runtimeReflect().method("getBukkitEntity")); // spigot field + public static final ReflectMethod getBukkitEntity = wrapEx(() -> MAPPING.runtimeReflect().method("getBukkitEntity")); // spigot field public org.bukkit.entity.Entity getBukkitEntity() { return (org.bukkit.entity.Entity) wrapReflectEx(() -> getBukkitEntity.invoke(__getRuntimeInstance())); 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 a533f64..4ec78f4 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,18 +1,18 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.paper.configuration.WorldConfiguration; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Level extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.Level")); - public static final Reflect.ReflectMethod getGameTime = wrapEx(() -> MAPPING.mojMethod("getGameTime")); - public static final Reflect.ReflectMethod getFreeMapId = wrapEx(() -> MAPPING.mojMethod("getFreeMapId")); - public static final Reflect.ReflectMethod paperConfig = wrapEx(() -> MAPPING.runtimeReflect().method("paperConfig")); // paper method + public static final ReflectMethod getGameTime = wrapEx(() -> MAPPING.mojMethod("getGameTime")); + public static final ReflectMethod getFreeMapId = wrapEx(() -> MAPPING.mojMethod("getFreeMapId")); + public static final ReflectMethod paperConfig = wrapEx(() -> MAPPING.runtimeReflect().method("paperConfig")); // paper method public long getGameTime() { return (long) wrapReflectEx(() -> getGameTime.invoke(__getRuntimeInstance())); diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java index 8357b3b..1d91590 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/world/MapItemSavedData.java @@ -1,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class MapItemSavedData extends SavedData { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.saveddata.maps.MapItemSavedData")); - public static final Reflect.ReflectField colors = wrapEx(() -> MAPPING.mojField("colors")); - public static final Reflect.ReflectField locked = wrapEx(() -> MAPPING.mojField("locked")); + public static final ReflectField colors = wrapEx(() -> MAPPING.mojField("colors")); + public static final ReflectField locked = wrapEx(() -> MAPPING.mojField("locked")); protected MapItemSavedData(Object obj) { super(obj); 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 12ae25f..a91b9eb 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,15 +1,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class SavedData extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.saveddata.SavedData")); - private static final Reflect.ReflectMethod setDirty = wrapEx(() -> MAPPING.mojMethod("setDirty")); + private static final ReflectMethod setDirty = wrapEx(() -> MAPPING.mojMethod("setDirty")); protected SavedData(Object obj) { super(obj); 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 ed16539..4988d56 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,16 +1,16 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block; -import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.NMSReflect; import fr.pandacube.lib.paper.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class BambooBlock extends ReflectWrapper { public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.block.BambooBlock")); - public static final Reflect.ReflectField COLLISION_SHAPE = wrapEx(() -> MAPPING.mojField("COLLISION_SHAPE")); + public static final ReflectField COLLISION_SHAPE = wrapEx(() -> MAPPING.mojField("COLLISION_SHAPE")); public static VoxelShape COLLISION_SHAPE() { return wrap(wrapReflectEx(COLLISION_SHAPE::getStaticValue), VoxelShape.class); 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 aac09dd..e407ff6 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 @@ -2,11 +2,12 @@ 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.ReflectClass; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public class ByteBuf extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.ByteBuf")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.ByteBuf")); protected ByteBuf(Object obj) { super(obj); 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 f5d4fd9..02d3490 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 @@ -2,13 +2,15 @@ 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.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class Unpooled extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.Unpooled")); - private static final Reflect.ReflectMethod buffer = wrapEx(() -> REFLECT.method("buffer")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.netty.buffer.Unpooled")); + private static final ReflectMethod buffer = wrapEx(() -> REFLECT.method("buffer")); public static ByteBuf buffer() { diff --git a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java index b6793b6..8d235db 100644 --- a/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java +++ b/pandalib-paper-reflect/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/paper/AABBVoxelShape.java @@ -3,13 +3,15 @@ package fr.pandacube.lib.paper.reflect.wrapper.paper; import fr.pandacube.lib.reflect.Reflect; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectConstructor; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class AABBVoxelShape extends VoxelShape { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.voxel.AABBVoxelShape")); - private static final Reflect.ReflectConstructor CONSTRUCTOR = wrapEx(() -> REFLECT.constructor(AABB.MAPPING.runtimeClass())); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.voxel.AABBVoxelShape")); + private static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> REFLECT.constructor(AABB.MAPPING.runtimeClass())); public AABBVoxelShape(AABB aabb) { this(wrapReflectEx(() -> CONSTRUCTOR.instanciate(unwrap(aabb)))); 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 1ff5e53..3cad172 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 @@ -3,13 +3,15 @@ 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.paper.reflect.wrapper.minecraft.network.chat.Component; +import fr.pandacube.lib.reflect.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class PaperAdventure extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.adventure.PaperAdventure")); - private static final Reflect.ReflectMethod asAdventure = wrapEx(() -> REFLECT.method("asAdventure", Component.MAPPING.runtimeClass())); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.adventure.PaperAdventure")); + private static final ReflectMethod asAdventure = wrapEx(() -> REFLECT.method("asAdventure", Component.MAPPING.runtimeClass())); public static net.kyori.adventure.text.Component asAdventure(Component component) { return (net.kyori.adventure.text.Component) wrapReflectEx(() -> asAdventure.invokeStatic(unwrap(component))); 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 31c411c..0f9bcf7 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 @@ -2,14 +2,17 @@ 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.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; + import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class QueuedChangesMapLong2Object extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object")); - public static final Reflect.ReflectMethod getVisibleMap = wrapEx(() -> REFLECT.method("getVisibleMap")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object")); + public static final ReflectMethod getVisibleMap = wrapEx(() -> REFLECT.method("getVisibleMap")); /** The entries in the returned value are not mapped */ public Long2ObjectLinkedOpenHashMap getVisibleMap() { 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 f29826c..97177ee 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 @@ -2,13 +2,15 @@ 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.ReflectClass; +import fr.pandacube.lib.reflect.ReflectMethod; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class FallbackValue_Int extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.type.fallback.FallbackValue$Int")); - public static final Reflect.ReflectMethod value = wrapEx(() -> REFLECT.method("value")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.type.fallback.FallbackValue$Int")); + public static final ReflectMethod value = wrapEx(() -> REFLECT.method("value")); public int value() { return (int) wrapReflectEx(() -> value.invoke(__getRuntimeInstance())); 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 ac5ee9f..c588971 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 @@ -2,13 +2,15 @@ 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.ReflectClass; +import fr.pandacube.lib.reflect.ReflectField; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; public class WorldConfiguration extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.WorldConfiguration")); - public static final Reflect.ReflectField chunks = wrapEx(() -> REFLECT.field("chunks")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.WorldConfiguration")); + public static final ReflectField chunks = wrapEx(() -> REFLECT.field("chunks")); public Chunks chunks() { return wrap(wrapReflectEx(() -> chunks.getValue(__getRuntimeInstance())), Chunks.class); @@ -19,8 +21,8 @@ public class WorldConfiguration extends ReflectWrapper { } public static class Chunks extends ReflectWrapper { - public static final Reflect.ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.WorldConfiguration$Chunks")); - public static final Reflect.ReflectField autoSavePeriod = wrapEx(() -> REFLECT.field("autoSaveInterval")); + public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("io.papermc.paper.configuration.WorldConfiguration$Chunks")); + public static final ReflectField autoSavePeriod = wrapEx(() -> REFLECT.field("autoSaveInterval")); public FallbackValue_Int autoSavePeriod() { return wrap(wrapReflectEx(() -> autoSavePeriod.getValue(__getRuntimeInstance())), FallbackValue_Int.class);