From 3359c026df552a437a47fa511f4947a3af35f6dc Mon Sep 17 00:00:00 2001 From: Sergey Shatunov Date: Tue, 2 Feb 2016 16:50:16 +0700 Subject: [PATCH] Add plugins info in crash report --- .../minecraft/crash/CrashReport.java.patch | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/patches/net/minecraft/crash/CrashReport.java.patch b/patches/net/minecraft/crash/CrashReport.java.patch index f24dff6..7f2ecb5 100644 --- a/patches/net/minecraft/crash/CrashReport.java.patch +++ b/patches/net/minecraft/crash/CrashReport.java.patch @@ -8,7 +8,7 @@ import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; -@@ -15,8 +16,11 @@ +@@ -15,12 +16,18 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.Callable; @@ -20,7 +20,14 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.logging.log4j.LogManager; -@@ -51,6 +55,12 @@ + import org.apache.logging.log4j.Logger; ++import org.bukkit.Bukkit; ++import org.bukkit.ChatColor; ++import org.bukkit.plugin.Plugin; + + public class CrashReport + { +@@ -51,6 +58,38 @@ return "1.7.10"; } }); @@ -29,6 +36,32 @@ + public String call() throws Exception { + return String.format("%s:%s:%s", KCauldron.getGroup(), KCauldron.getChannel(), KCauldron.getCurrentVersion()); + } ++ }); ++ this.theReportCategory.addCrashSectionCallable("Plugins", new Callable() { ++ @Override ++ public String call() throws Exception { ++ StringBuilder pluginList = new StringBuilder(); ++ Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); ++ for (Plugin plugin : plugins) { ++ if (pluginList.length() > 0) ++ pluginList.append(", "); ++ if (plugin.isEnabled()) pluginList.append(plugin.getDescription().getName()); ++ } ++ return pluginList.toString(); ++ } ++ }); ++ this.theReportCategory.addCrashSectionCallable("Disabled Plugins", new Callable() { ++ @Override ++ public String call() throws Exception { ++ StringBuilder pluginList = new StringBuilder(); ++ Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); ++ for (Plugin plugin : plugins) { ++ if (pluginList.length() > 0) ++ pluginList.append(", "); ++ if (!plugin.isEnabled()) pluginList.append(plugin.getDescription().getName()); ++ } ++ return pluginList.toString(); ++ } + }); this.theReportCategory.addCrashSectionCallable("Operating System", new Callable() {