Temporary fix for the music list (it is even messier now)
This commit is contained in:
parent
46a3d8e3ef
commit
d7a53c9c57
1 changed files with 24 additions and 14 deletions
|
@ -155,26 +155,36 @@ public class MusicCommand {
|
|||
int i = 0;
|
||||
|
||||
for (String filename : filenames) {
|
||||
final File file = new File(directory, filename);
|
||||
if (!file.isDirectory()) continue;
|
||||
|
||||
final NamedTextColor color = (i++ & 1) == 0 ? NamedTextColor.DARK_GREEN : NamedTextColor.GREEN;
|
||||
|
||||
final File file = new File(directory, filename);
|
||||
final Path relativeFilepath = Path.of(relativePath, filename);
|
||||
final String escapedPath = escapePath(relativeFilepath.toString());
|
||||
|
||||
if (file.isDirectory()) {
|
||||
directories.add(
|
||||
Component.text(filename + "/", color)
|
||||
.clickEvent(ClickEvent.suggestCommand(prefix + "music list " + escapedPath))
|
||||
.hoverEvent(HoverEvent.showText(Component.translatable("Click to list %s", Component.text(filename, NamedTextColor.GREEN))))
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
for (String filename : filenames) {
|
||||
final File file = new File(directory, filename);
|
||||
if (file.isDirectory()) continue;
|
||||
|
||||
final NamedTextColor color = (i++ & 1) == 0 ? NamedTextColor.DARK_GREEN : NamedTextColor.GREEN;
|
||||
|
||||
final Path relativeFilepath = Path.of(relativePath, filename);
|
||||
final String escapedPath = escapePath(relativeFilepath.toString());
|
||||
|
||||
files.add(
|
||||
Component.text(filename, color)
|
||||
.clickEvent(ClickEvent.suggestCommand(prefix + "music play " + escapedPath))
|
||||
.hoverEvent(HoverEvent.showText(Component.translatable("Click to play %s", Component.text(filename, NamedTextColor.GREEN))))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final ArrayList<Component> mergedList = new ArrayList<>();
|
||||
for (Component component : directories) mergedList.add(component);
|
||||
|
|
Loading…
Reference in a new issue