CommandsCompat

Cross-version seam for Commands#performPrefixedCommand(CommandSourceStack, String).

Renamed at 1.19 (performCommand(CommandSourceStack, String) ->performPrefixedCommand(...)) and its return went int ->void at the 1.20.2 command-execution rewrite — both INSIDE the 1.18.2 node's declared [1.18.2, 1.20.5), so no single compiled call site spans it. Bind reflectively, discard the return.

Matched by parameter types, not name: name strings aren't reobf'd (so "performPrefixedCommand" stays mojmap and misses on Fabric intermediary / Forge Mixed-SRG), while the parameter Class references are. 1.18.2's pre-rename performCommand carries the identical signature, so one match spans the rename too. The return type is excluded from the match — it is exactly what differs across the range.

On vanilla the parameter types pick out one method. A hybrid server adds CraftBukkit's dispatchServerCommand beside it, with the same ones, and that one drops op, ban, stop and the rest of a fixed list without running them. So where more than one matches, the vanilla name decides, through Mappings.

Properties

Link copied to clipboard
private val byName: Method?

The candidate with the vanilla name, or null — logged. Read only once names resolve: before that every runtime name misses, and the lazy would keep the miss.

Link copied to clipboard
private val candidates: List<Method>

Every Commands method taking (CommandSourceStack, String). Empty if this runtime has none, or if resolution failed to link.

Link copied to clipboard
private val NAMES: List<String>

The vanilla names: 1.19+, then 1.18.2's. From 1.19 performCommand takes a ParseResults, which the parameter match already rules out.

Functions

Link copied to clipboard
private fun method(): Method?

The one candidate; where a hybrid added more, the vanilla one — null until names resolve.

Link copied to clipboard
fun performPrefixedCommand(commands: Commands, source: CommandSourceStack, command: String): Boolean

Invoke performPrefixedCommand(source, command) on commands, discarding its version-dependent return value. command is passed through as-is (the vanilla method tolerates a leading / either way).