aliases, startup NPE, pick option when console

This commit is contained in:
CocoTheOwner 2021-09-03 21:28:12 +02:00
parent 773f24238f
commit 0160d42302
4 changed files with 14 additions and 3 deletions

View File

@ -39,7 +39,7 @@ public class CommandIris implements DecreeExecutor {
private CommandObject object; private CommandObject object;
private CommandWhat what; private CommandWhat what;
@Decree(description = "Create a new world", aliases = "+") @Decree(description = "Create a new world", aliases = {"+", "c"})
public void create( public void create(
@Param(aliases = "world-name", description = "The name of the world to create") @Param(aliases = "world-name", description = "The name of the world to create")
String name, String name,

View File

@ -101,7 +101,7 @@ public class CommandObject implements DecreeExecutor {
} }
} }
@Decree(description = "Get a powder that reveals objects", studio = true) @Decree(description = "Get a powder that reveals objects", studio = true, aliases = "d")
public void dust() { public void dust() {
player().getInventory().addItem(WandSVC.createDust()); player().getInventory().addItem(WandSVC.createDust());
sender().playSound(Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f); sender().playSound(Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f);

View File

@ -158,8 +158,14 @@ public class ResourceLoader<T extends IrisRegistrant> {
} }
KSet<String> m = new KSet<>(); KSet<String> m = new KSet<>();
KList<File> files = getFolders();
for (File i : getFolders()) { if (files == null) {
possibleKeys = new String[0];
return possibleKeys;
}
for (File i : files) {
for (File j : matchAllFiles(i, (f) -> f.getName().endsWith(".json"))) { for (File j : matchAllFiles(i, (f) -> f.getName().endsWith(".json"))) {
m.add(i.toURI().relativize(j.toURI()).getPath().replaceAll("\\Q.json\\E", "")); m.add(i.toURI().relativize(j.toURI()).getPath().replaceAll("\\Q.json\\E", ""));
} }

View File

@ -513,6 +513,11 @@ public class VirtualDecreeCommand {
}; };
private String pickValidOption(VolmitSender sender, KList<?> validOptions, DecreeParameterHandler<?> handler, String name, String type) { private String pickValidOption(VolmitSender sender, KList<?> validOptions, DecreeParameterHandler<?> handler, String name, String type) {
if (!sender.isPlayer()) {
String picked = handler.toStringForce(validOptions.getRandom());
sender.sendMessage(C.RED + "We went ahead and picked an option for you: " + picked);
return picked;
}
sender.sendHeader("Pick a " + name + " (" + type + ")"); sender.sendHeader("Pick a " + name + " (" + type + ")");
sender.sendMessageRaw("<gradient:#1ed497:#b39427>This query will expire in 15 seconds.</gradient>"); sender.sendMessageRaw("<gradient:#1ed497:#b39427>This query will expire in 15 seconds.</gradient>");
String password = UUID.randomUUID().toString().replaceAll("\\Q-\\E", ""); String password = UUID.randomUUID().toString().replaceAll("\\Q-\\E", "");