Package com.comphenix.protocol.wrappers
Class AutoWrapper<T>
java.lang.Object
com.comphenix.protocol.wrappers.AutoWrapper<T>
- All Implemented Interfaces:
EquivalentConverter<T>
Automatically wraps an internal NMS class to a non-versioned, deofbuscated class.
Requirements:
- The wrapper must be public
- If the wrapper is an internal class, it must be static
- The wrapper must have one public constructor with no arguments (the default constructor is acceptable)
- The wrapper must have the the same number of fields as the NMS class
- Each field should correspond, in order, to its NMS counterpart
- Non-generic fields must have a converter
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfield(int index, EquivalentConverter converter) getGeneric(Object specific) Retrieve a copy of the generic type from a specific type.getSpecific(Object generic) Retrieve a copy of the specific type using an instance of the generic type.Due to type erasure, we need to explicitly keep a reference to the specific type.static <T> AutoWrapper<T> static <T> AutoWrapper<T> static <T> AutoWrapper<T>
-
Method Details
-
wrap
-
wrap
-
wrap
public static <T> AutoWrapper<T> wrap(Class<T> wrapperClass, String nmsClassName, String... aliases) -
field
-
field
-
wrap
-
unwrap
-
getSpecific
Description copied from interface:EquivalentConverterRetrieve a copy of the specific type using an instance of the generic type.This is usually a wrapper type in the Bukkit API or ProtocolLib API.
- Specified by:
getSpecificin interfaceEquivalentConverter<T>- Parameters:
generic- - the generic type.- Returns:
- The new specific type.
-
getGeneric
Description copied from interface:EquivalentConverterRetrieve a copy of the generic type from a specific type.This is usually a native net.minecraft.server type in Minecraft.
- Specified by:
getGenericin interfaceEquivalentConverter<T>- Parameters:
specific- - the specific type we need to copy.- Returns:
- A copy of the specific type.
-
getSpecificType
Description copied from interface:EquivalentConverterDue to type erasure, we need to explicitly keep a reference to the specific type.- Specified by:
getSpecificTypein interfaceEquivalentConverter<T>- Returns:
- The specific type.
-