mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Deprecate progress as item, see #2240
This commit is contained in:
parent
dfe788c0ad
commit
82804e700d
@ -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("<item>", BukkitItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", BukkitItemUtil.getName(goal)));
|
||||
}
|
||||
} else {
|
||||
sendMessage(message.replace("<item>", BukkitItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", 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("<item>", BukkitItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", BukkitItemUtil.getName(goal)));
|
||||
}
|
||||
} else {
|
||||
sendMessage(message.replace("<item>", BukkitItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", BukkitItemUtil.getName(goal)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.PLACE_BLOCK)) {
|
||||
final String message = formatCompletedObjectiveMessage("place", goal.getAmount());
|
||||
|
@ -86,6 +86,9 @@ public class BukkitObjective implements Objective {
|
||||
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;
|
||||
}
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user