mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-27 03:17:45 +01:00
Use stream to get size padding
This commit is contained in:
parent
0e0e36476a
commit
0be6b721cf
@ -139,14 +139,9 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
)
|
)
|
||||||
.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(" ")
|
||||||
@ -197,13 +192,10 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
|
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
|
||||||
.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