ae
This commit is contained in:
parent
3c1d06182c
commit
e739e07a32
1 changed files with 9 additions and 4 deletions
|
@ -16,10 +16,7 @@ import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MusicCommand implements Command {
|
public class MusicCommand implements Command {
|
||||||
private Path root;
|
private Path root;
|
||||||
|
@ -163,6 +160,14 @@ public class MusicCommand implements Command {
|
||||||
final String[] filenames = path.toFile().list();
|
final String[] filenames = path.toFile().list();
|
||||||
if (filenames == null) return Component.text("Directory doesn't exist").color(NamedTextColor.RED);
|
if (filenames == null) return Component.text("Directory doesn't exist").color(NamedTextColor.RED);
|
||||||
|
|
||||||
|
Arrays.sort(filenames, (s1, s2) -> {
|
||||||
|
int result = s1.compareToIgnoreCase(s2);
|
||||||
|
if (result == 0) {
|
||||||
|
return s2.compareTo(s1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
final List<Component> list = new ArrayList<>();
|
final List<Component> list = new ArrayList<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String filename : filenames) {
|
for (String filename : filenames) {
|
||||||
|
|
Loading…
Reference in a new issue