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 ctx) 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 ctx) 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 ctx, Throwable cause) 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 channelHandlerContext, JsonElement jsonElement)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<JsonElement>
    • handleBatchRequest

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

      public void sendNotification(Holder.Reference<? extends OutgoingRpcMethod<Void,?>> method)
    • 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

      @Nullable JsonObject handleJsonObject(JsonObject jsonObject)
    • isValidRequestId

      private static boolean isValidRequestId(JsonElement id)
    • isValidResponseId

      private static boolean isValidResponseId(JsonElement id)
    • handleIncomingRequest

      private @Nullable JsonObject handleIncomingRequest(@Nullable JsonElement id, String method, @Nullable JsonElement params)
    • dispatchIncomingRequest

      public @Nullable JsonElement dispatchIncomingRequest(String method, @Nullable JsonElement params)
    • handleRequestResponse

      private void handleRequestResponse(int id, JsonElement result)
    • handleError

      private @Nullable JsonObject handleError(@Nullable JsonElement id, JsonObject error)