Add more information to debugpaste

This commit is contained in:
N0tMyFaultOG 2020-10-04 18:19:29 +02:00
parent e6237d68d0
commit a210f523a5
4 changed files with 24 additions and 24 deletions

View File

@ -87,7 +87,7 @@
<dependency> <dependency>
<groupId>be.maximvdw</groupId> <groupId>be.maximvdw</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId> <artifactId>MVdWPlaceholderAPI</artifactId>
<version>3.1.1-SNAPSHOT</version> <version>3.1.1</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

View File

@ -1149,14 +1149,21 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
return new BukkitPlotGenerator(world, generator); return new BukkitPlotGenerator(world, generator);
} }
@Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() { @Override public String getPluginList() {
List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>(); StringBuilder msg = new StringBuilder();
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(), msg.append("Plugins (").append(plugins.length).append("): \n");
plugin.getDescription().getVersion()); for (Plugin p : plugins) {
names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); 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() { @Override public Actor getConsole() {

View File

@ -282,7 +282,7 @@ public interface IPlotMain<P> extends ILogger {
*/ */
@NotNull IndependentPlotGenerator getDefaultGenerator(); @NotNull IndependentPlotGenerator getDefaultGenerator();
List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds(); String getPluginList();
Actor getConsole(); Actor getConsole();

View File

@ -91,28 +91,21 @@ public class DebugPaste extends SubCommand {
.append("\n"); .append("\n");
b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';')
.append(!Settings.UUID.OFFLINE).append('\n'); .append(!Settings.UUID.OFFLINE).append('\n');
b.append("Plugins:"); b.append(PlotSquared.get().IMP.getPluginList());
for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared
.get().IMP.getPluginIds()) {
Map.Entry<String, String> 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("\n\n# YAY! Now, let's see what we can find in your JVM\n"); b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
b.append("Uptime: ").append( b.append("Uptime: ")
TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes") .append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS))
.append(" minutes")
.append('\n'); .append('\n');
b.append("JVM Flags: ").append(rb.getInputArguments()).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'); .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'); .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("Available Processors: ").append(runtime.availableProcessors()).append('\n');
b.append("Java Name: ").append(rb.getVmName()).append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n');
b.append("Java Version: '").append(System.getProperty("java.version")) b.append("Java Version: '").append(System.getProperty("java.version"))