From d19ffc6cc0192e6f37f913a1a08fc838ed5c2717 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 9 Jan 2013 18:47:35 +1100 Subject: [PATCH] Warn other party when teleport fails after tpaccept 10b972bd079fcdfc60d861d92cb20252c1089541 --- .../net/ess3/commands/Commandtpaccept.java | 19 +++++++++++++++---- 1 file 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();