From a210f523a5a74e42725e6a928ef9b7df658b926f Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Sun, 4 Oct 2020 18:19:29 +0200 Subject: [PATCH] Add more information to debugpaste --- Bukkit/pom.xml | 2 +- .../com/plotsquared/bukkit/BukkitMain.java | 21 +++++++++++------ .../java/com/plotsquared/core/IPlotMain.java | 2 +- .../plotsquared/core/command/DebugPaste.java | 23 +++++++------------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index 04de1ebca..7c288d6da 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -87,7 +87,7 @@ be.maximvdw MVdWPlaceholderAPI - 3.1.1-SNAPSHOT + 3.1.1 compile diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index e3f9f05da..c28c38995 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -1149,14 +1149,21 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< return new BukkitPlotGenerator(world, generator); } - @Override public List, Boolean>> getPluginIds() { - List, Boolean>> names = new ArrayList<>(); - for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { - Map.Entry id = new AbstractMap.SimpleEntry<>(plugin.getName(), - plugin.getDescription().getVersion()); - names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); + @Override public String getPluginList() { + StringBuilder msg = new StringBuilder(); + Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); + msg.append("Plugins (").append(plugins.length).append("): \n"); + for (Plugin p : plugins) { + msg.append(" - ").append(p.getName()).append(":").append("\n") + .append(" • Version: ").append(p.getDescription().getVersion()).append("\n") + .append(" • Enabled: ").append(p.isEnabled()).append("\n") + .append(" • Main: ").append(p.getDescription().getMain()).append("\n") + .append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n") + .append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n") + .append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n") + .append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n"); } - return names; + return msg.toString(); } @Override public Actor getConsole() { diff --git a/Core/src/main/java/com/plotsquared/core/IPlotMain.java b/Core/src/main/java/com/plotsquared/core/IPlotMain.java index 190457ef3..2ac8910f3 100644 --- a/Core/src/main/java/com/plotsquared/core/IPlotMain.java +++ b/Core/src/main/java/com/plotsquared/core/IPlotMain.java @@ -282,7 +282,7 @@ public interface IPlotMain

extends ILogger { */ @NotNull IndependentPlotGenerator getDefaultGenerator(); - List, Boolean>> getPluginIds(); + String getPluginList(); Actor getConsole(); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index 299f6ddfa..3928b9fff 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -91,28 +91,21 @@ public class DebugPaste extends SubCommand { .append("\n"); b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); - b.append("Plugins:"); - for (Map.Entry, Boolean> pluginInfo : PlotSquared - .get().IMP.getPluginIds()) { - Map.Entry nameVersion = pluginInfo.getKey(); - String name = nameVersion.getKey(); - String version = nameVersion.getValue(); - boolean enabled = pluginInfo.getValue(); - b.append("\n ").append(name).append(":\n ").append("version: '") - .append(version).append('\'').append("\n enabled: ").append(enabled); - } + b.append(PlotSquared.get().IMP.getPluginList()); b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); - b.append("Uptime: ").append( - TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes") + b.append("Uptime: ") + .append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS)) + .append(" minutes") .append('\n'); b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n'); - b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB") + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024).append(" MB") .append('\n'); - b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB") + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024).append(" MB") + .append('\n'); + b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024).append(" MB") .append('\n'); - b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Available Processors: ").append(runtime.availableProcessors()).append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n'); b.append("Java Version: '").append(System.getProperty("java.version"))