public class MinecraftReflection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MINECRAFT_OBJECT
Deprecated.
|
static ReportType |
REPORT_CANNOT_FIND_MCPC_REMAPPER |
static ReportType |
REPORT_CANNOT_LOAD_CPC_REMAPPER |
static ReportType |
REPORT_NON_CRAFTBUKKIT_LIBRARY_PACKAGE |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
getArrayClass(java.lang.Class<?> componentType)
Retrieve the array class of a given component type.
|
static java.lang.Class<?> |
getAttributeModifierClass()
Retrieve the attribute modifier class.
|
static java.lang.Class<?> |
getAttributeSnapshotClass()
Retrieve the attribute snapshot class.
|
static java.lang.Class<?> |
getBlockClass()
Retrieve the Block (NMS) class.
|
static java.lang.Object |
getBukkitEntity(java.lang.Object nmsObject)
Dynamically retrieve the Bukkit entity from a given entity.
|
static org.bukkit.inventory.ItemStack |
getBukkitItemStack(org.bukkit.inventory.ItemStack bukkitItemStack)
Retrieve a CraftItemStack from a given ItemStack.
|
static org.bukkit.inventory.ItemStack |
getBukkitItemStack(java.lang.Object minecraftItemStack)
Retrieve the Bukkit ItemStack from a given net.minecraft.server ItemStack.
|
static java.lang.Class<?> |
getChatComponentTextClass()
Retrieve the NMS chat component text class.
|
static java.lang.Class<?> |
getChatSerializerClass()
Attempt to find the ChatSerializer class.
|
static java.lang.Class<?> |
getChunkCoordinatesClass()
Retrieve the ChunkCoordinates class.
|
static java.lang.Class<?> |
getChunkCoordIntPair()
Retrieve the ChunkCoordIntPair class.
|
static java.lang.Class<?> |
getChunkPositionClass()
Retrieve the ChunkPosition class.
|
static java.lang.Class |
getCraftBukkitClass(java.lang.String className)
Retrieve the class object of a specific CraftBukkit class.
|
static java.lang.String |
getCraftBukkitPackage()
Retrieve the name of the root CraftBukkit package.
|
static java.lang.Class<?> |
getCraftChatMessage()
Retrieve the CraftChatMessage in Minecraft 1.7.2.
|
static java.lang.Class<?> |
getCraftEntityClass()
Retrieve the CraftEntity class.
|
static java.lang.Class<?> |
getCraftItemStackClass()
Retrieve the CraftItemStack class.
|
static java.lang.Class<?> |
getCraftMessageClass()
Retrieve the CraftChatMessage introduced in 1.7.2
|
static java.lang.Class<?> |
getCraftPlayerClass()
Retrieve the CraftPlayer class.
|
static java.lang.Class<?> |
getDataWatcherClass()
Retrieve the DataWatcher class.
|
static java.lang.Class<?> |
getEntityClass()
Retrieve the entity (NMS) class.
|
static java.lang.Class<?> |
getEntityPlayerClass()
Retrieve the EntityPlayer (NMS) class.
|
static java.lang.Class<?> |
getEntityTrackerClass()
Retrieve the EntityTracker (NMS) class.
|
static java.lang.Class<?> |
getEnumProtocolClass()
Retrieve the EnumProtocol class in 1.7.2.
|
static java.lang.Class<?> |
getGameProfileClass()
Retrieve the GameProfile class in 1.7.2 and later.
|
static java.lang.Class<?> |
getIChatBaseComponentClass()
Retrieve the IChatBaseComponent class.
|
static java.lang.Class<?> |
getIntHashMapClass()
Retrieve the IntHashMap class.
|
static java.lang.Class<?> |
getItemStackArrayClass()
Retrieve the ItemStack[] class.
|
static java.lang.Class<?> |
getItemStackClass()
Retrieve the NMS ItemStack class.
|
static java.lang.Class<?> |
getMinecraftClass(java.lang.String className)
Retrieve the class object of a specific Minecraft class.
|
static java.lang.Class<?> |
getMinecraftClass(java.lang.String className,
java.lang.String... aliases)
Retrieve the first class that matches a specified Minecraft name.
|
static java.lang.Class<?> |
getMinecraftGsonClass()
Retrieve the google.gson.Gson class used by Minecraft.
|
static java.lang.Object |
getMinecraftItemStack(org.bukkit.inventory.ItemStack stack)
Retrieve the net.minecraft.server ItemStack from a Bukkit ItemStack.
|
static java.lang.Class<?> |
getMinecraftLibraryClass(java.lang.String className)
Retrieve the class object of a specific Minecraft library class.
|
static AbstractFuzzyMatcher<java.lang.Class<?>> |
getMinecraftObjectMatcher()
Retrieve a abstract fuzzy class matcher for Minecraft objects.
|
static java.lang.String |
getMinecraftObjectRegex()
Retrieve a regular expression that can match Minecraft package objects.
|
static java.lang.String |
getMinecraftPackage()
Retrieve the name of the Minecraft server package.
|
static java.lang.Class<?> |
getMinecraftServerClass()
Retrieve the MinecraftServer class.
|
static java.lang.Class<?> |
getMobEffectClass()
Retrieve the net.minecraft.server.MobEffect class.
|
static java.lang.Class<?> |
getNBTBaseClass()
Retrieve the NBT base class.
|
static java.lang.Class<?> |
getNBTCompoundClass()
Retrieve the NBT Compound class.
|
static java.lang.Class<?> |
getNbtCompressedStreamToolsClass()
Retrieve the NBTCompressedStreamTools class.
|
static java.lang.Class<?> |
getNBTReadLimiterClass()
Retrieve the NBT read limiter class.
|
static java.lang.Class<?> |
getNetHandlerClass()
Retrieve the NetHandler class (or Connection)
|
static java.lang.Class<?> |
getNetLoginHandlerClass()
Retrieve the NetLoginHandler class (or PendingConnection)
|
static java.lang.String |
getNetLoginHandlerName()
Dynamically retrieve the name of the current NetLoginHandler.
|
static java.lang.Class<?> |
getNetServerHandlerClass()
Retrieve the NetServerHandler class (or PlayerConnection)
|
static java.lang.Class<?> |
getNetworkListenThreadClass()
Retrieve the NetworkListenThread class (NMS).
|
static java.lang.Class<?> |
getNetworkManagerClass()
Retrieve the NetworkManager class or its interface.
|
static java.lang.String |
getNetworkManagerName()
Dynamically retrieve the NetworkManager name.
|
static java.lang.String |
getPackageVersion()
Retrieve the package version of the underlying CraftBukkit server.
|
static java.lang.Class<?> |
getPacketClass()
Retrieve the packet class.
|
static net.minecraft.util.io.netty.buffer.ByteBuf |
getPacketDataSerializer(net.minecraft.util.io.netty.buffer.ByteBuf buffer)
Retrieve an instance of the packet data serializer wrapper.
|
static java.lang.Class<?> |
getPacketDataSerializerClass()
Retrieve the packet data serializer class that overrides ByteBuf.
|
static java.lang.Class<?> |
getPlayerListClass()
Retrieve the player list class (or ServerConfigurationManager),
|
static java.lang.Class<?> |
getServerConnectionClass()
Retrieve the ServerConnection abstract class.
|
static java.lang.Class<?> |
getServerPingClass()
Retrieve the ServerPing class in Minecraft 1.7.2.
|
static java.lang.Class<?> |
getServerPingPlayerSampleClass()
Retrieve the ServerPingPlayerSample class in Minecraft 1.7.2.
|
static java.lang.Class<?> |
getServerPingServerDataClass()
Retrieve the ServerPingServerData class in Minecraft 1.7.2.
|
static java.lang.Class<?> |
getStatisticClass()
Retrieve the NMS statistics class.
|
static java.lang.Class<?> |
getStatisticListClass()
Retrieve the NMS statistic list class.
|
static java.lang.Class<?> |
getWatchableObjectClass()
Retrieve the WatchableObject class.
|
static java.lang.Class<?> |
getWorldServerClass()
Retrieve the WorldServer (NMS) class.
|
static java.lang.Class<?> |
getWorldTypeClass()
Retrieve the WorldType class.
|
static boolean |
isChunkCoordinates(java.lang.Object obj)
Determine if a given object is a ChunkCoordinate.
|
static boolean |
isChunkCoordIntPair(java.lang.Object obj)
Determine if the given object is an NMS ChunkCoordIntPar.
|
static boolean |
isChunkPosition(java.lang.Object obj)
Determine if a given object is a ChunkPosition.
|
static boolean |
isCraftItemStack(java.lang.Object obj)
Determine if the given object is a CraftItemStack instancey.
|
static boolean |
isCraftPlayer(java.lang.Object value)
Determine if the given object is a CraftPlayer class.
|
static boolean |
isDataWatcher(java.lang.Object obj)
Determine if the given object is a data watcher object.
|
static boolean |
isIntHashMap(java.lang.Object obj)
Determine if the given object is an IntHashMap object.
|
static boolean |
isItemStack(java.lang.Object value)
Determine if the given object is a NMS ItemStack.
|
static boolean |
isLoginHandler(java.lang.Object obj)
Determine if the given object is a NetLoginHandler (PendingConnection)
|
static boolean |
isMinecraftClass(java.lang.Class<?> clazz)
Determine if the given class is found within the package net.minecraft.server, or any equivalent package.
|
static boolean |
isMinecraftEntity(java.lang.Object obj)
Determine if the given object is actually a Minecraft packet.
|
static boolean |
isMinecraftObject(java.lang.Object obj)
Determine if a given object can be found within the package net.minecraft.server.
|
static boolean |
isMinecraftObject(java.lang.Object obj,
java.lang.String className)
Determine if a given object is found in net.minecraft.server, and has the given name.
|
static boolean |
isMinecraftPlayer(java.lang.Object obj)
Determine if the given object is a Minecraft player entity.
|
static boolean |
isPacketClass(java.lang.Object obj)
Determine if the given object is actually a Minecraft packet.
|
static boolean |
isServerHandler(java.lang.Object obj)
Determine if the given object is assignable to a NetServerHandler (PlayerConnection)
|
static boolean |
isUsingNetty()
Determine if this Minecraft version is using Netty.
|
static boolean |
isWatchableObject(java.lang.Object obj)
Determine if the given object is a watchable object.
|
static void |
setMinecraftPackage(java.lang.String minecraftPackage,
java.lang.String craftBukkitPackage)
Used during debugging and testing.
|
public static final ReportType REPORT_CANNOT_FIND_MCPC_REMAPPER
public static final ReportType REPORT_CANNOT_LOAD_CPC_REMAPPER
public static final ReportType REPORT_NON_CRAFTBUKKIT_LIBRARY_PACKAGE
@Deprecated public static final java.lang.String MINECRAFT_OBJECT
Replaced by the method getMinecraftObjectRegex()
.
public static java.lang.String getMinecraftObjectRegex()
public static AbstractFuzzyMatcher<java.lang.Class<?>> getMinecraftObjectMatcher()
public static java.lang.String getMinecraftPackage()
public static java.lang.String getPackageVersion()
public static void setMinecraftPackage(java.lang.String minecraftPackage, java.lang.String craftBukkitPackage)
minecraftPackage
- - the current Minecraft package.craftBukkitPackage
- - the current CraftBukkit package.public static java.lang.String getCraftBukkitPackage()
public static java.lang.Object getBukkitEntity(java.lang.Object nmsObject)
nmsObject
- - the NMS entity.java.lang.RuntimeException
- If we were unable to retrieve the Bukkit entity.public static boolean isMinecraftObject(@Nonnull java.lang.Object obj)
obj
- - the object to test.public static boolean isMinecraftClass(@Nonnull java.lang.Class<?> clazz)
clazz
- - the class to test.public static boolean isMinecraftObject(@Nonnull java.lang.Object obj, java.lang.String className)
obj
- - the object to test.className
- - the class name to test.public static boolean isChunkPosition(java.lang.Object obj)
obj
- - the object to test.public static boolean isChunkCoordIntPair(java.lang.Object obj)
obj
- - the object.public static boolean isChunkCoordinates(java.lang.Object obj)
obj
- - the object to test.public static boolean isPacketClass(java.lang.Object obj)
obj
- - the given object.public static boolean isLoginHandler(java.lang.Object obj)
obj
- - the given object.public static boolean isServerHandler(java.lang.Object obj)
obj
- - the given object.public static boolean isMinecraftEntity(java.lang.Object obj)
obj
- - the given object.public static boolean isItemStack(java.lang.Object value)
value
- - the given object.public static boolean isCraftPlayer(java.lang.Object value)
value
- - the given object.public static boolean isMinecraftPlayer(java.lang.Object obj)
obj
- - the given object.public static boolean isWatchableObject(java.lang.Object obj)
obj
- - the given object.public static boolean isDataWatcher(java.lang.Object obj)
obj
- - the given object.public static boolean isIntHashMap(java.lang.Object obj)
obj
- - the given object.public static boolean isCraftItemStack(java.lang.Object obj)
obj
- - the given object.public static java.lang.Class<?> getEntityPlayerClass()
public static java.lang.Class<?> getGameProfileClass()
java.lang.IllegalStateException
- If we are running 1.6.4 or earlier.public static java.lang.Class<?> getEntityClass()
public static java.lang.Class<?> getCraftChatMessage()
public static java.lang.Class<?> getWorldServerClass()
public static java.lang.Class<?> getPacketClass()
public static java.lang.Class<?> getEnumProtocolClass()
public static java.lang.Class<?> getIChatBaseComponentClass()
public static java.lang.Class<?> getChatComponentTextClass()
public static java.lang.Class<?> getChatSerializerClass()
java.lang.IllegalStateException
- If the class could not be found or deduced.public static java.lang.Class<?> getServerPingClass()
public static java.lang.Class<?> getServerPingServerDataClass()
public static java.lang.Class<?> getServerPingPlayerSampleClass()
public static boolean isUsingNetty()
Spigot is ignored in this consideration.
public static java.lang.Class<?> getMinecraftServerClass()
public static java.lang.Class<?> getStatisticClass()
public static java.lang.Class<?> getStatisticListClass()
public static java.lang.Class<?> getPlayerListClass()
public static java.lang.Class<?> getNetLoginHandlerClass()
public static java.lang.Class<?> getNetServerHandlerClass()
public static java.lang.Class<?> getNetworkManagerClass()
public static java.lang.Class<?> getNetHandlerClass()
public static java.lang.Class<?> getItemStackClass()
public static java.lang.Class<?> getBlockClass()
public static java.lang.Class<?> getWorldTypeClass()
public static java.lang.Class<?> getDataWatcherClass()
public static java.lang.Class<?> getChunkPositionClass()
public static java.lang.Class<?> getChunkCoordinatesClass()
public static java.lang.Class<?> getChunkCoordIntPair()
public static java.lang.Class<?> getWatchableObjectClass()
public static java.lang.Class<?> getServerConnectionClass()
public static java.lang.Class<?> getNBTBaseClass()
public static java.lang.Class<?> getNBTReadLimiterClass()
This is only supported in 1.7.8 (released 2014) and higher.
public static java.lang.Class<?> getNBTCompoundClass()
public static java.lang.Class<?> getEntityTrackerClass()
public static java.lang.Class<?> getNetworkListenThreadClass()
Note that this class was removed after Minecraft 1.3.1.
public static java.lang.Class<?> getAttributeSnapshotClass()
This stores the final value of an attribute, along with all the associated computational steps.
public static java.lang.Class<?> getIntHashMapClass()
public static java.lang.Class<?> getAttributeModifierClass()
public static java.lang.Class<?> getMobEffectClass()
public static java.lang.Class<?> getPacketDataSerializerClass()
public static java.lang.Class<?> getNbtCompressedStreamToolsClass()
public static net.minecraft.util.io.netty.buffer.ByteBuf getPacketDataSerializer(net.minecraft.util.io.netty.buffer.ByteBuf buffer)
buffer
- - the buffer.public static java.lang.Class<?> getMinecraftGsonClass()
public static java.lang.Class<?> getItemStackArrayClass()
public static java.lang.Class<?> getArrayClass(java.lang.Class<?> componentType)
componentType
- - type of each element in the array.public static java.lang.Class<?> getCraftItemStackClass()
public static java.lang.Class<?> getCraftPlayerClass()
public static java.lang.Class<?> getCraftEntityClass()
public static java.lang.Class<?> getCraftMessageClass()
public static org.bukkit.inventory.ItemStack getBukkitItemStack(org.bukkit.inventory.ItemStack bukkitItemStack)
bukkitItemStack
- - the Bukkit ItemStack to convert.public static org.bukkit.inventory.ItemStack getBukkitItemStack(java.lang.Object minecraftItemStack)
minecraftItemStack
- - the NMS ItemStack to wrap.public static java.lang.Object getMinecraftItemStack(org.bukkit.inventory.ItemStack stack)
By convention, item stacks that contain air are usually represented as NULL.
stack
- - the Bukkit ItemStack to convert.public static java.lang.Class getCraftBukkitClass(java.lang.String className)
className
- - the specific CraftBukkit class.java.lang.RuntimeException
- If we are unable to find the given class.public static java.lang.Class<?> getMinecraftClass(java.lang.String className)
className
- - the specific Minecraft class.java.lang.RuntimeException
- If we are unable to find the given class.public static java.lang.Class<?> getMinecraftLibraryClass(java.lang.String className)
className
- - the specific library Minecraft class.java.lang.RuntimeException
- If we are unable to find the given class.public static java.lang.Class<?> getMinecraftClass(java.lang.String className, java.lang.String... aliases)
className
- - the specific Minecraft class.aliases
- - alternative names for this Minecraft class.java.lang.RuntimeException
- If we are unable to find any of the given classes.public static java.lang.String getNetworkManagerName()
public static java.lang.String getNetLoginHandlerName()