diff options
author | Chris Ward <chris@chrisgward.com> | 2013-01-09 18:47:35 +1100 |
---|---|---|
committer | Chris Ward <chris@chrisgward.com> | 2013-01-09 18:47:35 +1100 |
commit | d19ffc6cc0192e6f37f913a1a08fc838ed5c2717 (patch) | |
tree | 6f1ab8c2f0c7ebe383aed66ef57334170c65e9b6 | |
parent | 530dfd9129bd4c546c43942b164a191cbbbf1891 (diff) | |
download | Essentials-d19ffc6cc0192e6f37f913a1a08fc838ed5c2717.tar Essentials-d19ffc6cc0192e6f37f913a1a08fc838ed5c2717.tar.gz Essentials-d19ffc6cc0192e6f37f913a1a08fc838ed5c2717.tar.lz Essentials-d19ffc6cc0192e6f37f913a1a08fc838ed5c2717.tar.xz Essentials-d19ffc6cc0192e6f37f913a1a08fc838ed5c2717.zip |
Warn other party when teleport fails after tpaccept
10b972bd079fcdfc60d861d92cb20252c1089541
-rw-r--r-- | Essentials/src/net/ess3/commands/Commandtpaccept.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandtpaccept.java b/Essentials/src/net/ess3/commands/Commandtpaccept.java index d6bcae5c5..96fb6abfa 100644 --- a/Essentials/src/net/ess3/commands/Commandtpaccept.java +++ b/Essentials/src/net/ess3/commands/Commandtpaccept.java @@ -1,6 +1,9 @@ package net.ess3.commands; import static net.ess3.I18n._; + +import net.ess3.api.ChargeException; +import net.ess3.utils.Util; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import net.ess3.api.ISettings; import net.ess3.api.IUser; @@ -44,13 +47,21 @@ public class Commandtpaccept extends EssentialsCommand user.sendMessage(_("requestAccepted")); target.sendMessage(_("requestAcceptedFrom", user.getPlayer().getDisplayName())); - if (user.isTpRequestHere()) + try { - target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND); + if (user.isTpRequestHere()) + { + target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND); + } + else + { + target.getTeleport().teleport(user.getPlayer(), charge, TeleportCause.COMMAND); + } } - else + catch (ChargeException ex) { - target.getTeleport().teleport(user.getPlayer(), charge, TeleportCause.COMMAND); + user.sendMessage(_("pendingTeleportCancelled")); + //ess.showError(target, ex, commandLabel); TODO: equivalent to ess.showError() could not be found? } user.requestTeleport(null, false); throw new NoChargeException(); |