Class ScriptExceptionEvent

java.lang.Object
org.bukkit.event.Event
dev.magicmq.pyspigot.bukkit.event.ScriptEvent
dev.magicmq.pyspigot.bukkit.event.ScriptExceptionEvent

public class ScriptExceptionEvent extends ScriptEvent
Called when a script throws an unhandled error/exception. This event could be called asynchronously if the exception occurred in an asynchronous context. To check if the event is asynchronous, call Event.isAsynchronous()

The exception will be a PyException, which will include Java exceptions thrown by calls to Java code from scripts. Use Throwable.getCause() to determine if there was an underlying Java exception.

  • Constructor Details

    • ScriptExceptionEvent

      public ScriptExceptionEvent(dev.magicmq.pyspigot.manager.script.Script script, PyException exception, boolean async)
      Parameters:
      script - The script that caused the error/exception
      exception - The PyException that was thrown
      async - Whether the exception occurred in an asychronous context
  • Method Details

    • getException

      public PyException getException()
      Get the PyException that was thrown.
      Returns:
      The PyException that was thrown
    • doReportException

      public boolean doReportException()
      Get if the exception should be reported to console and/or a script's log file.
      Returns:
      True if the exception should be reported to console and/or a script's log file, false if otherwise
    • setReportException

      public void setReportException(boolean reportException)
      Set if the exception should be reported to console and/or the script's log file.
      Parameters:
      reportException - Whether the exception should be reported.
    • getHandlers

      public HandlerList getHandlers()
      Overrides:
      getHandlers in class ScriptEvent
    • getHandlerList

      public static HandlerList getHandlerList()