1
0
forked from xjboss/KCauldronX

Add plugins info in crash report

This commit is contained in:
Sergey Shatunov 2016-02-02 16:50:16 +07:00
parent f1936a41c2
commit 3359c026df

View File

@ -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<String>() {
+ @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<String>() {
+ @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()
{