Home Migration Guide Getting Started With Scripts Commands Examples
BracketHandlers

MCEvent

The event is not cancelable.

The event does not have a result.

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.event.MCEvent;

Methods

Cancels the event. Same as setCanceled(true)

Return Type: void

script.zs
// MCEvent.cancel() as void
myMCEvent.cancel();

Return Type: boolean

script.zs
// MCEvent.hasResult() as boolean
myMCEvent.hasResult();

Return Type: boolean

script.zs
// MCEvent.isCancelable() as boolean
myMCEvent.isCancelable();

Return Type: boolean

script.zs
// MCEvent.isCanceled() as boolean
myMCEvent.isCanceled();

sets the event’s result to allow

Return Type: void

script.zs
// MCEvent.setAllow() as void
myMCEvent.setAllow();

Return Type: void

script.zs
MCEvent.setCanceled(cancel as boolean) as void
ParameterTypeDescription
Parameter
cancel
Type
boolean
Description
No Description Provided

sets the event’s result to default

Return Type: void

script.zs
// MCEvent.setDefault() as void
myMCEvent.setDefault();

sets the event’s result to deny

Return Type: void

script.zs
// MCEvent.setDeny() as void
myMCEvent.setDeny();

Properties

NameTypeHas GetterHas SetterDescription
Name
cancelable
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
canceled
Type
boolean
Has Getter
true
Has Setter
true
Description
No Description Provided
Name
hasResult
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided