Class ClientCommandEvent

java.lang.Object
dev.overlord.zomboidforge.api.ClientCommandEvent
All Implemented Interfaces:
Cancellable, Event, MainThreadEvent

public final class ClientCommandEvent extends Object implements MainThreadEvent, Cancellable
A client command arrived: a client called Lua's sendClientCommand(module, command, args). Posted on the main thread for every client command, including those of Project Zomboid and of Lua mods, so listeners filter by module().

Default action: Project Zomboid passes the command to Lua's Events.OnClientCommand. cancel() prevents that, for example when a Java mod handles the module itself.

args() is the Lua table converted to Java: keys are String or Double (Lua arrays have the keys 1.0, 2.0, ...), values are String, Double, Boolean, a nested Map of the same kind, or a game object that Project Zomboid sends with commands (in Build 42 an inventory item, an IsoDirections, or a dead body). The maps cannot be modified.

  • Constructor Details

    • ClientCommandEvent

      public ClientCommandEvent(PlayerRef player, String module, String command, Map<Object,Object> args)
      Parameters:
      args - the converted arguments; empty when the client sent none
  • Method Details