diff --git a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java index 4df245584..3f1a91836 100644 --- a/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java +++ b/core/src/main/java/me/pikamug/quests/player/BukkitQuester.java @@ -1601,10 +1601,10 @@ public class BukkitQuester implements Quester { final BukkitObjective objective = (BukkitObjective) obj; String message = "- " + BukkitLang.BukkitFormatToken.convertString(quester.getPlayer(), objective.getMessage()); - if (objective.getProgressAsItem() != null && objective.getGoalAsItem() != null) { - final ItemStack progress = objective.getProgressAsItem(); + if (objective.getGoalAsItem() != null) { + final int progress = objective.getProgress(); final ItemStack goal = objective.getGoalAsItem(); - if (!settings.canShowCompletedObjs() && progress.getAmount() >= goal.getAmount()) { + if (!settings.canShowCompletedObjs() && progress >= goal.getAmount()) { continue; } if (localeManager != null && settings.canTranslateNames() && !goal.hasItemMeta() @@ -3310,8 +3310,6 @@ public class BukkitQuester implements Quester { } final Player p = getPlayer(); final ObjectiveType type = objective.getType(); - final ItemStack increment = objective.getGoalObject() instanceof ItemStack ? (ItemStack) objective.getProgressObject() - : new ItemStack(Material.AIR, objective.getProgress()); final ItemStack goal = objective.getGoalObject() instanceof ItemStack ? (ItemStack) objective.getGoalObject() : new ItemStack(Material.AIR, objective.getGoal()); if (!getCurrentStage(quest).getObjectiveOverrides().isEmpty()) { @@ -3327,23 +3325,23 @@ public class BukkitQuester implements Quester { final String message = formatCompletedObjectiveMessage("break", goal.getAmount()); if (plugin.getConfigSettings().canTranslateNames() && !goal.hasItemMeta() && !goal.getItemMeta().hasDisplayName()) { - if (!plugin.getLocaleManager().sendMessage(p, message, increment.getType(), increment.getDurability(), + if (!plugin.getLocaleManager().sendMessage(p, message, goal.getType(), goal.getDurability(), null)) { - sendMessage(message.replace("", BukkitItemUtil.getName(increment))); + sendMessage(message.replace("", BukkitItemUtil.getName(goal))); } } else { - sendMessage(message.replace("", BukkitItemUtil.getName(increment))); + sendMessage(message.replace("", BukkitItemUtil.getName(goal))); } } else if (type.equals(ObjectiveType.DAMAGE_BLOCK)) { final String message = formatCompletedObjectiveMessage("damage", goal.getAmount()); if (plugin.getConfigSettings().canTranslateNames() && !goal.hasItemMeta() && !goal.getItemMeta().hasDisplayName()) { - if (!plugin.getLocaleManager().sendMessage(p, message, increment.getType(), increment.getDurability(), + if (!plugin.getLocaleManager().sendMessage(p, message, goal.getType(), goal.getDurability(), null)) { - sendMessage(message.replace("", BukkitItemUtil.getName(increment))); + sendMessage(message.replace("", BukkitItemUtil.getName(goal))); } } else { - sendMessage(message.replace("", BukkitItemUtil.getName(increment))); + sendMessage(message.replace("", BukkitItemUtil.getName(goal))); } } else if (type.equals(ObjectiveType.PLACE_BLOCK)) { final String message = formatCompletedObjectiveMessage("place", goal.getAmount()); diff --git a/core/src/main/java/me/pikamug/quests/quests/components/BukkitObjective.java b/core/src/main/java/me/pikamug/quests/quests/components/BukkitObjective.java index 89ab4220b..8c18c23e5 100644 --- a/core/src/main/java/me/pikamug/quests/quests/components/BukkitObjective.java +++ b/core/src/main/java/me/pikamug/quests/quests/components/BukkitObjective.java @@ -85,7 +85,10 @@ public class BukkitObjective implements Objective { public @NotNull Object getGoalObject() { return goalObj; } - + + /** + * @deprecated Paper 1.21 builds do not allow ItemStack with 0 amount + */ public @Nullable ItemStack getProgressAsItem() { return progressObj instanceof ItemStack ? (ItemStack) progressObj : null; } diff --git a/core/src/main/java/me/pikamug/quests/util/BukkitInventoryUtil.java b/core/src/main/java/me/pikamug/quests/util/BukkitInventoryUtil.java index 3f5922aaf..a8380c80d 100644 --- a/core/src/main/java/me/pikamug/quests/util/BukkitInventoryUtil.java +++ b/core/src/main/java/me/pikamug/quests/util/BukkitInventoryUtil.java @@ -169,7 +169,7 @@ public class BukkitInventoryUtil { public static int getEmptySlots(final Player player) { final ItemStack[] contents = player.getInventory().getContents(); int i = 0; - for (ItemStack item : contents) + for (final ItemStack item : contents) if (item != null && item.getType() != Material.AIR) { i++; }