Skip to content

Commit

Permalink
Fix trade sign length validation issues (#4748)
Browse files Browse the repository at this point in the history
  • Loading branch information
JRoy authored Feb 13, 2022
1 parent f00c2dc commit a9e5f07
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ protected boolean onSignBreak(final ISign sign, final User player, final String
return true;
}

final Map<Integer, ItemStack> withdraw1 = stored1.pay(player, OverflowType.RETURN);
final Map<Integer, ItemStack> withdraw2 = stored2.pay(player, OverflowType.RETURN);
final Map<Integer, ItemStack> withdraw1 = stored1.pay(player, OverflowType.DROP);
final Map<Integer, ItemStack> withdraw2 = stored2.pay(player, OverflowType.DROP);

if (withdraw1 == null && withdraw2 == null) {
Trade.log("Sign", "Trade", "Break", signOwner.substring(2), stored2, username, stored1, sign.getBlock().getLocation(), player.getMoney(), ess);
Expand Down Expand Up @@ -206,7 +206,9 @@ protected final void validateTrade(final ISign sign, final int index, final bool
if (!(split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp")) && getItemStack(split[1], stackamount, ess).getType() == Material.AIR) {
throw new SignException(tl("moreThanZero"));
}
sign.setLine(index, stackamount + " " + split[1] + ":" + amount);
final String newline = stackamount + " " + split[1] + ":" + amount;
validateSignLength(newline);
sign.setLine(index, newline);
return;
}
throw new SignException(tl("invalidSignLine", index + 1));
Expand Down

0 comments on commit a9e5f07

Please sign in to comment.