Skip to content

Commit

Permalink
Register menu arguments even if the menu does not have an open comman…
Browse files Browse the repository at this point in the history
…d specified.
  • Loading branch information
BlitzOffline committed Dec 7, 2024
1 parent c4cb45d commit 3a838fa
Showing 1 changed file with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,39 +561,39 @@ public void loadMenu(FileConfiguration c, String key, boolean mainConfig) {
if (!openCommands.isEmpty()) {
builder.commands(openCommands);
builder.registerCommands(c.getBoolean(pre + "register_command", false));
}

List<String> argumentNames = new ArrayList<>();
List<RequirementList> argumentRequirements = new ArrayList<>();

if (c.contains(pre + "args")) {
// New requirements parsing
if (c.isConfigurationSection(pre + "args")) {
Set<String> mapList = c.getConfigurationSection(pre + "args").getKeys(false);
debug("found args");
for (String arg : mapList) {
debug("arg: " + arg);
// If it has requirements, add them
if (c.contains(pre + "args." + arg + ".requirements")) {
debug("arg has requirements: " + arg);
argumentRequirements.add(this.getRequirements(c, pre + "args." + arg));
}
// Always add the arg itself
argumentNames.add(arg);
List<String> argumentNames = new ArrayList<>();
List<RequirementList> argumentRequirements = new ArrayList<>();

if (c.contains(pre + "args")) {
// New requirements parsing
if (c.isConfigurationSection(pre + "args")) {
Set<String> mapList = c.getConfigurationSection(pre + "args").getKeys(false);
debug("found args");
for (String arg : mapList) {
debug("arg: " + arg);
// If it has requirements, add them
if (c.contains(pre + "args." + arg + ".requirements")) {
debug("arg has requirements: " + arg);
argumentRequirements.add(this.getRequirements(c, pre + "args." + arg));
}
// Old list parsing
} else if (c.isList(pre + "args")) {
argumentNames.addAll(c.getStringList(pre + "args"));
// Old singular item parsing
} else if (c.isString(pre + "args")) {
argumentNames.add(c.getString(pre + "args"));
// Always add the arg itself
argumentNames.add(arg);
}
// Old list parsing
} else if (c.isList(pre + "args")) {
argumentNames.addAll(c.getStringList(pre + "args"));
// Old singular item parsing
} else if (c.isString(pre + "args")) {
argumentNames.add(c.getString(pre + "args"));
}

builder.arguments(argumentNames);
builder.argumentRequirements(argumentRequirements);
builder.argumentsUsageMessage(c.getString(pre + "args_usage_message", null));
}

builder.arguments(argumentNames);
builder.argumentRequirements(argumentRequirements);
builder.argumentsUsageMessage(c.getString(pre + "args_usage_message", null));

int size = 54;
if (type == InventoryType.CHEST) {
if (!c.contains(pre + "size")) {
Expand Down

0 comments on commit 3a838fa

Please sign in to comment.