Package com.comphenix.protocol.wrappers
Class BukkitConverters
java.lang.Object
com.comphenix.protocol.wrappers.BukkitConverters
Contains several useful equivalent converters for normal Bukkit types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PacketConstructor.UnwrapperasUnwrapper(Class<?> nativeType, EquivalentConverter<Object> converter) Retrieve an equivalent unwrapper for the converter.static EquivalentConverter<org.bukkit.advancement.Advancement> static <T> EquivalentConverter<Iterable<? extends T>> getArrayConverter(Class<?> genericItemType, EquivalentConverter<T> itemConverter) Retrieve an equivalent converter for an array of generic items.static EquivalentConverter<org.bukkit.Material> Retrieve a converter for block instances.static Map<Class<?>, EquivalentConverter<Object>> Retrieve every converter that is associated with a generic class.static EquivalentConverter<WrappedDataValue> Retrieve a converter for data values in 1.19.3+.Retrieve a converter for the NMS DataWatcher class and our wrapper.static EquivalentConverter<org.bukkit.World> static EquivalentConverter<Integer> static EquivalentConverter<org.bukkit.potion.PotionEffectType> static <A,B> EquivalentConverter <Either<A, B>> getEitherConverter(EquivalentConverter<A> leftConverter, EquivalentConverter<B> rightConverter) static EquivalentConverter<org.bukkit.entity.Entity> getEntityConverter(org.bukkit.World world) Retrieve a converter for NMS entities and Bukkit entities.static EquivalentConverter<org.bukkit.entity.EntityType> static EquivalentConverter<Integer> static EquivalentConverter<org.bukkit.inventory.ItemStack> Retrieve the converter used to convert NMS ItemStacks to Bukkit's ItemStack.static <T> EquivalentConverter<List<T>> getListConverter(EquivalentConverter<T> itemConverter) Retrieve an equivalent converter for a list of generic items.static <T> EquivalentConverter<List<T>> getListConverter(Class<?> listClass, EquivalentConverter<T> itemConverter) static <K,V> EquivalentConverter <Map<K, V>> getMapConverter(EquivalentConverter<K> keyConverter, EquivalentConverter<V> valConverter) static EquivalentConverter<List<org.bukkit.inventory.MerchantRecipe>> Creates a converter from a MerchantRecipeList (which is just an ArrayList of MerchantRecipe wrapper) to aListofMerchantRecipe.static EquivalentConverter<NbtBase<?>> Retrieve an equivalent converter for net.minecraft.server NBT classes and their wrappers.static EquivalentConverter<PacketContainer> static <A,B> EquivalentConverter <Pair<A, B>> getPairConverter(EquivalentConverter<A> firstConverter, EquivalentConverter<B> secondConverter) static EquivalentConverter<WrappedParticle> static EquivalentConverter<org.bukkit.potion.PotionEffect> Retrieve the converter used to convert between a PotionEffect and the equivalent NMS Mobeffect.static EquivalentConverter<BlockPosition> static <T> EquivalentConverter<Set<T>> getSetConverter(EquivalentConverter<T> itemConverter) Retrieve an equivalent converter for a set of generic items.static EquivalentConverter<org.bukkit.Sound> static List<PacketConstructor.Unwrapper> Retrieve every NMS to/from Bukkit converter as unwrappers.static EquivalentConverter<org.bukkit.util.Vector> Retrieve the converter used to convert between a Vector and the equivalent NMS Vec3d.Retrieve a converter for watchable objects and the respective wrapper.static EquivalentConverter<org.bukkit.World> Retrieve the converter used to convert between a NMS World and a Bukkit world.static EquivalentConverter<org.bukkit.World> static EquivalentConverter<org.bukkit.WorldType> Retrieve a converter for Bukkit's world type enum and the NMS equivalent.static EquivalentConverter<WrappedAttribute> Retrieve a converter for wrapped attribute snapshots.static EquivalentConverter<WrappedBlockData> Retrieve a converter for wrapped block data.Retrieve a converter for wrapped chat components.Retrieve a converter for wrapped game profiles.getWrappedRegistrable(@NotNull Class<?> registrableClass) Retrieve a converter for wrapped block entity type.static EquivalentConverter<WrappedServerPing> Retrieve the converter for the ServerPing packet inPacketType.Status.Server.SERVER_INFO.static EquivalentConverter<WrappedStatistic> Retrieve the converter for a statistic.
-
Constructor Details
-
BukkitConverters
public BukkitConverters()
-
-
Method Details
-
getMapConverter
public static <K,V> EquivalentConverter<Map<K,V>> getMapConverter(EquivalentConverter<K> keyConverter, EquivalentConverter<V> valConverter) -
getListConverter
public static <T> EquivalentConverter<List<T>> getListConverter(Class<?> listClass, EquivalentConverter<T> itemConverter) -
getListConverter
public static <T> EquivalentConverter<List<T>> getListConverter(EquivalentConverter<T> itemConverter) Retrieve an equivalent converter for a list of generic items.- Type Parameters:
T- Type- Parameters:
itemConverter- - an equivalent converter for the generic type.- Returns:
- An equivalent converter.
-
getPairConverter
public static <A,B> EquivalentConverter<Pair<A,B>> getPairConverter(EquivalentConverter<A> firstConverter, EquivalentConverter<B> secondConverter) -
getEitherConverter
public static <A,B> EquivalentConverter<Either<A,B>> getEitherConverter(EquivalentConverter<A> leftConverter, EquivalentConverter<B> rightConverter) - Type Parameters:
A- converted left typeB- converted right type- Parameters:
leftConverter- convert the left value if availablerightConverter- convert the right value if available- Returns:
- converter for Mojang either class
-
getSetConverter
Retrieve an equivalent converter for a set of generic items.- Type Parameters:
T- Element type- Parameters:
itemConverter- - an equivalent converter for the generic type.- Returns:
- An equivalent converter.
-
getArrayConverter
public static <T> EquivalentConverter<Iterable<? extends T>> getArrayConverter(Class<?> genericItemType, EquivalentConverter<T> itemConverter) Retrieve an equivalent converter for an array of generic items.- Type Parameters:
T- TypeThe array is wrapped in a list.
- Parameters:
genericItemType- - the generic item type.itemConverter- - an equivalent converter for the generic type.- Returns:
- An equivalent converter.
-
getWrappedGameProfileConverter
Retrieve a converter for wrapped game profiles.- Returns:
- Wrapped game profile converter.
-
getWrappedChatComponentConverter
Retrieve a converter for wrapped chat components.- Returns:
- Wrapped chat component.
-
getWrappedBlockDataConverter
Retrieve a converter for wrapped block data.- Returns:
- Wrapped block data.
-
getWrappedRegistrable
public static EquivalentConverter<WrappedRegistrable> getWrappedRegistrable(@NotNull @NotNull Class<?> registrableClass) Retrieve a converter for wrapped block entity type.- Returns:
- Wrapped block entity type.
-
getWrappedAttributeConverter
Retrieve a converter for wrapped attribute snapshots.- Returns:
- Wrapped attribute snapshot converter.
-
getWrappedProfilePublicKeyConverter
-
getWrappedPublicKeyDataConverter
public static EquivalentConverter<WrappedProfilePublicKey.WrappedProfileKeyData> getWrappedPublicKeyDataConverter() -
getWrappedRemoteChatSessionDataConverter
public static EquivalentConverter<WrappedRemoteChatSessionData> getWrappedRemoteChatSessionDataConverter() -
getWrappedSignatureConverter
- Returns:
- converter for cryptographic signature data that are used in login and chat packets
-
getWrappedMessageSignatureConverter
- Returns:
- converter for an encoded cryptographic message signature
-
getWrappedChunkDataConverter
-
getWrappedLightDataConverter
-
getWrappedTeamParametersConverter
-
getWrappedNumberFormatConverter
-
getPacketContainerConverter
-
getWatchableObjectConverter
Retrieve a converter for watchable objects and the respective wrapper.- Returns:
- A watchable object converter.
-
getDataValueConverter
Retrieve a converter for data values in 1.19.3+.- Returns:
- A data value converter.
-
getDataWatcherConverter
Retrieve a converter for the NMS DataWatcher class and our wrapper.- Returns:
- A DataWatcher converter.
-
getWorldTypeConverter
Retrieve a converter for Bukkit's world type enum and the NMS equivalent.- Returns:
- A world type enum converter.
-
getNbtConverter
Retrieve an equivalent converter for net.minecraft.server NBT classes and their wrappers.- Returns:
- An equivalent converter for NBT.
-
getEntityConverter
public static EquivalentConverter<org.bukkit.entity.Entity> getEntityConverter(org.bukkit.World world) Retrieve a converter for NMS entities and Bukkit entities.- Parameters:
world- - the current world.- Returns:
- A converter between the underlying NMS entity and Bukkit's wrapper.
-
getEntityTypeConverter
-
getItemStackConverter
Retrieve the converter used to convert NMS ItemStacks to Bukkit's ItemStack.- Returns:
- Item stack converter.
-
getWrappedServerPingConverter
Retrieve the converter for the ServerPing packet inPacketType.Status.Server.SERVER_INFO.- Returns:
- Server ping converter.
-
getWrappedStatisticConverter
Retrieve the converter for a statistic.- Returns:
- Statistic converter.
-
getBlockConverter
Retrieve a converter for block instances.- Returns:
- A converter for block instances.
-
getWorldConverter
Retrieve the converter used to convert between a NMS World and a Bukkit world.- Returns:
- The world converter.
-
getPotionEffectConverter
Retrieve the converter used to convert between a PotionEffect and the equivalent NMS Mobeffect.- Returns:
- The potion effect converter.
-
getVectorConverter
Retrieve the converter used to convert between a Vector and the equivalent NMS Vec3d.- Returns:
- The Vector converter.
-
getSoundConverter
-
getParticleConverter
-
getAdvancementConverter
-
asUnwrapper
public static PacketConstructor.Unwrapper asUnwrapper(Class<?> nativeType, EquivalentConverter<Object> converter) Retrieve an equivalent unwrapper for the converter.- Parameters:
nativeType- - the native NMS type the converter produces.converter- - the converter.- Returns:
- The equivalent unwrapper.
-
getConvertersForGeneric
Retrieve every converter that is associated with a generic class.- Returns:
- Every converter with a unique generic class.
-
getUnwrappers
Retrieve every NMS to/from Bukkit converter as unwrappers.- Returns:
- Every unwrapper.
-
getEffectTypeConverter
-
getWorldKeyConverter
-
getDimensionConverter
-
getDimensionIDConverter
-
getMerchantRecipeListConverter
public static EquivalentConverter<List<org.bukkit.inventory.MerchantRecipe>> getMerchantRecipeListConverter()Creates a converter from a MerchantRecipeList (which is just an ArrayList of MerchantRecipe wrapper) to aListofMerchantRecipe. Primarily for the packet OPEN_WINDOW_MERCHANT which is present in 1.13+.- Returns:
- The MerchantRecipeList converter.
-
getSectionPositionConverter
-
getGameStateConverter
-
Converters.ignoreNull(EquivalentConverter)