mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-08-26 15:32:50 +02:00
Allow players with essentials.signs.trade.override permission break invalid trade signs.
This commit is contained in:
parent
cf59a90c52
commit
81994160e8
|
@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
public class SignTrade extends EssentialsSign
|
||||
{
|
||||
|
||||
public SignTrade()
|
||||
{
|
||||
super("Trade");
|
||||
|
@ -40,11 +39,11 @@ public class SignTrade extends EssentialsSign
|
|||
substractAmount(sign, 1, stored, ess);
|
||||
stored.pay(player);
|
||||
Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
throw new SignException(Util.i18n("tradeSignEmptyOwner"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -67,11 +66,22 @@ public class SignTrade extends EssentialsSign
|
|||
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
||||
|| player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
try
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
if (player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user