Class CustomEvent
java.lang.Object
net.md_5.bungee.api.plugin.Event
dev.magicmq.pyspigot.bungee.event.ScriptEvent
dev.magicmq.pyspigot.bungee.event.custom.CustomEvent
- All Implemented Interfaces:
net.md_5.bungee.api.plugin.Cancellable
A custom event that scripts may instantiate and call for other plugins/scripts to listen to.
-
Constructor Summary
ConstructorsConstructorDescriptionCustomEvent(String name, PyObject data) Note: This class should be instantiated from scripts only! -
Method Summary
Modifier and TypeMethodDescriptiongetData()Get the data attached to this event.<T> TgetDataAsType(Class<T> clazz) Attempt to convert the data attached to this event to a provided type.getDataAsType(String clazz) Attempt to convert the data attached to this event to a provided type.getName()Get the name of this event.booleanvoidsetCancelled(boolean cancelled) Methods inherited from class dev.magicmq.pyspigot.bungee.event.ScriptEvent
getScriptMethods inherited from class net.md_5.bungee.api.plugin.Event
postCall
-
Constructor Details
-
CustomEvent
Note: This class should be instantiated from scripts only!
- Parameters:
name- The name of the event being created. Can be used to create subtypes of the generic custom eventdata- The data to attach to the event
-
-
Method Details
-
getName
Get the name of this event.- Returns:
- The name of this event
-
getData
Get the data attached to this event.- Returns:
- The data attached to this event
-
getDataAsType
Attempt to convert the data attached to this event to a provided type.- Parameters:
clazz- The type that the data should be converted to- Returns:
- An object of the specified type representing the converted data
- Throws:
PyException- If the data could not be converted to the provided type
-
getDataAsType
Attempt to convert the data attached to this event to a provided type.- Type Parameters:
T- The type to which the data should be converted- Parameters:
clazz- The type that the data should be converted to- Returns:
- An object of the specified type representing the converted data
- Throws:
PyException- If the data could not be converted to the provided type
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfacenet.md_5.bungee.api.plugin.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfacenet.md_5.bungee.api.plugin.Cancellable
-