this.session = session;
}
@Override
public void uncaughtException(Message message, MessageHandler<?> handle, Exception ex) {
Player player = session.getPlayer();
player.getEngine().getLogger().log(Level.SEVERE, "Message handler for " + message.getClass().getSimpleName() + " threw exception for player " + (session.getPlayer() != null ? session.getPlayer().getName() : "null"));
ex.printStackTrace();
if (player.hasPermission("vanilla.exception.paste")) {
StringBuilder builder = new StringBuilder("Vanilla Error Report:\n");
builder.append("( Please submit this report to http://spout.in/issues )\n");
builder.append(" Version: ").append(VanillaPlugin.getInstance().getDescription().getVersion()).append("\n");
builder.append("----------------------------------------------------------------------").append("\n");
builder.append("Stack Trace:").append("\n");
builder.append(" Exception: ").append(ex.getClass().getSimpleName()).append("\n");
logTrace(builder, ex);
Runnable task = new PasteRunnable(session, builder.toString(), "Message handler exception for " + message.getClass().getSimpleName());
player.getEngine().getScheduler().scheduleAsyncDelayedTask(VanillaPlugin.getInstance(), task, 0, TaskPriority.CRITICAL);
} else {
session.disconnect("Message handler exception for " + message.getClass().getSimpleName());
}
}