Compare levels of Tipped Arrow, fixes #2228

This commit is contained in:
PikaMug 2024-07-16 13:45:44 -04:00
parent 94d55c3be7
commit 89a1b1eb70
3 changed files with 11 additions and 5 deletions

View File

@ -68,7 +68,6 @@ public class BukkitQuestadminNextstageCommand extends BukkitQuestsSubCommand {
@Override @Override
public void execute(CommandSender cs, String[] args) { public void execute(CommandSender cs, String[] args) {
if (args.length < 3) { if (args.length < 3) {
System.out.println(args.length);
// Shows command usage // Shows command usage
return; return;
} }

View File

@ -64,11 +64,10 @@ public class BukkitItemListener implements Listener {
if (!quester.meetsCondition(quest, true)) { if (!quester.meetsCondition(quest, true)) {
continue; continue;
} }
if (quester.getCurrentQuests().containsKey(quest) if (quester.getCurrentQuests().containsKey(quest)
&& quester.getCurrentStage(quest).containsObjective(type)) { && quester.getCurrentStage(quest).containsObjective(type)) {
if (BukkitInventoryUtil.getEmptySlots(player) if (craftedItem.getMaxStackSize() == 0 || (BukkitInventoryUtil.getEmptySlots(player)
< craftedItem.getAmount() / craftedItem.getMaxStackSize()) { < craftedItem.getAmount() / craftedItem.getMaxStackSize())) {
BukkitActionBarProvider.sendActionBar(player, ChatColor.RED + BukkitLang.get(player, BukkitActionBarProvider.sendActionBar(player, ChatColor.RED + BukkitLang.get(player,
"inventoryFull")); "inventoryFull"));
event.setCancelled(true); event.setCancelled(true);

View File

@ -77,7 +77,7 @@ public class BukkitItemUtil {
* -6 if stack stored enchants are unequal<br> * -6 if stack stored enchants are unequal<br>
* -7 if stack item flags are unequal<br> * -7 if stack item flags are unequal<br>
* -8 if stack Written Book data is unequal<br> * -8 if stack Written Book data is unequal<br>
* -9 if stack Potion type is unequal<br> * -9 if stack Potion or Tipped Arrow type are unequal<br>
* -10 if stack Tropical Fish variant is unequal * -10 if stack Tropical Fish variant is unequal
*/ */
public static int compareItems(final ItemStack one, final ItemStack two, final boolean ignoreAmount, public static int compareItems(final ItemStack one, final ItemStack two, final boolean ignoreAmount,
@ -181,6 +181,14 @@ public class BukkitItemUtil {
return -9; return -9;
} }
} }
} else {
if (one.getType().name().equals("TIPPED_ARROW") && two.getType().name().equals("TIPPED_ARROW")) {
final String levelA = BukkitItemUtil.getPrettyPotionLevel(one.getItemMeta());
final String levelB = BukkitItemUtil.getPrettyPotionLevel(two.getItemMeta());
if (!levelA.equals(levelB)) {
return -9;
}
}
} }
if (!one.getEnchantments().equals(two.getEnchantments())) { if (!one.getEnchantments().equals(two.getEnchantments())) {
return -5; return -5;