Interface ServerContext

All Superinterfaces:
ListenerContext
All Known Subinterfaces:
ServerLoginContext, ServerPlayContext

public interface ServerContext
extends ListenerContext
Represents a context for packet reception on the logical server.

Compared to the basic listener context, the server context offers access to the active MinecraftServer.

  • Method Summary

    Modifier and Type Method Description
    net.minecraft.server.MinecraftServer getEngine()
    Returns the game engine associated with the packet listener.

    Methods inherited from interface io.github.fablabsmc.fablabs.api.networking.v1.ListenerContext

    getListener
  • Method Details

    • getEngine

      net.minecraft.server.MinecraftServer getEngine()
      Returns the game engine associated with the packet listener.

      The game engine exposes access to synchronization of execution to main thread, such as ThreadExecutor.submit(Runnable), allowing you to apply changes to the game without danger of concurrent modification.

      In a server context, the game engine is always a Minecraft Server.

      Specified by:
      getEngine in interface ListenerContext
      Returns:
      the Minecraft Server