mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Merge pull request #801 from PlaceholderAPI/fix/papi-dump-expansion-order
This commit is contained in:
commit
794c8890e5
@ -106,7 +106,6 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try (final InputStream stream = connection.getInputStream()) {
|
try (final InputStream stream = connection.getInputStream()) {
|
||||||
//noinspection UnstableApiUsage
|
|
||||||
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||||
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
||||||
}
|
}
|
||||||
@ -134,18 +133,15 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
|
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
|
||||||
.getExpansions()
|
.getExpansions()
|
||||||
.stream()
|
.stream()
|
||||||
.sorted(Comparator.comparing(PlaceholderExpansion::getIdentifier))
|
.sorted(
|
||||||
.sorted(Comparator.comparing(PlaceholderExpansion::getAuthor))
|
Comparator.comparing(PlaceholderExpansion::getIdentifier)
|
||||||
|
.thenComparing(PlaceholderExpansion::getAuthor)
|
||||||
|
)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
int size = 0;
|
int size = expansions.stream().map(e -> e.getIdentifier().length())
|
||||||
|
.max(Integer::compareTo)
|
||||||
for (final String name : expansions.stream().map(PlaceholderExpansion::getIdentifier)
|
.orElse(0);
|
||||||
.collect(Collectors.toList())) {
|
|
||||||
if (name.length() > size) {
|
|
||||||
size = name.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final PlaceholderExpansion expansion : expansions) {
|
for (final PlaceholderExpansion expansion : expansions) {
|
||||||
builder.append(" ")
|
builder.append(" ")
|
||||||
@ -167,10 +163,15 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
.getExpansionsFolder()
|
.getExpansionsFolder()
|
||||||
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
|
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
|
||||||
|
|
||||||
for (final String jar : jars) {
|
|
||||||
builder.append(" ")
|
if (jars == null) {
|
||||||
.append(jar)
|
builder.append(" ¨[Warning]: Could not load jar files from expansions folder.");
|
||||||
.append('\n');
|
} else {
|
||||||
|
for (final String jar : jars) {
|
||||||
|
builder.append(" ")
|
||||||
|
.append(jar)
|
||||||
|
.append('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append('\n');
|
builder.append('\n');
|
||||||
@ -192,12 +193,9 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
.sorted(Comparator.comparing(Plugin::getName))
|
.sorted(Comparator.comparing(Plugin::getName))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (final String pluginName : plugins.stream().map(Plugin::getName)
|
size = plugins.stream().map(pl -> pl.getName().length())
|
||||||
.collect(Collectors.toList())) {
|
.max(Integer::compareTo)
|
||||||
if (pluginName.length() > size) {
|
.orElse(0);
|
||||||
size = pluginName.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Plugin other : plugins) {
|
for (final Plugin other : plugins) {
|
||||||
builder.append(" ")
|
builder.append(" ")
|
||||||
|
Loading…
Reference in New Issue
Block a user