Use strict comparison for potions in trade signs (#5260)

This commit is contained in:
Josh Roy 2023-04-02 17:45:46 -04:00 committed by GitHub
parent bf14b88600
commit 0f4af9e735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,9 @@ public class SignTrade extends EssentialsSign {
final Trade trade = getTrade(sign, 2, AmountType.COST, false, true, ess);
ItemStack stack = Inventories.getItemInHand(player.getBase());
if (trade.getItemStack() != null && stack != null && !MaterialUtil.isAir(stack.getType()) && trade.getItemStack().getType() == stack.getType() && MaterialUtil.getDamage(trade.getItemStack()) == MaterialUtil.getDamage(stack) && trade.getItemStack().getEnchantments().equals(stack.getEnchantments())) {
if (MaterialUtil.isPotion(trade.getItemStack().getType()) && !trade.getItemStack().isSimilar(stack)) {
return null;
}
final int amount = trade.getItemStack().getAmount();
if (Inventories.containsAtLeast(player.getBase(), trade.getItemStack(), amount)) {
stack = stack.clone();