Class SpigotReflectionUtil

java.lang.Object
io.github.retrooper.packetevents.util.SpigotReflectionUtil

public final class SpigotReflectionUtil extends Object
  • Field Details

    • LEGACY_NMS_PACKAGE

      public static final String LEGACY_NMS_PACKAGE
    • OBC_PACKAGE

      public static final String OBC_PACKAGE
    • VERSION

      public static com.github.retrooper.packetevents.manager.server.ServerVersion VERSION
    • V_1_19_OR_HIGHER

      public static boolean V_1_19_OR_HIGHER
    • V_1_17_OR_HIGHER

      public static boolean V_1_17_OR_HIGHER
    • V_1_12_OR_HIGHER

      public static boolean V_1_12_OR_HIGHER
    • MINECRAFT_SERVER_CLASS

      public static Class<?> MINECRAFT_SERVER_CLASS
    • NMS_PACKET_DATA_SERIALIZER_CLASS

      public static Class<?> NMS_PACKET_DATA_SERIALIZER_CLASS
    • NMS_ITEM_STACK_CLASS

      public static Class<?> NMS_ITEM_STACK_CLASS
    • NMS_IMATERIAL_CLASS

      public static Class<?> NMS_IMATERIAL_CLASS
    • NMS_ENTITY_CLASS

      public static Class<?> NMS_ENTITY_CLASS
    • ENTITY_PLAYER_CLASS

      public static Class<?> ENTITY_PLAYER_CLASS
    • BOUNDING_BOX_CLASS

      public static Class<?> BOUNDING_BOX_CLASS
    • NMS_MINECRAFT_KEY_CLASS

      public static Class<?> NMS_MINECRAFT_KEY_CLASS
    • ENTITY_HUMAN_CLASS

      public static Class<?> ENTITY_HUMAN_CLASS
    • PLAYER_CONNECTION_CLASS

      public static Class<?> PLAYER_CONNECTION_CLASS
    • SERVER_COMMON_PACKETLISTENER_IMPL_CLASS

      public static Class<?> SERVER_COMMON_PACKETLISTENER_IMPL_CLASS
    • SERVER_CONNECTION_CLASS

      public static Class<?> SERVER_CONNECTION_CLASS
    • NETWORK_MANAGER_CLASS

      public static Class<?> NETWORK_MANAGER_CLASS
    • NMS_ENUM_PARTICLE_CLASS

      public static Class<?> NMS_ENUM_PARTICLE_CLASS
    • MOB_EFFECT_LIST_CLASS

      public static Class<?> MOB_EFFECT_LIST_CLASS
    • NMS_ITEM_CLASS

      public static Class<?> NMS_ITEM_CLASS
    • DEDICATED_SERVER_CLASS

      public static Class<?> DEDICATED_SERVER_CLASS
    • LEVEL_CLASS

      public static Class<?> LEVEL_CLASS
    • SERVER_LEVEL_CLASS

      public static Class<?> SERVER_LEVEL_CLASS
    • ENUM_PROTOCOL_DIRECTION_CLASS

      public static Class<?> ENUM_PROTOCOL_DIRECTION_CLASS
    • GAME_PROFILE_CLASS

      public static Class<?> GAME_PROFILE_CLASS
    • CRAFT_WORLD_CLASS

      public static Class<?> CRAFT_WORLD_CLASS
    • CRAFT_SERVER_CLASS

      public static Class<?> CRAFT_SERVER_CLASS
    • CRAFT_PLAYER_CLASS

      public static Class<?> CRAFT_PLAYER_CLASS
    • CRAFT_ENTITY_CLASS

      public static Class<?> CRAFT_ENTITY_CLASS
    • CRAFT_ITEM_STACK_CLASS

      public static Class<?> CRAFT_ITEM_STACK_CLASS
    • CRAFT_PARTICLE_CLASS

      public static Class<?> CRAFT_PARTICLE_CLASS
    • LEVEL_ENTITY_GETTER_CLASS

      public static Class<?> LEVEL_ENTITY_GETTER_CLASS
    • PERSISTENT_ENTITY_SECTION_MANAGER_CLASS

      public static Class<?> PERSISTENT_ENTITY_SECTION_MANAGER_CLASS
    • PAPER_ENTITY_LOOKUP_CLASS

      public static Class<?> PAPER_ENTITY_LOOKUP_CLASS
    • CRAFT_MAGIC_NUMBERS_CLASS

      public static Class<?> CRAFT_MAGIC_NUMBERS_CLASS
    • IBLOCK_DATA_CLASS

      public static Class<?> IBLOCK_DATA_CLASS
    • BLOCK_CLASS

      public static Class<?> BLOCK_CLASS
    • CRAFT_BLOCK_DATA_CLASS

      public static Class<?> CRAFT_BLOCK_DATA_CLASS
    • PROPERTY_MAP_CLASS

      public static Class<?> PROPERTY_MAP_CLASS
    • DIMENSION_MANAGER_CLASS

      public static Class<?> DIMENSION_MANAGER_CLASS
    • MOJANG_CODEC_CLASS

      public static Class<?> MOJANG_CODEC_CLASS
    • MOJANG_ENCODER_CLASS

      public static Class<?> MOJANG_ENCODER_CLASS
    • DATA_RESULT_CLASS

      public static Class<?> DATA_RESULT_CLASS
    • DYNAMIC_OPS_NBT_CLASS

      public static Class<?> DYNAMIC_OPS_NBT_CLASS
    • NMS_NBT_COMPOUND_CLASS

      public static Class<?> NMS_NBT_COMPOUND_CLASS
    • NMS_NBT_BASE_CLASS

      public static Class<?> NMS_NBT_BASE_CLASS
    • NBT_COMPRESSION_STREAM_TOOLS_CLASS

      public static Class<?> NBT_COMPRESSION_STREAM_TOOLS_CLASS
    • STREAM_CODEC

      public static Class<?> STREAM_CODEC
    • STREAM_DECODER

      public static Class<?> STREAM_DECODER
    • STREAM_ENCODER

      public static Class<?> STREAM_ENCODER
    • REGISTRY_FRIENDLY_BYTE_BUF

      public static Class<?> REGISTRY_FRIENDLY_BYTE_BUF
    • REGISTRY_ACCESS

      public static Class<?> REGISTRY_ACCESS
    • REGISTRY_ACCESS_FROZEN

      public static Class<?> REGISTRY_ACCESS_FROZEN
    • RESOURCE_KEY

      public static Class<?> RESOURCE_KEY
    • REGISTRY

      public static Class<?> REGISTRY
    • WRITABLE_REGISTRY

      public static Class<?> WRITABLE_REGISTRY
    • NBT_ACCOUNTER

      public static Class<?> NBT_ACCOUNTER
    • CHUNK_PROVIDER_SERVER_CLASS

      public static Class<?> CHUNK_PROVIDER_SERVER_CLASS
    • ICHUNKPROVIDER_CLASS

      public static Class<?> ICHUNKPROVIDER_CLASS
    • CHUNK_STATUS_CLASS

      public static Class<?> CHUNK_STATUS_CLASS
    • BLOCK_POSITION_CLASS

      public static Class<?> BLOCK_POSITION_CLASS
    • PLAYER_CHUNK_MAP_CLASS

      public static Class<?> PLAYER_CHUNK_MAP_CLASS
    • PLAYER_CHUNK_CLASS

      public static Class<?> PLAYER_CHUNK_CLASS
    • CHUNK_CLASS

      public static Class<?> CHUNK_CLASS
    • IBLOCKACCESS_CLASS

      public static Class<?> IBLOCKACCESS_CLASS
    • ICHUNKACCESS_CLASS

      public static Class<?> ICHUNKACCESS_CLASS
    • CHANNEL_CLASS

      public static Class<?> CHANNEL_CLASS
    • BYTE_BUF_CLASS

      public static Class<?> BYTE_BUF_CLASS
    • BYTE_TO_MESSAGE_DECODER

      public static Class<?> BYTE_TO_MESSAGE_DECODER
    • MESSAGE_TO_BYTE_ENCODER

      public static Class<?> MESSAGE_TO_BYTE_ENCODER
    • ENTITY_PLAYER_PING_FIELD

      public static Field ENTITY_PLAYER_PING_FIELD
    • ENTITY_BOUNDING_BOX_FIELD

      public static Field ENTITY_BOUNDING_BOX_FIELD
    • BYTE_BUF_IN_PACKET_DATA_SERIALIZER

      public static Field BYTE_BUF_IN_PACKET_DATA_SERIALIZER
    • DIMENSION_CODEC_FIELD

      public static Field DIMENSION_CODEC_FIELD
    • DYNAMIC_OPS_NBT_INSTANCE_FIELD

      public static Field DYNAMIC_OPS_NBT_INSTANCE_FIELD
    • CHUNK_PROVIDER_SERVER_FIELD

      public static Field CHUNK_PROVIDER_SERVER_FIELD
    • CRAFT_PARTICLE_PARTICLES_FIELD

      public static Field CRAFT_PARTICLE_PARTICLES_FIELD
    • NMS_MK_KEY_FIELD

      public static Field NMS_MK_KEY_FIELD
    • LEGACY_NMS_PARTICLE_KEY_FIELD

      public static Field LEGACY_NMS_PARTICLE_KEY_FIELD
    • LEGACY_NMS_KEY_TO_NMS_PARTICLE

      public static Field LEGACY_NMS_KEY_TO_NMS_PARTICLE
    • IS_DEBUGGING

      public static Method IS_DEBUGGING
    • GET_CRAFT_PLAYER_HANDLE_METHOD

      public static Method GET_CRAFT_PLAYER_HANDLE_METHOD
    • GET_CRAFT_ENTITY_HANDLE_METHOD

      public static Method GET_CRAFT_ENTITY_HANDLE_METHOD
    • GET_CRAFT_WORLD_HANDLE_METHOD

      public static Method GET_CRAFT_WORLD_HANDLE_METHOD
    • GET_MOB_EFFECT_LIST_ID_METHOD

      public static Method GET_MOB_EFFECT_LIST_ID_METHOD
    • GET_MOB_EFFECT_LIST_BY_ID_METHOD

      public static Method GET_MOB_EFFECT_LIST_BY_ID_METHOD
    • GET_ITEM_ID_METHOD

      public static Method GET_ITEM_ID_METHOD
    • GET_ITEM_BY_ID_METHOD

      public static Method GET_ITEM_BY_ID_METHOD
    • GET_BUKKIT_ENTITY_METHOD

      public static Method GET_BUKKIT_ENTITY_METHOD
    • GET_LEVEL_ENTITY_GETTER_ITERABLE_METHOD

      public static Method GET_LEVEL_ENTITY_GETTER_ITERABLE_METHOD
    • GET_ENTITY_BY_ID_LEVEL_ENTITY_GETTER_METHOD

      public static Method GET_ENTITY_BY_ID_LEVEL_ENTITY_GETTER_METHOD
    • GET_ENTITY_BY_ID_METHOD

      public static Method GET_ENTITY_BY_ID_METHOD
    • CRAFT_ITEM_STACK_AS_BUKKIT_COPY

      public static Method CRAFT_ITEM_STACK_AS_BUKKIT_COPY
    • CRAFT_ITEM_STACK_AS_NMS_COPY

      public static Method CRAFT_ITEM_STACK_AS_NMS_COPY
    • BUKKIT_PARTICLE_TO_NMS_ENUM_PARTICLE

      public static Method BUKKIT_PARTICLE_TO_NMS_ENUM_PARTICLE
    • NMS_ENUM_PARTICLE_TO_BUKKIT_PARTICLE

      public static Method NMS_ENUM_PARTICLE_TO_BUKKIT_PARTICLE
    • READ_ITEM_STACK_IN_PACKET_DATA_SERIALIZER_METHOD

      public static Method READ_ITEM_STACK_IN_PACKET_DATA_SERIALIZER_METHOD
    • WRITE_ITEM_STACK_IN_PACKET_DATA_SERIALIZER_METHOD

      public static Method WRITE_ITEM_STACK_IN_PACKET_DATA_SERIALIZER_METHOD
    • GET_COMBINED_ID

      public static Method GET_COMBINED_ID
    • GET_BY_COMBINED_ID

      public static Method GET_BY_COMBINED_ID
    • GET_CRAFT_BLOCK_DATA_FROM_IBLOCKDATA

      public static Method GET_CRAFT_BLOCK_DATA_FROM_IBLOCKDATA
    • PROPERTY_MAP_GET_METHOD

      public static Method PROPERTY_MAP_GET_METHOD
    • GET_DIMENSION_MANAGER

      public static Method GET_DIMENSION_MANAGER
    • GET_DIMENSION_ID

      public static Method GET_DIMENSION_ID
    • GET_DIMENSION_KEY

      public static Method GET_DIMENSION_KEY
    • CODEC_ENCODE_METHOD

      public static Method CODEC_ENCODE_METHOD
    • DATA_RESULT_GET_METHOD

      public static Method DATA_RESULT_GET_METHOD
    • READ_NBT_FROM_STREAM_METHOD

      public static Method READ_NBT_FROM_STREAM_METHOD
    • WRITE_NBT_TO_STREAM_METHOD

      public static Method WRITE_NBT_TO_STREAM_METHOD
    • STREAM_DECODER_DECODE

      public static Method STREAM_DECODER_DECODE
    • STREAM_ENCODER_ENCODE

      public static Method STREAM_ENCODER_ENCODE
    • CREATE_REGISTRY_RESOURCE_KEY

      public static Method CREATE_REGISTRY_RESOURCE_KEY
    • GET_REGISTRY_OR_THROW

      public static Method GET_REGISTRY_OR_THROW
    • GET_DIMENSION_TYPES

      public static Method GET_DIMENSION_TYPES
    • GET_REGISTRY_ID

      public static Method GET_REGISTRY_ID
    • NBT_ACCOUNTER_UNLIMITED_HEAP

      public static Method NBT_ACCOUNTER_UNLIMITED_HEAP
    • GET_REGISTRY_KEY_LOCATION

      public static Method GET_REGISTRY_KEY_LOCATION
    • CHUNK_CACHE_GET_IBLOCKACCESS

      public static Method CHUNK_CACHE_GET_IBLOCKACCESS
    • CHUNK_CACHE_GET_ICHUNKACCESS

      public static Method CHUNK_CACHE_GET_ICHUNKACCESS
    • IBLOCKACCESS_GET_BLOCK_DATA

      public static Method IBLOCKACCESS_GET_BLOCK_DATA
    • CHUNK_GET_BLOCK_DATA

      public static Method CHUNK_GET_BLOCK_DATA
    • PLAYER_CHUNK_MAP_GET_PLAYER_CHUNK

      public static Method PLAYER_CHUNK_MAP_GET_PLAYER_CHUNK
    • PLAYER_CHUNK_GET_CHUNK

      public static Method PLAYER_CHUNK_GET_CHUNK
    • ENTITY_ID_CACHE

      public static Map<Integer,org.bukkit.entity.Entity> ENTITY_ID_CACHE
  • Constructor Details

    • SpigotReflectionUtil

      public SpigotReflectionUtil()
  • Method Details

    • init

      public static void init()
    • getServerClass

      @Nullable public static @Nullable Class<?> getServerClass(String modern, String legacy)
    • isMinecraftServerInstanceDebugging

      public static boolean isMinecraftServerInstanceDebugging()
    • getMinecraftServerInstance

      public static Object getMinecraftServerInstance(org.bukkit.Server server)
    • getMinecraftServerConnectionInstance

      public static Object getMinecraftServerConnectionInstance()
    • getTPS

      public static double getTPS()
    • recentTPS

      public static double[] recentTPS()
    • getNMSClass

      public static Class<?> getNMSClass(String name) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • getOBCClass

      public static Class<?> getOBCClass(String name)
    • getNettyClass

      public static Class<?> getNettyClass(String name)
    • getBukkitEntity

      public static org.bukkit.entity.Entity getBukkitEntity(Object nmsEntity)
    • getNMSEntity

      public static Object getNMSEntity(org.bukkit.entity.Entity entity)
    • getNMSAxisAlignedBoundingBox

      public static Object getNMSAxisAlignedBoundingBox(Object nmsEntity)
    • getCraftPlayer

      public static Object getCraftPlayer(org.bukkit.entity.Player player)
    • getEntityPlayer

      public static Object getEntityPlayer(org.bukkit.entity.Player player)
    • getPlayerConnection

      public static Object getPlayerConnection(org.bukkit.entity.Player player)
    • getGameProfile

      public static Object getGameProfile(org.bukkit.entity.Player player)
    • getUserProfile

      public static List<com.github.retrooper.packetevents.protocol.player.TextureProperty> getUserProfile(org.bukkit.entity.Player player)
    • getNetworkManager

      public static Object getNetworkManager(org.bukkit.entity.Player player)
    • getChannel

      public static Object getChannel(org.bukkit.entity.Player player)
    • getPlayerPingLegacy

      @Deprecated public static int getPlayerPingLegacy(org.bukkit.entity.Player player)
      Deprecated.
    • getNetworkManagers

      public static List<Object> getNetworkManagers()
    • convertBukkitServerToNMSServer

      public static Object convertBukkitServerToNMSServer(org.bukkit.Server server)
    • convertBukkitWorldToWorldServer

      public static Object convertBukkitWorldToWorldServer(org.bukkit.World world)
    • convertWorldServerDimensionToNMSNbt

      public static Object convertWorldServerDimensionToNMSNbt(Object worldServer)
    • getDimensionId

      public static int getDimensionId(Object worldServer)
    • getDimensionKey

      public static String getDimensionKey(Object worldServer)
    • fromStringToJSON

      public static String fromStringToJSON(String message)
    • generateEntityId

      public static int generateEntityId()
    • getEffectId

      public static int getEffectId(Object nmsMobEffectList)
    • getMobEffectListById

      public static Object getMobEffectListById(int effectID)
    • getNMSItemId

      public static int getNMSItemId(Object nmsItem)
    • getNMSItemById

      public static Object getNMSItemById(int id)
    • createNMSItemStack

      public static Object createNMSItemStack(Object nmsItem, int count)
    • decodeBukkitItemStack

      public static com.github.retrooper.packetevents.protocol.item.ItemStack decodeBukkitItemStack(org.bukkit.inventory.ItemStack in)
    • encodeBukkitItemStack

      public static org.bukkit.inventory.ItemStack encodeBukkitItemStack(com.github.retrooper.packetevents.protocol.item.ItemStack in)
    • getBlockDataCombinedId

      public static int getBlockDataCombinedId(org.bukkit.material.MaterialData materialData)
    • getBlockDataByCombinedId

      public static org.bukkit.material.MaterialData getBlockDataByCombinedId(int combinedID)
    • createNMSItemStack

      public static Object createNMSItemStack(int itemID, int count)
    • createPacketDataSerializer

      public static Object createPacketDataSerializer(Object byteBuf)
    • createBlockPosition

      public static Object createBlockPosition(int x, int y, int z)
    • getFrozenRegistryAccess

      public static Object getFrozenRegistryAccess()
    • toBukkitItemStack

      public static org.bukkit.inventory.ItemStack toBukkitItemStack(Object nmsItemStack)
    • toNMSItemStack

      public static Object toNMSItemStack(org.bukkit.inventory.ItemStack itemStack)
    • readNMSItemStackPacketDataSerializer

      public static Object readNMSItemStackPacketDataSerializer(Object packetDataSerializer)
    • writeNMSItemStackPacketDataSerializer

      public static Object writeNMSItemStackPacketDataSerializer(Object packetDataSerializer, Object nmsItemStack)
    • fromMinecraftNBT

      public static com.github.retrooper.packetevents.protocol.nbt.NBTCompound fromMinecraftNBT(Object nbtCompound)
    • toMinecraftNBT

      public static Object toMinecraftNBT(com.github.retrooper.packetevents.protocol.nbt.NBTCompound nbtCompound)
    • writeNmsNbtToStream

      public static void writeNmsNbtToStream(Object compound, DataOutput out)
    • readNmsNbtFromStream

      public static Object readNmsNbtFromStream(DataInputStream in)
    • getEntityById

      @Deprecated @Nullable public static @Nullable org.bukkit.entity.Entity getEntityById(@Nullable @Nullable org.bukkit.World origin, int id)
      Deprecated.
      Please resort to SpigotConversionUtil.getEntityById(World, int) since the reflection util is not API.
      Get the entity by the id.
    • getEntityById

      @Deprecated @Nullable public static @Nullable org.bukkit.entity.Entity getEntityById(int entityID)
      Deprecated.
      Please resort to SpigotConversionUtil.getEntityById(World, int) since the reflection util is not API.
      Get the entity by the id.
    • getEntityList

      public static List<org.bukkit.entity.Entity> getEntityList(org.bukkit.World world)
    • toPacketEventsParticle

      public static com.github.retrooper.packetevents.protocol.particle.type.ParticleType<?> toPacketEventsParticle(Enum<?> particle)
    • fromPacketEventsParticle

      public static Enum<?> fromPacketEventsParticle(com.github.retrooper.packetevents.protocol.particle.type.ParticleType<?> particle)