Files

1.9 KiB

IScriptEvent.setValue

← IScriptEvent · ← Master

Parça 1/3 · sonraki

setValue(java.lang.String key, java.lang.Object value)

void Set a value for given key in extra data.

Method Detail getScript

java.lang.String getScript()

Get script's ID to which this event was passed to.

getFunction

java.lang.String getFunction()

Get script's function name.

getSubject

IScriptEntity getSubject()

Get subject (primary) entity that was passed into the event.

getObject

IScriptEntity getObject()

Get object (secondary) entity that was passed into the event.

getPlayer

IScriptPlayer getPlayer()

Get the first player from either subject or object (or null, if there is no player).

getNPC

IScriptNpc getNPC()

Get the first Mappet NPC from either subject or object (or null, if there is no NPC).

getWorld

IScriptWorld getWorld()

Get the world in which this event happened.

getServer

IScriptServer getServer()

Get the server in which this event happened.

getValues

java.util.Map<java.lang.String,java.lang.Object> getValues()

Get a map of extra context values that was passed into the event.

getValue

java.lang.Object getValue(java.lang.String key)

Get a value for given key (might be a null).

setValue

void setValue(java.lang.String key, java.lang.Object value)

Set a value for given key in extra data.

cancel

void cancel()

Cancel the trigger event.

Depending on the type of event, it can prevent the default behavior (for example for chat trigger, if you cancel it, it won't send the message into the chat).

// Assuming this script was attached to global trigger "On block placed," // this script will cancel placing of the block by a player function main(c) { if (c.getValue("block") === "minecraft:stone") { c.cancel(); } }