player / bot Object
The player or bot object represents a real Minecraft client connected to the test server.
Methods
player.chat(message)
Sends a chat message or command.
string
required
The message or command to send.
player.gui(options)
Waits for a GUI to open matching the title and returns a live handle.
string | RegExp
required
Pattern to match GUI title.
player.makeOp()
Grants operator status to the player.
player.deOp()
Removes operator status from the player.
player.setGameMode(mode)
Changes the player’s game mode.
string
required
‘survival’ | ‘creative’ | ‘adventure’ | ‘spectator’
player.teleport(x, y, z)
Teleports the player to coordinates.
player.giveItem(item, count?)
Gives items to the player.
Properties
Inventory
Access the player’s current inventory state.
string
The randomly generated or assigned name of the bot.
server Object
The server object gives you control over the backend Minecraft server.
Methods
server.execute(command)
Executes a command from the server console.
string
required
The console command to execute.
Exported Utilities
The Plugwright framework exports several utility functions to help you write robust tests.createPlayer()
Creates a new, independent player bot that joins the server. Useful for multi-user tests.
sleep(ms)
Pauses execution for a specified number of milliseconds.
number
required
Milliseconds to sleep.
poll(fn, options?)
Repeatedly executes a function until it returns a value that is not undefined, and returns that value. Useful when you are waiting for an object or value to exist and need to extract it.
function
required
Function to poll.
number
Max wait time in ms (default: 5000ms).
number
Check interval in ms (default: 100ms).
waitForAssertion(fn, options?)
Executes an assertion function repeatedly until it passes or times out. Ideal for expect statements.
function
required
Assertion function.
waitUntil(predicate, options?)
Repeatedly executes a boolean function until it returns true. Useful when you simply want to pause execution until a condition is met, without extracting any data.
waitForStable(fn, options?)
Waits for a value returned by a function to remain unchanged for a specified duration. Useful for waiting for a UI to finish animating or loading.
function
required
Function to evaluate.
number
Time the value must remain stable in ms (default: 500ms).