mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Add message for failing sign warp permission check
This commit is contained in:
parent
25ddaef423
commit
50225624a5
1 changed files with 17 additions and 9 deletions
|
@ -40,16 +40,24 @@ public class SignWarp extends EssentialsSign {
|
||||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
||||||
final String warpName = sign.getLine(1);
|
final String warpName = sign.getLine(1);
|
||||||
final String group = sign.getLine(2);
|
final String group = sign.getLine(2);
|
||||||
if ((!group.isEmpty() && ("§2Everyone".equals(group) || player.inGroup(group))) || (group.isEmpty() && (!ess.getSettings().getPerWarpPermission() || player.isAuthorized("essentials.warps." + warpName)))) {
|
|
||||||
final Trade charge = getTrade(sign, 3, ess);
|
if (!group.isEmpty()) {
|
||||||
try {
|
if (!"§2Everyone".equals(group) && !player.inGroup(group)) {
|
||||||
player.getTeleport().warp(player, warpName, charge, TeleportCause.PLUGIN);
|
throw new SignException(tl("warpUsePermission"));
|
||||||
Trade.log("Sign", "Warp", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
|
}
|
||||||
} catch (Exception ex) {
|
} else {
|
||||||
throw new SignException(ex.getMessage(), ex);
|
if (ess.getSettings().getPerWarpPermission() && !player.isAuthorized("essentials.warps." + warpName)) {
|
||||||
|
throw new SignException(tl("warpUsePermission"));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
final Trade charge = getTrade(sign, 3, ess);
|
||||||
|
try {
|
||||||
|
player.getTeleport().warp(player, warpName, charge, TeleportCause.PLUGIN);
|
||||||
|
Trade.log("Sign", "Warp", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new SignException(ex.getMessage(), ex);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue