--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -7,10 +7,10 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.concurrent.CompletionException;
@@ -20,6 +20,7 @@
 import org.slf4j.Logger;
 
 public class CrashReport {
+
     private static final Logger LOGGER = LogUtils.getLogger();
     private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
     private final String title;
@@ -31,8 +32,10 @@
     private final SystemReport systemReport = new SystemReport();
 
     public CrashReport(String message, Throwable cause) {
+        io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper
         this.title = message;
         this.exception = cause;
+        this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.v1_19_R2.CraftCrashReport()); // CraftBukkit
     }
 
     public String getTitle() {
@@ -44,31 +47,40 @@
     }
 
     public String getDetails() {
-        StringBuilder stringBuilder = new StringBuilder();
-        this.getDetails(stringBuilder);
-        return stringBuilder.toString();
+        StringBuilder stringbuilder = new StringBuilder();
+
+        this.getDetails(stringbuilder);
+        return stringbuilder.toString();
     }
 
     public void getDetails(StringBuilder crashReportBuilder) {
         if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) {
-            this.uncategorizedStackTrace = ArrayUtils.subarray((StackTraceElement[])this.details.get(0).getStacktrace(), 0, 1);
+            this.uncategorizedStackTrace = (StackTraceElement[]) ArrayUtils.subarray(((CrashReportCategory) this.details.get(0)).getStacktrace(), 0, 1);
         }
 
         if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
             crashReportBuilder.append("-- Head --\n");
             crashReportBuilder.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
             crashReportBuilder.append("Stacktrace:\n");
+            StackTraceElement[] astacktraceelement = this.uncategorizedStackTrace;
+            int i = astacktraceelement.length;
 
-            for(StackTraceElement stackTraceElement : this.uncategorizedStackTrace) {
-                crashReportBuilder.append("\t").append("at ").append((Object)stackTraceElement);
+            for (int j = 0; j < i; ++j) {
+                StackTraceElement stacktraceelement = astacktraceelement[j];
+
+                crashReportBuilder.append("\t").append("at ").append(stacktraceelement);
                 crashReportBuilder.append("\n");
             }
 
             crashReportBuilder.append("\n");
         }
 
