mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-13 16:38:06 +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 class SignTrade extends EssentialsSign
|
||||||
{
|
{
|
||||||
|
|
||||||
public SignTrade()
|
public SignTrade()
|
||||||
{
|
{
|
||||||
super("Trade");
|
super("Trade");
|
||||||
@ -40,11 +39,11 @@ public class SignTrade extends EssentialsSign
|
|||||||
substractAmount(sign, 1, stored, ess);
|
substractAmount(sign, 1, stored, ess);
|
||||||
stored.pay(player);
|
stored.pay(player);
|
||||||
Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
|
Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
|
||||||
}
|
}
|
||||||
catch (SignException e)
|
catch (SignException e)
|
||||||
{
|
{
|
||||||
throw new SignException(Util.i18n("tradeSignEmptyOwner"));
|
throw new SignException(Util.i18n("tradeSignEmptyOwner"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -67,11 +66,22 @@ public class SignTrade extends EssentialsSign
|
|||||||
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
||||||
|| player.isAuthorized("essentials.signs.trade.override"))
|
|| player.isAuthorized("essentials.signs.trade.override"))
|
||||||
{
|
{
|
||||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
try
|
||||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
{
|
||||||
stored1.pay(player);
|
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||||
stored2.pay(player);
|
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), 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;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user