Add exception reporting event

This commit is contained in:
Zach Brown
2016-02-29 20:24:35 -06:00
parent b007bb8264
commit 7c31d0a39b
12 changed files with 430 additions and 9 deletions

View File

@@ -0,0 +1,37 @@
package com.destroystokyo.paper.exception;
import org.bukkit.scheduler.BukkitTask;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Thrown when a plugin's scheduler fails with an exception
*/
public class ServerSchedulerException extends ServerPluginException {
private final BukkitTask task;
public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
super(message, cause, task.getOwner());
this.task = checkNotNull(task, "task");
}
public ServerSchedulerException(Throwable cause, BukkitTask task) {
super(cause, task.getOwner());
this.task = checkNotNull(task, "task");
}
protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
this.task = checkNotNull(task, "task");
}
/**
* Gets the task which threw the exception
*
* @return exception throwing task
*/
public BukkitTask getTask() {
return task;
}
}