Skip to content

Commit

Permalink
Allow quest items usage in menus
Browse files Browse the repository at this point in the history
  • Loading branch information
Krakenied committed Sep 6, 2024
1 parent 721bce0 commit e30ec59
Showing 1 changed file with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,16 +644,36 @@ public void reloadQuests() {
}
}

public QuestItem getConfiguredQuestItem(String path, ConfigurationSection config, ItemGetter.Filter... excludes) {
if (config.contains(path + ".quest-item")) {
return questItemRegistry.getItem(config.getString(path + ".quest-item"));
public @NotNull QuestItem getConfiguredQuestItem(final @NotNull String path, final @NotNull ConfigurationSection config, final @NotNull ItemGetter.Filter @NotNull ... excludes) {
final String questItemId = config.getString(path + ".quest-item");

if (questItemId != null) {
final QuestItem questItem = this.questItemRegistry.getItem(questItemId);

if (questItem != null) {
return questItem;
}
}

return new ParsedQuestItem("defined", null, this.getItemStack(path, config, excludes));
}

public @NotNull ItemStack getConfiguredItemStack(final @NotNull String path, final @NotNull ConfigurationSection config, final @NotNull ItemGetter.Filter @NotNull ... excludes) {
final String questItemId = config.getString(path + ".quest-item");

if (questItemId != null) {
final QuestItem questItem = this.questItemRegistry.getItem(questItemId);

if (questItem != null) {
return questItem.getItemStack();
}
}

return new ParsedQuestItem("defined", null, getConfiguredItemStack(path, config, excludes));
return this.itemGetter.getItem(path, config, excludes);
}

public ItemStack getConfiguredItemStack(String path, ConfigurationSection config, ItemGetter.Filter... excludes) {
return itemGetter.getItem(path, config, excludes);
public @NotNull ItemStack getItemStack(final @NotNull String path, final @NotNull ConfigurationSection config, final @NotNull ItemGetter.Filter @NotNull ... excludes) {
return this.itemGetter.getItem(path, config, excludes);
}

private boolean reloadBaseConfiguration(final boolean initialLoad) {
Expand Down

0 comments on commit e30ec59

Please sign in to comment.