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,43 @@
package com.destroystokyo.paper.event.server;
import com.destroystokyo.paper.exception.ServerException;
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
* Called whenever an exception is thrown in a recoverable section of the server.
*/
@NullMarked
public class ServerExceptionEvent extends Event {
private static final HandlerList HANDLER_LIST = new HandlerList();
private final ServerException exception;
@ApiStatus.Internal
public ServerExceptionEvent(final ServerException exception) {
super(!Bukkit.isPrimaryThread());
this.exception = exception;
}
/**
* Gets the wrapped exception that was thrown.
*
* @return Exception thrown
*/
public ServerException getException() {
return this.exception;
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
public static HandlerList getHandlerList() {
return HANDLER_LIST;
}
}