summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-12-21 23:19:58 +0000
committerKHobbits <rob@khobbits.co.uk>2013-12-21 23:19:58 +0000
commitaba674e2864efb8e63e241cb2e5a85c8bd979c12 (patch)
treee6deb575a83fd7a3bc22996ac62f0a31d8f423fe
parent40b22a11cb82ac3bec6413665fc37b3b1cc40354 (diff)
downloadEssentials-aba674e2864efb8e63e241cb2e5a85c8bd979c12.tar
Essentials-aba674e2864efb8e63e241cb2e5a85c8bd979c12.tar.gz
Essentials-aba674e2864efb8e63e241cb2e5a85c8bd979c12.tar.lz
Essentials-aba674e2864efb8e63e241cb2e5a85c8bd979c12.tar.xz
Essentials-aba674e2864efb8e63e241cb2e5a85c8bd979c12.zip
Check command cost permissions prior to teleporting. Fixes ESS-4918
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index c46ceedf5..821f0f392 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -7,7 +7,6 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import net.ess3.api.IEssentials;
import net.ess3.api.IUser;
-import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerRespawnEvent;
@@ -153,26 +152,29 @@ public class Teleport implements net.ess3.api.ITeleport
{
double delay = ess.getSettings().getTeleportDelay();
+ Trade cashCharge = null;
if (chargeFor != null)
{
chargeFor.isAffordableFor(teleportOwner);
+ cashCharge = new Trade(chargeFor.getCommandCost(teleportOwner), ess);
}
+
cooldown(true);
if (delay <= 0 || teleportOwner.isAuthorized("essentials.teleport.timer.bypass")
|| teleportee.isAuthorized("essentials.teleport.timer.bypass"))
{
cooldown(false);
now(teleportee, target, cause);
- if (chargeFor != null)
+ if (cashCharge != null)
{
- chargeFor.charge(teleportOwner);
+ cashCharge.charge(teleportOwner);
}
return;
}
cancel(false);
warnUser(teleportee, delay);
- initTimer((long)(delay * 1000.0), teleportee, target, chargeFor, cause, false);
+ initTimer((long)(delay * 1000.0), teleportee, target, cashCharge, cause, false);
}
//The respawn function is a wrapper used to handle tp fallback, on /jail and /home