Package net.minecraft.server.jsonrpc
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 context) voidchannelInactive(io.netty.channel.ChannelHandlerContext context) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext context, JsonElement json) dispatchIncomingRequest(String methodName, JsonElement params) voidexceptionCaught(io.netty.channel.ChannelHandlerContext context, Throwable exception) private JsonArrayhandleBatchRequest(List<JsonElement> requests) private JsonObjecthandleError(JsonElement requestId, JsonObject error) private JsonObjecthandleIncomingRequest(JsonElement requestId, String methodName, JsonElement params) (package private) JsonObjecthandleJsonObject(JsonObject json) private voidhandleRequestResponse(int requestId, JsonElement result) private static booleanisValidRequestId(JsonElement json) private static booleanisValidResponseId(JsonElement json) voidsendNotification(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>
CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, ? extends Result>> method, Params params, boolean expectResponse) <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 java.lang.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
- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext context, Throwable exception) 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
- 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
@Nullable @Contract("_,_,false->null;_,_,true->!null") private <Params,Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params, ? extends Result>> method, @Nullable Params params, boolean expectResponse) -
handleJsonObject
-
isValidRequestId
-
isValidResponseId
-
handleIncomingRequest
@Nullable private JsonObject handleIncomingRequest(@Nullable JsonElement requestId, String methodName, @Nullable JsonElement params) -
dispatchIncomingRequest
@Nullable public JsonElement dispatchIncomingRequest(String methodName, @Nullable JsonElement params) -
handleRequestResponse
-
handleError
-