Sort available enchantments alphabetically
This commit is contained in:
parent
2af028a074
commit
93a290cea6
@ -141,11 +141,14 @@ public class CommandHandler implements CommandExecutor
|
||||
BY_KEY_FIELD.setAccessible(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<NamespacedKey, Enchantment> byKey = (Map<NamespacedKey, Enchantment>) BY_KEY_FIELD.get(null);
|
||||
|
||||
StringBuilder sb = new StringBuilder("\nAvailable enchantments: \n");
|
||||
for (NamespacedKey key : byKey.keySet())
|
||||
sb.append(" - ").append(key.toString()).append("\n");
|
||||
final StringBuilder sb = new StringBuilder("\nAvailable enchantments: \n");
|
||||
byKey.keySet().stream()
|
||||
.map(NamespacedKey::toString).sorted()
|
||||
.forEach(name -> sb.append(" - ").append(name).append("\n"));
|
||||
|
||||
Bukkit.getLogger().info(sb.toString());
|
||||
}
|
||||
catch (NoSuchFieldException | IllegalAccessException e)
|
||||
|
Loading…
Reference in New Issue
Block a user