Repository navigation
Player Input
inventivetalent edited this page May 17, 2016
·
1 revision
Additionally to the click function, you can request more input information for players.
The Cursor Position represents the x|y coordinate a player is looking at on a menu.
You can retrieve it by calling this function:
menu.getCursorPosition(player);Note that it can return null, which indicates that the specified players is
null- not online
- in a different world
- not looking at the menu
You can request a text input from players by calling this function:
menu.requestKeyboardInput(player, callback, [cancel]);-
callbackmust be a function. It will be called with the player's message. -
cancelspecifies whether the player's message will be cancelled from reaching the actual chat. Default totrue.
Similar to text input, you can also request commands from players by calling this function:
menu.requestCommandInput(player, callback, [cancel]);-
callbackmust be a function. It will be called with the executed command. -
cancelwhether the executed command will be cancelled. Defaults totrue.
Now, this is a bit more complicated.
You can request a player's movement actions by calling this function:
menu.requestMovementInput(player, callback, [cancel]);-
callbackfunction
function(type, amount, difference){}
* `type` is the direction (e.g. `forward`, `left`, `up`)
* `amount` is how much the player moved
* `difference` is the exact movement difference, containing `x`,`y`,`z`,`pitch`,`yaw`
-
callbackobject
{
forward: function(amount, difference) {
},
up: function(amount) {
},
pitch: function(amount) {
}
}