public class BukkitConverters
extends java.lang.Object
Constructor and Description |
---|
BukkitConverters() |
Modifier and Type | Method and Description |
---|---|
static PacketConstructor.Unwrapper |
asUnwrapper(java.lang.Class<?> nativeType,
EquivalentConverter<java.lang.Object> converter)
Retrieve an equivalent unwrapper for the converter.
|
static <T> EquivalentConverter<java.lang.Iterable<? extends T>> |
getArrayConverter(java.lang.Class<?> genericItemType,
EquivalentConverter<T> itemConverter)
Retrieve an equivalent converter for an array of generic items.
|
static EquivalentConverter<org.bukkit.Material> |
getBlockConverter()
Retrieve a converter for block instances.
|
static java.util.Map<java.lang.Class<?>,EquivalentConverter<java.lang.Object>> |
getConvertersForGeneric()
Retrieve every converter that is associated with a generic class.
|
static java.util.Map<java.lang.Class<?>,EquivalentConverter<java.lang.Object>> |
getConvertersForSpecific()
Retrieve every converter that is associated with a specific class.
|
static EquivalentConverter<WrappedDataWatcher> |
getDataWatcherConverter()
Retrieve a converter for the NMS DataWatcher class and our wrapper.
|
static EquivalentConverter<org.bukkit.entity.Entity> |
getEntityConverter(org.bukkit.World world)
Retrieve a converter for NMS entities and Bukkit entities.
|
static <TType> EquivalentConverter<TType> |
getIgnoreNull(EquivalentConverter<TType> delegate)
Wraps a given equivalent converter in NULL checks, ensuring that such values are ignored.
|
static EquivalentConverter<org.bukkit.inventory.ItemStack> |
getItemStackConverter()
Retrieve the converter used to convert NMS ItemStacks to Bukkit's ItemStack.
|
static <T> EquivalentConverter<java.util.List<T>> |
getListConverter(java.lang.Class<?> genericItemType,
EquivalentConverter<T> itemConverter)
Retrieve an equivalent converter for a list of generic items.
|
static <T,U> EquivalentConverter<java.util.Map<T,U>> |
getMapConverter(java.lang.Class<?> genericKeyType,
EquivalentConverter<T> keyConverter)
Retrieve an equivalent converter for a map of generic keys and primitive values.
|
static EquivalentConverter<NbtBase<?>> |
getNbtConverter()
Retrieve an equivalent converter for net.minecraft.server NBT classes and their wrappers.
|
static EquivalentConverter<org.bukkit.potion.PotionEffect> |
getPotionEffectConverter()
Retrieve the converter used to convert between a PotionEffect and the equivalent NMS Mobeffect.
|
static java.util.List<PacketConstructor.Unwrapper> |
getUnwrappers()
Retrieve every NMS <-> Bukkit converter as unwrappers.
|
static EquivalentConverter<WrappedWatchableObject> |
getWatchableObjectConverter()
Retrieve a converter for watchable objects and the respective wrapper.
|
static EquivalentConverter<org.bukkit.WorldType> |
getWorldTypeConverter()
Retrieve a converter for Bukkit's world type enum and the NMS equivalent.
|
static EquivalentConverter<WrappedAttribute> |
getWrappedAttributeConverter()
Retrieve a converter for wrapped attribute snapshots.
|
static EquivalentConverter<WrappedChatComponent> |
getWrappedChatComponentConverter()
Retrieve a converter for wrapped chat components.
|
static EquivalentConverter<WrappedGameProfile> |
getWrappedGameProfileConverter()
Retrieve a converter for wrapped attribute snapshots.
|
static EquivalentConverter<WrappedServerPing> |
getWrappedServerPingConverter()
Retrieve the converter for the ServerPing packet in
PacketType.Status.Server#OUT_SERVER_INFO . |
static EquivalentConverter<WrappedStatistic> |
getWrappedStatisticConverter()
Retrieve the converter for a statistic.
|
public static <T,U> EquivalentConverter<java.util.Map<T,U>> getMapConverter(java.lang.Class<?> genericKeyType, EquivalentConverter<T> keyConverter)
genericItemType
- - the generic item type.itemConverter
- - an equivalent converter for the generic type.public static <T> EquivalentConverter<java.util.List<T>> getListConverter(java.lang.Class<?> genericItemType, EquivalentConverter<T> itemConverter)
genericItemType
- - the generic item type.itemConverter
- - an equivalent converter for the generic type.public static <T> EquivalentConverter<java.lang.Iterable<? extends T>> getArrayConverter(java.lang.Class<?> genericItemType, EquivalentConverter<T> itemConverter)
The array is wrapped in a list.
genericItemType
- - the generic item type.itemConverter
- - an equivalent converter for the generic type.public static EquivalentConverter<WrappedGameProfile> getWrappedGameProfileConverter()
public static EquivalentConverter<WrappedChatComponent> getWrappedChatComponentConverter()
public static EquivalentConverter<WrappedAttribute> getWrappedAttributeConverter()
public static EquivalentConverter<WrappedWatchableObject> getWatchableObjectConverter()
public static EquivalentConverter<WrappedDataWatcher> getDataWatcherConverter()
public static EquivalentConverter<org.bukkit.WorldType> getWorldTypeConverter()
public static EquivalentConverter<NbtBase<?>> getNbtConverter()
public static EquivalentConverter<org.bukkit.entity.Entity> getEntityConverter(org.bukkit.World world)
world
- - the current world.public static EquivalentConverter<org.bukkit.inventory.ItemStack> getItemStackConverter()
public static EquivalentConverter<WrappedServerPing> getWrappedServerPingConverter()
PacketType.Status.Server#OUT_SERVER_INFO
.public static EquivalentConverter<WrappedStatistic> getWrappedStatisticConverter()
public static EquivalentConverter<org.bukkit.Material> getBlockConverter()
public static EquivalentConverter<org.bukkit.potion.PotionEffect> getPotionEffectConverter()
public static <TType> EquivalentConverter<TType> getIgnoreNull(EquivalentConverter<TType> delegate)
delegate
- - the underlying equivalent converter.public static PacketConstructor.Unwrapper asUnwrapper(java.lang.Class<?> nativeType, EquivalentConverter<java.lang.Object> converter)
nativeType
- - the native NMS type the converter produces.converter
- - the converter.public static java.util.Map<java.lang.Class<?>,EquivalentConverter<java.lang.Object>> getConvertersForSpecific()
public static java.util.Map<java.lang.Class<?>,EquivalentConverter<java.lang.Object>> getConvertersForGeneric()
public static java.util.List<PacketConstructor.Unwrapper> getUnwrappers()