actually split the among us
This commit is contained in:
parent
876a1a658a
commit
aeba24c6dd
1 changed files with 16 additions and 5 deletions
|
@ -208,7 +208,7 @@ public class MusicCommand implements Command {
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<Component> list = new ArrayList<>();
|
final List<Component> fullList = new ArrayList<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String filename : filenames) {
|
for (String filename : filenames) {
|
||||||
final String pathString = path.toString();
|
final String pathString = path.toString();
|
||||||
|
@ -221,13 +221,13 @@ public class MusicCommand implements Command {
|
||||||
location = Paths.get(""); // wtf mabe
|
location = Paths.get(""); // wtf mabe
|
||||||
}
|
}
|
||||||
final String joinedPath = (args.length < 2) ? filename : Paths.get(location.getFileName().toString(), filename).toString();
|
final String joinedPath = (args.length < 2) ? filename : Paths.get(location.getFileName().toString(), filename).toString();
|
||||||
list.add(
|
fullList.add(
|
||||||
Component
|
Component
|
||||||
.text(filename, (i++ & 1) == 0 ? NamedTextColor.YELLOW : NamedTextColor.GOLD)
|
.text(filename, (i++ & 1) == 0 ? NamedTextColor.YELLOW : NamedTextColor.GOLD)
|
||||||
.clickEvent(
|
.clickEvent(
|
||||||
ClickEvent.suggestCommand(
|
ClickEvent.suggestCommand(
|
||||||
prefix +
|
prefix +
|
||||||
"music" + // ? How do I make this dynamic?
|
name() +
|
||||||
(file.isFile() ? " play " : " list ") +
|
(file.isFile() ? " play " : " list ") +
|
||||||
joinedPath.replace("'", "\\'")
|
joinedPath.replace("'", "\\'")
|
||||||
)
|
)
|
||||||
|
@ -235,8 +235,19 @@ public class MusicCommand implements Command {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Component component = Component.join(JoinConfiguration.separator(Component.space()), list);
|
final int eachSize = 100;
|
||||||
context.sendOutput(component);
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
while (index < fullList.size()) {
|
||||||
|
List<Component> list = fullList.subList(index, Math.min(index + eachSize, fullList.size()));
|
||||||
|
|
||||||
|
final Component component = Component.join(JoinConfiguration.separator(Component.space()), list);
|
||||||
|
context.sendOutput(component);
|
||||||
|
|
||||||
|
index += eachSize;
|
||||||
|
list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
return Component.text("success");
|
return Component.text("success");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue