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

public class Connection extends io.netty.channel.SimpleChannelInboundHandler<JsonElement>
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • CONNECTION_ID_COUNTER

      private static final AtomicInteger CONNECTION_ID_COUNTER
    • jsonRpcLogger

      private final JsonRpcLogger jsonRpcLogger
    • clientInfo

      private final ClientInfo clientInfo
    • managementServer

      private final ManagementServer managementServer
    • channel

      private final io.netty.channel.Channel channel
    • minecraftApi

      private final MinecraftApi minecraftApi
    • transactionId

      private final AtomicInteger transactionId
    • pendingRequests

      private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<PendingRpcRequest<?>> pendingRequests
  • Constructor Details

  • Method Details

    • tick

      public void tick()
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext pContext) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext pContext) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext pContext, Throwable pException) throws Exception
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext pContext, JsonElement pJson)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<JsonElement>
    • handleBatchRequest

      private JsonArray handleBatchRequest(List<JsonElement> pRequests)
    • sendNotification

      public void sendNotification(Holder.Reference<? extends OutgoingRpcMethod<Void,?>> pMethod)
    • sendNotification

      public <Params> void sendNotification(Holder.Reference<? extends OutgoingRpcMethod<Params,?>> pMethod, Params pParams)
    • sendRequest

      public <Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Void,Result>> pMethod)
    • sendRequest

      public <Params, Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params,Result>> pMethod, Params pParams)
    • sendRequest

      @Nullable @Contract("_,_,false->null;_,_,true->!null") private <Params, Result> CompletableFuture<Result> sendRequest(Holder.Reference<? extends OutgoingRpcMethod<Params,? extends Result>> pMethod, @Nullable Params pParams, boolean pExpectResponse)
    • handleJsonObject

      @Nullable JsonObject handleJsonObject(JsonObject pJson)
    • isValidRequestId

      private static boolean isValidRequestId(JsonElement pJson)
    • isValidResponseId

      private static boolean isValidResponseId(JsonElement pJson)
    • handleIncomingRequest

      @Nullable private JsonObject handleIncomingRequest(@Nullable JsonElement pRequestId, String pMethodName, @Nullable JsonElement pParams)
    • dispatchIncomingRequest

      @Nullable public JsonElement dispatchIncomingRequest(String pMethodName, @Nullable JsonElement pParams)
    • handleRequestResponse

      private void handleRequestResponse(int pRequestId, JsonElement pResult)
    • handleError

      @Nullable private JsonObject handleError(@Nullable JsonElement pRequestId, JsonObject pError)