[API] ReflectionHelper 1.18.4-SNAPSHOT

Library to easily access Classes, Fields & Methods using reflection

  1. inventivetalent
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    • 1.17
    Source Code:
    This API allows you to access Classes, Fields & Methods using reflection.

    But unlike the default reflection methods, you can specify multiple names and the API will resolve those to the class/field/method which actually exists.
    This is especially useful if your plugin uses net.minecraft.server classes and you want to make it compatible to multiple versions. (e.g. 1.8 & 1.9)

    It also provides useful minecraft-related methods, for example a DataWatcher class to modify DataWatcher both for 1.9 & 1.8(/1.7)

    Code (Java):

    //Let's say we want to access the NMS ChatSerializer class
    //in versions prior to 1_8_R2 it's located at net.minecraft.server.ChatSerializer, in later versions it was moved to net.minecraft.server.IChatBaseComponent$ChatSerializer
    //but instead of checking the version, you can just specify every possible class name

    // (The NMSClassResolver automatically appends the net.minecraft.server prefix)
    // (resolveSilent ignores any thrown exceptions)
    Class<?> chatSerializer = new NMSClassResolver().resolveSilent("ChatSerializer", "IChatBaseComponent$ChatSerializer");

    //The Title-Packet & the Title action-enum would also require a lot of code to support multiple versions
    //from some of the spigot protocol-hack versions, to the latest 1.8 version they were located in 6 different classes,
    //now we can just specify the possibilities without checking for any versions

    //We need to use the default resolver, since we might access non NMS classes
    ClassResolver resolver = new ClassResolver();
    Class<?> packetTitle = resolver.resolveSilent(
            "net.minecraft.server." + Minecraft.getVersion()/*Returns the NMS version*/ + "PacketPlayOutTitle"/* > 1.8 */,
    Class<?> packetAction = resolver.resolveSilent(
            "net.minecraft.server." + Minecraft.getVersion() + "PacketPlayOutTitle$EnumTitleAction"/* > 1.8 R3 */,
            "net.minecraft.server." + Minecraft.getVersion() + "EnumTitleAction"/* < 1.8 R3 */,
            "org.spigotmc.ProtocolInjector$PacketTitle$Action"/* protocol-hack*/);
    Check out the Javadocs for more details about


    Code (spiget-meta (Unknown Language)):


Recent Updates

  1. 1.17 support
  2. Java 16 Compatibility
  3. fixes

Recent Reviews

  1. Alter-Ego
    Version: 1.14.0-SNAPSHOT
    I'm sure this is handy but it, needs a tutorial on how to apply the API please I'm new to applying API's, usually I only apply plugins like 'packetlisternerapi' etc. So confused as to how to apply this. If a tutorial is made will give 5 star rating
  2. FakeSaint
    Version: 1.14.0-SNAPSHOT
    This is incredibly well done... not only that its fully documented! Cleans up code quite a bit. Awesome job, screw that guy who gave 2 stars because he doesn't even understand this is a Library not a plugin lol :)
  3. d2231
    Version: 1.13.0-SNAPSHOT
    I need help looking for the plugins this plugin requires. I don't know what plugins are needed. Can someone plz help me?
  4. aWolfWizard
    Version: 1.11.0-SNAPSHOT
    Absolutely amazing resource, makes things so much clearer to read and understand and has made my life so much easier. Thank you ever so much. You have my eternal gratitude.
  5. Acquized
    Version: 1.6.0
    I don't really rate much on Spigot, but this Library definitely deserves 5 Stars. It is easy to use and makes the complete NMS Code more clear to see. Also the fact that we are allowed to compile it directly into our project makes it even better! Thanks for this great Resource.
    Version: 1.2.3
    Nice Pluigns ^_^
    and Your plugins is Good realy! -