public class MinecraftReflection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MINECRAFT_OBJECT
Regular expression that matches a Minecraft object.
|
Constructor and Description |
---|
MinecraftReflection() |
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.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<?> |
getChunkCoordinatesClass()
Retrieve the ChunkPosition 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<?> |
getCraftItemStackClass()
Retrieve the CraftItemStack 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<?> |
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.Object |
getMinecraftItemStack(org.bukkit.inventory.ItemStack stack)
Retrieve the net.minecraft.server ItemStack from a Bukkit ItemStack.
|
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<?> |
getNBTBaseClass()
Retrieve the NBT base class.
|
static java.lang.Class<?> |
getNetHandlerClass()
Retrieve the NetHandler class.
|
static java.lang.Class<?> |
getNetLoginHandlerClass()
Retrieve the NetLoginHandler class.
|
static java.lang.String |
getNetLoginHandlerName()
Dynamically retrieve the name of the current NetLoginHandler.
|
static java.lang.Class<?> |
getNetServerHandlerClass()
Retrieve the NetServerHandler class.
|
static java.lang.Class<?> |
getNetworkManagerClass()
Retrieve the NetworkManager class.
|
static java.lang.String |
getNetworkManagerName()
Dynamically retrieve the NetworkManager name.
|
static java.lang.Class<?> |
getPacketClass()
Retrieve the packet class.
|
static java.lang.Class<?> |
getWatchableObjectClass()
Retrieve the WatchableObject 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 |
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 |
isDataWatcher(java.lang.Object obj)
Determine if the given object is a data watcher 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.
|
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 |
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 java.lang.String MINECRAFT_OBJECT
public static java.lang.String getMinecraftPackage()
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 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 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 isMinecraftEntity(java.lang.Object obj)
obj
- - the given object.public static boolean isItemStack(java.lang.Object value)
obj
- - 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 isCraftItemStack(java.lang.Object obj)
obj
- - the given object.public static java.lang.Class<?> getEntityPlayerClass()
public static java.lang.Class<?> getEntityClass()
public static java.lang.Class<?> getPacketClass()
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<?> getWorldTypeClass()
public static java.lang.Class<?> getMinecraftServerClass()
public static java.lang.Class<?> getDataWatcherClass()
public static java.lang.Class<?> getChunkPositionClass()
public static java.lang.Class<?> getChunkCoordinatesClass()
public static java.lang.Class<?> getWatchableObjectClass()
public static java.lang.Class<?> getNBTBaseClass()
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 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)
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<?> getMinecraftClass(java.lang.String className, java.lang.String... aliases)
classes
- - the specific 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()