Fix debugpaste split

This commit is contained in:
Jesse Boyd 2019-11-25 22:38:03 +00:00
parent bf02c9fe5f
commit a65d546f3b
No known key found for this signature in database
GPG key ID: 59F1DE6293AF6E1F
3 changed files with 10 additions and 6 deletions

View file

@ -92,10 +92,12 @@ import org.jetbrains.annotations.Nullable;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.AbstractMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
@ -818,11 +820,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitPlotGenerator(generator); return new BukkitPlotGenerator(generator);
} }
@Override public List<String> getPluginIds() { @Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() {
final List<String> names = new ArrayList<>(); List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>();
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion());
.isEnabled()); names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled()));
} }
return names; return names;
} }

View file

@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IPlotMain extends ILogger { public interface IPlotMain extends ILogger {
@ -244,7 +245,7 @@ public interface IPlotMain extends ILogger {
*/ */
@NotNull IndependentPlotGenerator getDefaultGenerator(); @NotNull IndependentPlotGenerator getDefaultGenerator();
List<String> getPluginIds(); List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds();
Actor getConsole(); Actor getConsole();
} }

View file

@ -21,6 +21,7 @@ import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean; import java.lang.management.RuntimeMXBean;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
@ -54,7 +55,7 @@ public class DebugPaste extends SubCommand {
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
.append(!Settings.UUID.OFFLINE).append('\n'); .append(!Settings.UUID.OFFLINE).append('\n');
b.append("Plugins:"); b.append("Plugins:");
for (String id : PlotSquared.get().IMP.getPluginIds()) { for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) {
String[] split = id.split(":"); String[] split = id.split(":");
String[] split2 = split[0].split(";"); String[] split2 = split[0].split(";");
String enabled = split.length == 2 ? split[1] : "unknown"; String enabled = split.length == 2 ? split[1] : "unknown";