PaperCommandRunner

internal object PaperCommandRunner

The plugin-side run_command target=server, standing in for the mod path's CommandRunner. Same shape — console-level source, feedback captured instead of printed — but built from Bukkit API only, because Paper's runtime is spigot-named below 1.20.5 and the mojmap NMS path would not link there.

Properties

Link copied to clipboard
private const val CAPTURE_WINDOW_MS: Long = 500

How long feedback is collected after the commands go out. Not zero: a plugin command that answers from an async task replies a tick later at the earliest.

Link copied to clipboard
private const val NOTE: String

Prefix on every line THIS class inserts, as the mod path does, so a reader can tell our notes from real command feedback, which is never prefixed.

Link copied to clipboard
private val plugin: JavaPlugin

Functions

Link copied to clipboard
private fun dispatchOnServerThread(dispatch: Runnable): String?

Hand dispatch to the server thread, wait for it to run, then hold the capture window open. Split from run because scheduling is not command semantics: everything here is about GETTING to the server thread, and none of it varies with what the commands are.

Link copied to clipboard
fun run(command: String): String

Run command — possibly multiple lines, executed in order like a .mcfunction — on the server thread and return the captured feedback. Blank lines and # comments are skipped, a failing line does not stop the rest. Never throws: returns an explanatory string on any failure.