Warn other party when teleport fails after tpaccept.

This commit is contained in:
KHobbits 2012-12-20 20:01:43 +00:00
parent 371a6437ae
commit 10b972bd07

View file

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.ChargeException;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade; import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -55,6 +56,8 @@ public class Commandtpaccept extends EssentialsCommand
user.sendMessage(_("requestAccepted")); user.sendMessage(_("requestAccepted"));
target.sendMessage(_("requestAcceptedFrom", user.getDisplayName())); target.sendMessage(_("requestAcceptedFrom", user.getDisplayName()));
try
{
if (user.isTpRequestHere()) if (user.isTpRequestHere())
{ {
target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND); target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND);
@ -63,6 +66,12 @@ public class Commandtpaccept extends EssentialsCommand
{ {
target.getTeleport().teleport(user, charge, TeleportCause.COMMAND); target.getTeleport().teleport(user, charge, TeleportCause.COMMAND);
} }
}
catch (ChargeException ex)
{
user.sendMessage(_("pendingTeleportCancelled"));
ess.showError(target, ex, commandLabel);
}
user.requestTeleport(null, false); user.requestTeleport(null, false);
throw new NoChargeException(); throw new NoChargeException();
} }