Package com.viaversion.viaversion.util
Class ProtocolUtil
java.lang.Object
com.viaversion.viaversion.util.ProtocolUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P extends PacketType>
Map<State,PacketTypeMap<P>> packetTypeMap
(@Nullable Class<P> parent, Class<? extends P>... packetTypeClasses) Returns a map of packet types by state.static String
toNiceHex
(int id) Returns a hex string of a packet id.static String
toNiceName
(Class<? extends Protocol> protocol) Returns a readable name of a protocol.
-
Constructor Details
-
ProtocolUtil
public ProtocolUtil()
-
-
Method Details
-
packetTypeMap
@SafeVarargs public static <P extends PacketType> Map<State,PacketTypeMap<P>> packetTypeMap(@Nullable Class<P> parent, Class<? extends P>... packetTypeClasses) Returns a map of packet types by state.- Type Parameters:
P
- packet type class- Parameters:
parent
- parent packet type class as given by the Protocol genericspacketTypeClasses
- packet type enum classes belonging to the parent type- Returns:
- map of packet types by state
-
toNiceHex
Returns a hex string of a packet id.- Parameters:
id
- packet id- Returns:
- packet id as a nice hex string
-
toNiceName
Returns a readable name of a protocol. For example, "Protocol1_12_2To1_13" becomes "1.12.2->1.13".- Parameters:
protocol
- protocol class- Returns:
- readable name of the protocol
-