Class MudInstance

java.lang.Object
io.github.protasm.jvmud.execution.instance.MudInstance
All Implemented Interfaces:
InstanceHost

public final class MudInstance extends Object implements InstanceHost
Runtime and serialized world operations for one independently hosted mudlib.
  • Method Details

    • boot

      public static MudInstance boot(Path mudlibRoot, String configObjectPath)
    • boot

      public static MudInstance boot(Path mudlibRoot, String configObjectPath, MudlibBootProgress progress)
      Boots a persistent mud instance and reports host-visible progress to the supplied callback.
      Parameters:
      mudlibRoot - filesystem root of the selected mudlib
      configObjectPath - mudlib-relative JVMud configuration path
      progress - callback for local startup progress events
      Returns:
      booted mud instance ready for session attachment
    • boot

      public static MudInstance boot(Path mudlibRoot, String configObjectPath, MudlibBootProgress progress, LPCObjectLoadObserver objectLoadObserver)
      Boots a persistent mud instance with host-visible preload and object-load diagnostics.
      Parameters:
      mudlibRoot - filesystem root of the selected mudlib
      configObjectPath - mudlib-relative JVMud configuration path
      progress - callback for local startup progress events
      objectLoadObserver - observer for each shared LPC object load attempt
      Returns:
      booted mud instance ready for session attachment
    • startExecution

      public void startExecution()
      Starts this instance's independent command queue and configured clock exactly once.
    • shutdown

      public void shutdown(Object reason)
      Stops the clock, completes queued work and the shutdown lifecycle, then closes this world queue.
      Specified by:
      shutdown in interface InstanceHost
    • administer

      public <T> T administer(Function<LPCRuntime, T> action)
      Runs trusted administration on this mudlib's execution thread.
      Specified by:
      administer in interface InstanceHost
    • advanceWorldTick

      public void advanceWorldTick()
      Advances only this mudlib, on its own execution thread.
      Specified by:
      advanceWorldTick in interface InstanceHost
    • reloadMudlibObject

      public LPCObjectHandle reloadMudlibObject(String objectPath)
      Recompiles and replaces one shared mudlib object while this instance remains online.

      The path is an LPC object id relative to the selected mudlib's active source root, such as system/quests. Existing callers resolve the replacement through the same stable object id. Host administration code should use this operation only for shared service or content objects whose own reload policy is safe; it is intentionally not exposed as an unauthenticated player transport command.

      Parameters:
      objectPath - mudlib-relative LPC object id, with or without a .c suffix
      Returns:
      handle for the newly compiled shared object
      Throws:
      IllegalArgumentException - if the path is blank or escapes the active mudlib root
    • attachPersona

      public InstancePersona attachPersona(PrintWriter out, String remoteAddress)
      Queues attachment to this mudlib before delivering player input.
      Specified by:
      attachPersona in interface InstanceHost
    • bindClientProtocolSink

      public void bindClientProtocolSink(InstancePersona persona, BiConsumer<String,String> protocolOutputSink)
      Queues the transport output binding for a selected persona.
      Specified by:
      bindClientProtocolSink in interface InstanceHost
    • setClientProtocolEnabled

      public void setClientProtocolEnabled(InstancePersona persona, String protocol, boolean enabled)
      Queues a client protocol state change.
      Specified by:
      setClientProtocolEnabled in interface InstanceHost
    • receiveClientProtocolMessage

      public void receiveClientProtocolMessage(InstancePersona persona, String protocol, String message)
      Queues a decoded client protocol message.
      Specified by:
      receiveClientProtocolMessage in interface InstanceHost
    • detachPersona

      public void detachPersona(InstancePersona persona)
      Queues session detachment after prior world work.
      Specified by:
      detachPersona in interface InstanceHost
    • dispatch

      public void dispatch(InstancePersona persona, PrintWriter out, String commandLine)
      Delivers input on the world queue; mudlib command results stay inside the instance.
      Specified by:
      dispatch in interface InstanceHost
    • printPromptIfReady

      public void printPromptIfReady(InstancePersona persona, PrintWriter out)
      Queues prompt delivery after preceding world work.
      Specified by:
      printPromptIfReady in interface InstanceHost
    • isCapturingInput

      public boolean isCapturingInput(InstancePersona persona)
      Reads input capture state in order with world work.
      Specified by:
      isCapturingInput in interface InstanceHost
    • isCapturingNoEchoInput

      public boolean isCapturingNoEchoInput(InstancePersona persona)
      Reads hidden-input state in order with world work.
      Specified by:
      isCapturingNoEchoInput in interface InstanceHost
    • isAttached

      public boolean isAttached(InstancePersona persona)
      Reads attachment state in order with world work.
      Specified by:
      isAttached in interface InstanceHost
    • gameId

      public String gameId()
      Returns the unique identity used in the engine menu and administration.
    • gameName

      public String gameName()
      Returns the display name shown in the engine mudlib menu.
    • mudlibRoot

      public Path mudlibRoot()
      Specified by:
      mudlibRoot in interface InstanceHost
    • bootResult

      public MudlibBootResult bootResult()
      Specified by:
      bootResult in interface InstanceHost
    • worldTickInterval

      public Duration worldTickInterval()
      Specified by:
      worldTickInterval in interface InstanceHost
    • transportControlPrefix

      public String transportControlPrefix()
      Description copied from interface: InstanceHost
      Prefix that escapes a line into transport control rather than mudlib command dispatch.
      Specified by:
      transportControlPrefix in interface InstanceHost