Interface ClientCommands
public interface ClientCommands
Server commands to clients, the reply channel to
ClientCommandEvent: a client receives
them in Lua's Events.OnServerCommand(module, command, args). Together, a Java mod on the
server and a Lua mod on the client exchange commands while players keep the official client.
args becomes a Lua table: keys are String or a Number (sent as a
Lua number), values are String, Number, Boolean, a nested Map, a
List (a Lua array, indexed from 1), or a game object that Project Zomboid sends with
commands (see ClientCommandEvent). null keys or values, and cycles, are not
allowed. An empty map sends no arguments; the client then receives nil.
The methods can be called on any thread. The arguments are checked at once; the command is sent on the main thread, at once when called there, otherwise with the mod's queued main-thread tasks.
-
Method Summary
-
Method Details
-
send
Sends a command toplayer. Nothing is sent when the player is no longer connected.- Throws:
IllegalArgumentException- whenargscontains a key or value that cannot be sent
-
sendToAll
Sends a command to every connected client.- Throws:
IllegalArgumentException- whenargscontains a key or value that cannot be sent
-