summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 865492921..7c950ae96 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.ChargeException;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
@@ -52,24 +53,24 @@ public class Commandtpaccept extends EssentialsCommand
}
final Trade charge = new Trade(this.getName(), ess);
- if (user.isTpRequestHere())
- {
- charge.isAffordableFor(user);
- }
- else
- {
- charge.isAffordableFor(target);
- }
user.sendMessage(_("requestAccepted"));
target.sendMessage(_("requestAcceptedFrom", user.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, charge, TeleportCause.COMMAND);
+ }
}
- else
+ catch (ChargeException ex)
{
- target.getTeleport().teleport(user, charge, TeleportCause.COMMAND);
+ user.sendMessage(_("pendingTeleportCancelled"));
+ ess.showError(target, ex, commandLabel);
}
user.requestTeleport(null, false);
throw new NoChargeException();