Class Connection
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<JsonElement>
net.minecraft.server.jsonrpc.Connection
- All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final io.netty.channel.Channelprivate final ClientInfoprivate static final AtomicIntegerprivate final JsonRpcLoggerprivate static final org.slf4j.Loggerprivate final ManagementServerprivate final MinecraftApiprivate final it.unimi.dsi.fastutil.ints.Int2ObjectMap<PendingRpcRequest<?>> private final AtomicInteger -
Constructor Summary
ConstructorsConstructorDescriptionConnection(io.netty.channel.Channel channel, ManagementServer managementServer, MinecraftApi minecraftApi, JsonRpcLogger jsonrpcLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, JsonElement jsonElement) @Nullable JsonElementdispatchIncomingRequest(String method, @Nullable JsonElement params) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) private JsonArrayhandleBatchRequest(List<JsonElement> batchRequests) private @Nullable JsonObjecthandleError(@Nullable JsonElement id, JsonObject error) private @Nullable JsonObjecthandleIncomingRequest(@Nullable JsonElement id, String method, @Nullable JsonElement params) (package private) @Nullable JsonObjecthandleJsonObject(JsonObject jsonObject) private voidhandleRequestResponse(int id, JsonElement result) private static booleanprivate static booleanvoidsendNotification(Holder.Reference<? extends OutgoingRpcMethod<Void, ?>> method) <Params> voidsendNotification(Holder.Reference<? extends OutgoingRpcMethod<Params, ?>> method, Params params) <Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Void, Result>> method) private <Params,Result>
@Nullable CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, ? extends Result>> method, @Nullable Params params, boolean expectReply) <Params,Result>
CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, Result>> method, Params params) voidtick()Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CONNECTION_ID_COUNTER
-
jsonRpcLogger
-
clientInfo
-
managementServer
-
channel
private final io.netty.channel.Channel channel -
minecraftApi
-
transactionId
-
pendingRequests
-
-
Constructor Details
-
Connection
public Connection(io.netty.channel.Channel channel, ManagementServer managementServer, MinecraftApi minecraftApi, JsonRpcLogger jsonrpcLogger)
-
-
Method Details
-
tick
public void tick() -
channelActive
-
channelInactive
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, JsonElement jsonElement) - Specified by:
channelRead0in classio.netty.channel.SimpleChannelInboundHandler<JsonElement>
-
handleBatchRequest
-
sendNotification
-
sendNotification
public <Params> void sendNotification(Holder.Reference<? extends OutgoingRpcMethod<Params, ?>> method, Params params) -
sendRequest
public <Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Void, Result>> method) -
sendRequest
public <Params,Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, Result>> method, Params params) -
sendRequest
@Contract("_,_,false->null;_,_,true->!null") private <Params,Result> @Nullable CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, ? extends Result>> method, @Nullable Params params, boolean expectReply) -
handleJsonObject
-
isValidRequestId
-
isValidResponseId
-
handleIncomingRequest
private @Nullable JsonObject handleIncomingRequest(@Nullable JsonElement id, String method, @Nullable JsonElement params) -
dispatchIncomingRequest
-
handleRequestResponse
-
handleError
-