The entire event system in Mixson revolves around using the EventContext. Each subsection of the wiki page will detail
a method and its purpose. Note that the generic type of T refers to the type of the resource the event is targeting.
getFile
T getFile();
Returns: a modifiable JsonElement of the resource the event is targeting.
setFile
void setFile(T file);
Parameter "file": the file to overwrite the existing resource in the context.
getIndex
Index getIndex();
Returns: the Index of the resource the event is targeting.
getEventName
String getEventName();
Returns: a String of the eventName given to the event during registration.
getEventUUID
UUID getEventUUID();
Returns: the UUID of the event running.
getPriority
int getPriority();
Returns: a int from the priority of the given event.
markForDeletion
void markForDeletion(boolean shouldDelete);
Parameter "shouldDelete": the shouldDelete is to be a boolean value stating if the resource being acted upon
should be deleted at the end of runtime. Proceeding calls to EventContext#markForDeletion override the previous calls.
createResource
void createResource(Index id, T elem);
Parameter "id": the id is to be the Index for the new resource. A MixsonException is thrown if the ordinal is
changed from -1 and the resource type does not support ordinals.
Parameter "elem": the elem is to be the newly created resource.
cancelFutureEvent
void cancelFutureEvent(UUID uuid);
Parameter "uuid": the UUID of the event to be canceled for the given runtime.
pullIntoRuntime
void pullIntoRuntime(UUID uuid);
Parameter "uuid": the UUID of the event to be pulled into the runtime. Any event that still has a valid lifetime
will run if pulled. Pulling events is the only way to execute events with a deferred lifetime.
captureFiles
List<Mutable<T>> captureFiles(Index id);
Parameter "id": the id is to be the Index of the resource to be captured.
Returns: a List of Mutable<T>. Each Mutable<T> contains a captured resource. If any Mutable<T> is set to
hold a value of null, then a MixsonException will be thrown. If the error policy is set to Log, then Mutable<T>s
could be returned with a null value. Mutable<T>s with a null value are not tracked by the runtime, so any changes
will not be saved.
setDebugExport
void setDebugExport(T result);
Parameter "result": the result is the file that will be exported if the DebugOption EXPORT_PATCHED_FILE is
enabled. If the method is not called, the event will default to the file in the context.
cancelDebugExport
void cancelDebugExport();
Stops any files from being exported, even if the DebugOption EXPORT_PATCHED_FILE is enabled.