Interface Commands
@NonExtendable
public interface Commands
Registration of admin commands. A registered command works wherever Project Zomboid's own
admin commands work: in the in-game chat (
/name), the server console, and RCON. It
is looked up after the commands of Project Zomboid and runs on the main thread.
A command is a class of the running Project Zomboid version's command framework, so a mod
that registers commands declares game versions in mod.toml. In Build 42 it is
a public, non-abstract subclass of zombie.commands.CommandBase with:
- one public constructor
(String username, Role role, String command, UdpConnection connection), which passes its arguments tosuper; - at least one
@CommandName; names consist of letters, digits, and_, and differ (ignoring case) from every name of Project Zomboid and of other mods; - at least one
@RequiredCapability; Project Zomboid refuses to run a command without one; - optionally
@CommandArgs(argument patterns) and@CommandHelp(help <name>and thehelplist).
Command(), whose
result is the reply.-
Method Summary
-
Method Details
-
register
Registerscommand. Only on the main thread while the mod loads: in the entry point's constructor orMod.onLoad(). Classes annotated withRegisterCommandare registered without this call.- Throws:
IllegalArgumentException- whencommanddoes not meet the rules above, or is registered alreadyIllegalStateException- when called later or on another thread
-