public static class SimpleChannel.MessageBuilder<MSG>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
SimpleChannel.MessageBuilder.ToBooleanBiFunction<T,U> |
Modifier and Type | Field and Description |
---|---|
private SimpleChannel |
channel |
private java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> |
consumer |
private java.util.function.Function<PacketBuffer,MSG> |
decoder |
private java.util.function.BiConsumer<MSG,PacketBuffer> |
encoder |
private int |
id |
private java.util.function.Function<MSG,java.lang.Integer> |
loginIndexGetter |
private java.util.function.BiConsumer<MSG,java.lang.Integer> |
loginIndexSetter |
private java.util.function.Function<java.lang.Boolean,java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,MSG>>> |
loginPacketGenerators |
private java.util.Optional<NetworkDirection> |
networkDirection |
private java.lang.Class<MSG> |
type |
Constructor and Description |
---|
MessageBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
add() |
SimpleChannel.MessageBuilder<MSG> |
buildLoginPacketList(java.util.function.Function<java.lang.Boolean,java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,MSG>>> loginPacketGenerators) |
SimpleChannel.MessageBuilder<MSG> |
consumer(java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> consumer) |
SimpleChannel.MessageBuilder<MSG> |
consumer(SimpleChannel.MessageBuilder.ToBooleanBiFunction<MSG,java.util.function.Supplier<NetworkEvent.Context>> handler)
Function returning a boolean "packet handled" indication, for simpler channel building.
|
SimpleChannel.MessageBuilder<MSG> |
decoder(java.util.function.Function<PacketBuffer,MSG> decoder) |
SimpleChannel.MessageBuilder<MSG> |
encoder(java.util.function.BiConsumer<MSG,PacketBuffer> encoder) |
private static <MSG> SimpleChannel.MessageBuilder<MSG> |
forType(SimpleChannel channel,
java.lang.Class<MSG> type,
int id,
NetworkDirection networkDirection) |
SimpleChannel.MessageBuilder<MSG> |
loginIndex(java.util.function.Function<MSG,java.lang.Integer> loginIndexGetter,
java.util.function.BiConsumer<MSG,java.lang.Integer> loginIndexSetter) |
SimpleChannel.MessageBuilder<MSG> |
markAsLoginPacket() |
private SimpleChannel channel
private java.lang.Class<MSG> type
private int id
private java.util.function.BiConsumer<MSG,PacketBuffer> encoder
private java.util.function.Function<PacketBuffer,MSG> decoder
private java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> consumer
private java.util.function.Function<MSG,java.lang.Integer> loginIndexGetter
private java.util.function.BiConsumer<MSG,java.lang.Integer> loginIndexSetter
private java.util.function.Function<java.lang.Boolean,java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,MSG>>> loginPacketGenerators
private java.util.Optional<NetworkDirection> networkDirection
private static <MSG> SimpleChannel.MessageBuilder<MSG> forType(SimpleChannel channel, java.lang.Class<MSG> type, int id, NetworkDirection networkDirection)
public SimpleChannel.MessageBuilder<MSG> encoder(java.util.function.BiConsumer<MSG,PacketBuffer> encoder)
public SimpleChannel.MessageBuilder<MSG> decoder(java.util.function.Function<PacketBuffer,MSG> decoder)
public SimpleChannel.MessageBuilder<MSG> loginIndex(java.util.function.Function<MSG,java.lang.Integer> loginIndexGetter, java.util.function.BiConsumer<MSG,java.lang.Integer> loginIndexSetter)
public SimpleChannel.MessageBuilder<MSG> buildLoginPacketList(java.util.function.Function<java.lang.Boolean,java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,MSG>>> loginPacketGenerators)
public SimpleChannel.MessageBuilder<MSG> markAsLoginPacket()
public SimpleChannel.MessageBuilder<MSG> consumer(java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> consumer)
public SimpleChannel.MessageBuilder<MSG> consumer(SimpleChannel.MessageBuilder.ToBooleanBiFunction<MSG,java.util.function.Supplier<NetworkEvent.Context>> handler)
handler
- a handlerpublic void add()