-        for(CrashReportCategory crashReportCategory : this.details) {
-            crashReportCategory.getDetails(crashReportBuilder);
+        Iterator iterator = this.details.iterator();
+
+        while (iterator.hasNext()) {
+            CrashReportCategory crashreportsystemdetails = (CrashReportCategory) iterator.next();
+
+            crashreportsystemdetails.getDetails(crashReportBuilder);
             crashReportBuilder.append("\n\n");
         }
 
@@ -76,57 +88,60 @@
     }
 
     public String getExceptionMessage() {
-        StringWriter stringWriter = null;
-        PrintWriter printWriter = null;
-        Throwable throwable = this.exception;
-        if (throwable.getMessage() == null) {
-            if (throwable instanceof NullPointerException) {
-                throwable = new NullPointerException(this.title);
-            } else if (throwable instanceof StackOverflowError) {
-                throwable = new StackOverflowError(this.title);
-            } else if (throwable instanceof OutOfMemoryError) {
-                throwable = new OutOfMemoryError(this.title);
+        StringWriter stringwriter = null;
+        PrintWriter printwriter = null;
+        Object object = this.exception;
+
+        if (((Throwable) object).getMessage() == null) {
+            if (object instanceof NullPointerException) {
+                object = new NullPointerException(this.title);
+            } else if (object instanceof StackOverflowError) {
+                object = new StackOverflowError(this.title);
+            } else if (object instanceof OutOfMemoryError) {
+                object = new OutOfMemoryError(this.title);
             }
 
-            throwable.setStackTrace(this.exception.getStackTrace());
+            ((Throwable) object).setStackTrace(this.exception.getStackTrace());
         }
 
-        String var4;
+        String s;
+
         try {
-            stringWriter = new StringWriter();
-            printWriter = new PrintWriter(stringWriter);
-            throwable.printStackTrace(printWriter);
-            var4 = stringWriter.toString();
+            stringwriter = new StringWriter();
+            printwriter = new PrintWriter(stringwriter);
+            ((Throwable) object).printStackTrace(printwriter);
+            s = stringwriter.toString();
         } finally {
-            IOUtils.closeQuietly((Writer)stringWriter);
-            IOUtils.closeQuietly((Writer)printWriter);
+            IOUtils.closeQuietly(stringwriter);
+            IOUtils.closeQuietly(printwriter);
         }
 
-        return var4;
+        return s;
     }
 
     public String getFriendlyReport() {
-        StringBuilder stringBuilder = new StringBuilder();
-        stringBuilder.append("---- Minecraft Crash Report ----\n");
-        stringBuilder.append("// ");
-        stringBuilder.append(getErrorComment());
-        stringBuilder.append("\n\n");
-        stringBuilder.append("Time: ");
-        stringBuilder.append(DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
-        stringBuilder.append("\n");
-        stringBuilder.append("Description: ");
-        stringBuilder.append(this.title);
-        stringBuilder.append("\n\n");
-        stringBuilder.append(this.getExceptionMessage());
-        stringBuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
+        StringBuilder stringbuilder = new StringBuilder();
 
-        for(int i = 0; i < 87; ++i) {
-            stringBuilder.append("-");
+        stringbuilder.append("---- Minecraft Crash Report ----\n");
+        stringbuilder.append("// ");
+        stringbuilder.append(CrashReport.getErrorComment());
+        stringbuilder.append("\n\n");
+        stringbuilder.append("Time: ");
+        stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
+        stringbuilder.append("\n");
+        stringbuilder.append("Description: ");
+        stringbuilder.append(this.title);
+        stringbuilder.append("\n\n");
+        stringbuilder.append(this.getExceptionMessage());
+        stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
+
+        for (int i = 0; i < 87; ++i) {
+            stringbuilder.append("-");
         }
 
-        stringBuilder.append("\n\n");
-        this.getDetails(stringBuilder);
-        return stringBuilder.toString();
+        stringbuilder.append("\n\n");
+        this.getDetails(stringbuilder);
+        return stringbuilder.toString();
     }
 
     public File getSaveFile() {
@@ -141,22 +156,25 @@
                 file.getParentFile().mkdirs();
             }
 
-            Writer writer = null;
+            OutputStreamWriter outputstreamwriter = null;
+
+            boolean flag;
 
-            boolean var4;
             try {
-                writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
-                writer.write(this.getFriendlyReport());
+                outputstreamwriter = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
+                outputstreamwriter.write(this.getFriendlyReport());
                 this.saveFile = file;
-                return true;
-            } catch (Throwable var8) {
-                LOGGER.error("Could not save crash report to {}", file, var8);
-                var4 = false;
+                boolean flag1 = true;
+
+                return flag1;
+            } catch (Throwable throwable) {
+                CrashReport.LOGGER.error("Could not save crash report to {}", file, throwable);
+                flag = false;
             } finally {
-                IOUtils.closeQuietly(writer);
+                IOUtils.closeQuietly(outputstreamwriter);
             }
 
-            return var4;
+            return flag;
         }
     }
 
@@ -169,60 +187,64 @@
     }
 
     public CrashReportCategory addCategory(String name, int ignoredStackTraceCallCount) {
-        CrashReportCategory crashReportCategory = new CrashReportCategory(name);
+        CrashReportCategory crashreportsystemdetails = new CrashReportCategory(name);
+
         if (this.trackingStackTrace) {
-            int i = crashReportCategory.fillInStackTrace(ignoredStackTraceCallCount);
-            StackTraceElement[] stackTraceElements = this.exception.getStackTrace();
-            StackTraceElement stackTraceElement = null;
-            StackTraceElement stackTraceElement2 = null;
-            int j = stackTraceElements.length - i;
-            if (j < 0) {
-                System.out.println("Negative index in crash report handler (" + stackTraceElements.length + "/" + i + ")");
+            int j = crashreportsystemdetails.fillInStackTrace(ignoredStackTraceCallCount);
+            StackTraceElement[] astacktraceelement = this.exception.getStackTrace();
+            StackTraceElement stacktraceelement = null;
+            StackTraceElement stacktraceelement1 = null;
+            int k = astacktraceelement.length - j;
+
+            if (k < 0) {
+                System.out.println("Negative index in crash report handler (" + astacktraceelement.length + "/" + j + ")");
             }
 
-            if (stackTraceElements != null && 0 <= j && j < stackTraceElements.length) {
-                stackTraceElement = stackTraceElements[j];
-                if (stackTraceElements.length + 1 - i < stackTraceElements.length) {
-                    stackTraceElement2 = stackTraceElements[stackTraceElements.length + 1 - i];
+            if (astacktraceelement != null && 0 <= k && k < astacktraceelement.length) {
+                stacktraceelement = astacktraceelement[k];
+                if (astacktraceelement.length + 1 - j < astacktraceelement.length) {
+                    stacktraceelement1 = astacktraceelement[astacktraceelement.length + 1 - j];
                 }
             }
 
-            this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement2);
-            if (stackTraceElements != null && stackTraceElements.length >= i && 0 <= j && j < stackTraceElements.length) {
-                this.uncategorizedStackTrace = new StackTraceElement[j];
-                System.arraycopy(stackTraceElements, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
+            this.trackingStackTrace = crashreportsystemdetails.validateStackTrace(stacktraceelement, stacktraceelement1);
+            if (astacktraceelement != null && astacktraceelement.length >= j && 0 <= k && k < astacktraceelement.length) {
+                this.uncategorizedStackTrace = new StackTraceElement[k];
+                System.arraycopy(astacktraceelement, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
             } else {
                 this.trackingStackTrace = false;
             }
         }
 
-        this.details.add(crashReportCategory);
-        return crashReportCategory;
+        this.details.add(crashreportsystemdetails);
+        return crashreportsystemdetails;
     }
 
     private static String getErrorComment() {
-        String[] strings = new String[]{"Who set us up the TNT?", "Everything's going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I'm sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don't be sad. I'll do better next time, I promise!", "Don't be sad, have a hug! <3", "I just don't know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn't worry myself about that.", "I bet Cylons wouldn't have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I'm Minecraft, and I'm a crashaholic.", "Ooh. Shiny.", "This doesn't make any sense!", "Why is it breaking :(", "Don't do that.", "Ouch. That hurt :(", "You're mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!", "But it works on my machine."};
+        String[] astring = new String[]{"Who set us up the TNT?", "Everything's going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I'm sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don't be sad. I'll do better next time, I promise!", "Don't be sad, have a hug! <3", "I just don't know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn't worry myself about that.", "I bet Cylons wouldn't have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I'm Minecraft, and I'm a crashaholic.", "Ooh. Shiny.", "This doesn't make any sense!", "Why is it breaking :(", "Don't do that.", "Ouch. That hurt :(", "You're mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!", "But it works on my machine."};
 
         try {
-            return strings[(int)(Util.getNanos() % (long)strings.length)];
-        } catch (Throwable var2) {
+            return astring[(int) (Util.getNanos() % (long) astring.length)];
+        } catch (Throwable throwable) {
             return "Witty comment unavailable :(";
         }
     }
 
     public static CrashReport forThrowable(Throwable cause, String title) {
-        while(cause instanceof CompletionException && cause.getCause() != null) {
+        if (cause instanceof ThreadDeath) com.destroystokyo.paper.util.SneakyThrow.sneaky(cause); // Paper
+        while (cause instanceof CompletionException && cause.getCause() != null) {
             cause = cause.getCause();
         }
 
-        CrashReport crashReport;
+        CrashReport crashreport;
+
         if (cause instanceof ReportedException) {
-            crashReport = ((ReportedException)cause).getReport();
+            crashreport = ((ReportedException) cause).getReport();
         } else {
-            crashReport = new CrashReport(title, cause);
+            crashreport = new CrashReport(title, cause);
         }
 
-        return crashReport;
+        return crashreport;
     }
 
     public static void preload() {
