summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <suror@gmx.co.uk>2011-12-07 01:12:36 +0000
committerementalo <suror@gmx.co.uk>2011-12-07 01:12:36 +0000
commit10597cec2f3f70628e753616ff5371f65fa39f5f (patch)
tree86e3c2feb0432564f84f3f584a793ecbe54cce5c
parent854fc05c5b3a3d1d1ed40a0755eac401043b92b4 (diff)
downloadEssentials-10597cec2f3f70628e753616ff5371f65fa39f5f.tar
Essentials-10597cec2f3f70628e753616ff5371f65fa39f5f.tar.gz
Essentials-10597cec2f3f70628e753616ff5371f65fa39f5f.tar.lz
Essentials-10597cec2f3f70628e753616ff5371f65fa39f5f.tar.xz
Essentials-10597cec2f3f70628e753616ff5371f65fa39f5f.zip
Catch TeleportClause.COMMAND in the teleport listener.
Changed Teleport methods to pass a TeleportClause param
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Jails.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java51
-rw-r--r--Essentials/src/com/earth2me/essentials/api/ITeleport.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandjump.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtop.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworld.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignWarp.java3
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java7
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java3
19 files changed, 69 insertions, 49 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 5525b2562..0991a16e4 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -235,7 +235,7 @@ public class EssentialsPlayerListener extends PlayerListener
final User user = ess.getUser(event.getPlayer());
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
- if(event.getCause() == TeleportCause.PLUGIN && ess.getSettings().registerBackInListener())
+ if((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND)&& ess.getSettings().registerBackInListener())
{
user.setLastLocation();
}
diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java
index 2fbc57aa5..de23ea241 100644
--- a/Essentials/src/com/earth2me/essentials/Jails.java
+++ b/Essentials/src/com/earth2me/essentials/Jails.java
@@ -13,6 +13,7 @@ import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*;
import org.bukkit.event.player.*;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.PluginManager;
@@ -109,7 +110,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
{
if (!(user.getBase() instanceof OfflinePlayer))
{
- user.getTeleport().now(getJail(jail), false);
+ user.getTeleport().now(getJail(jail), false, TeleportCause.COMMAND);
}
user.setJail(jail);
}
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index f82bdaac3..c627279c4 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -10,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Teleport implements Runnable, ITeleport
@@ -58,8 +59,9 @@ public class Teleport implements Runnable, ITeleport
private Trade chargeFor;
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
+ private TeleportCause cause;
- private void initTimer(long delay, Target target, Trade chargeFor)
+ private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause)
{
this.started = System.currentTimeMillis();
this.delay = delay;
@@ -69,6 +71,7 @@ public class Teleport implements Runnable, ITeleport
this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT);
this.teleportTarget = target;
this.chargeFor = chargeFor;
+ this.cause = cause;
}
@Override
@@ -101,7 +104,7 @@ public class Teleport implements Runnable, ITeleport
try
{
- now(teleportTarget);
+ now(teleportTarget, cause);
if (chargeFor != null)
{
chargeFor.charge(user);
@@ -125,19 +128,19 @@ public class Teleport implements Runnable, ITeleport
this.ess = ess;
}
- public void respawn(final Trade chargeFor) throws Exception
+ public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
{
final Player player = user.getBase();
final Location bed = player.getBedSpawnLocation();
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null);
ess.getServer().getPluginManager().callEvent(pre);
- teleport(new Target(pre.getRespawnLocation()), chargeFor);
+ teleport(new Target(pre.getRespawnLocation()), chargeFor, cause);
}
- public void warp(String warp, Trade chargeFor) throws Exception
+ public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
{
Location loc = ess.getWarps().getWarp(warp);
- teleport(new Target(loc), chargeFor);
+ teleport(new Target(loc), chargeFor, cause);
user.sendMessage(_("warpingTo", warp));
}
@@ -188,17 +191,17 @@ public class Teleport implements Runnable, ITeleport
cancel(false);
}
- public void teleport(Location loc, Trade chargeFor) throws Exception
+ public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
- teleport(new Target(loc), chargeFor);
+ teleport(new Target(loc), chargeFor, cause);
}
- public void teleport(Entity entity, Trade chargeFor) throws Exception
+ public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception
{
- teleport(new Target(entity), chargeFor);
+ teleport(new Target(entity), chargeFor, cause);
}
- private void teleport(Target target, Trade chargeFor) throws Exception
+ private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
{
double delay = ess.getSettings().getTeleportDelay();
@@ -210,7 +213,7 @@ public class Teleport implements Runnable, ITeleport
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
{
cooldown(false);
- now(target);
+ now(target, cause);
if (chargeFor != null)
{
chargeFor.charge(user);
@@ -223,51 +226,51 @@ public class Teleport implements Runnable, ITeleport
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
- initTimer((long)(delay * 1000.0), target, chargeFor);
+ initTimer((long)(delay * 1000.0), target, chargeFor, cause);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
- private void now(Target target) throws Exception
+ private void now(Target target, TeleportCause cause) throws Exception
{
cancel();
user.setLastLocation();
- user.getBase().teleport(Util.getSafeDestination(target.getLocation()));
+ user.getBase().teleport(Util.getSafeDestination(target.getLocation()), cause);
}
- public void now(Location loc, boolean cooldown) throws Exception
+ public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
{
cooldown(false);
}
- now(new Target(loc));
+ now(new Target(loc), cause);
}
- public void now(Location loc, Trade chargeFor) throws Exception
+ public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
cooldown(false);
chargeFor.charge(user);
- now(new Target(loc));
+ now(new Target(loc), cause);
}
- public void now(Entity entity, boolean cooldown) throws Exception
+ public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
{
cooldown(false);
}
- now(new Target(entity));
+ now(new Target(entity), cause);
}
public void back(Trade chargeFor) throws Exception
{
- teleport(new Target(user.getLastLocation()), chargeFor);
+ teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND);
}
public void back() throws Exception
{
- now(new Target(user.getLastLocation()));
+ now(new Target(user.getLastLocation()), TeleportCause.COMMAND);
}
public void home(IUser user, String home, Trade chargeFor) throws Exception
@@ -277,6 +280,6 @@ public class Teleport implements Runnable, ITeleport
{
throw new NotEnoughArgumentsException();
}
- teleport(new Target(loc), chargeFor);
+ teleport(new Target(loc), chargeFor, TeleportCause.COMMAND);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/api/ITeleport.java b/Essentials/src/com/earth2me/essentials/api/ITeleport.java
index 9bcf4584e..5b9a19757 100644
--- a/Essentials/src/com/earth2me/essentials/api/ITeleport.java
+++ b/Essentials/src/com/earth2me/essentials/api/ITeleport.java
@@ -1,9 +1,10 @@
package com.earth2me.essentials.api;
import org.bukkit.Location;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public interface ITeleport
{
- void now(Location loc, boolean cooldown) throws Exception;
+ void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index ab8355ead..222d49017 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandhome extends EssentialsCommand
@@ -48,7 +49,7 @@ public class Commandhome extends EssentialsCommand
final Location bed = player.getBedSpawnLocation();
if (bed != null)
{
- user.getTeleport().teleport(bed, charge);
+ user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
return;
}
}
@@ -59,7 +60,7 @@ public class Commandhome extends EssentialsCommand
final List<String> homes = player.getHomes();
if (homes.isEmpty() && player.equals(user))
{
- user.getTeleport().respawn(charge);
+ user.getTeleport().respawn(charge, TeleportCause.COMMAND);
}
else if (homes.isEmpty())
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
index 8e37da0c8..39ca305e3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java
@@ -6,6 +6,7 @@ import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Location;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandjump extends EssentialsCommand
@@ -35,6 +36,6 @@ public class Commandjump extends EssentialsCommand
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.getTeleport().teleport(loc, charge);
+ user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
index 5cd9376cd..e91d0984a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import org.bukkit.Location;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtop extends EssentialsCommand
@@ -20,7 +21,7 @@ public class Commandtop extends EssentialsCommand
final int topX = user.getLocation().getBlockX();
final int topZ = user.getLocation().getBlockZ();
final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
- user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
+ user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess), TeleportCause.COMMAND);
user.sendMessage(_("teleportTop"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index 10c381b2e..7ea3f0541 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -6,6 +6,7 @@ import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtp extends EssentialsCommand
@@ -32,7 +33,7 @@ public class Commandtp extends EssentialsCommand
user.sendMessage(_("teleporting"));
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.getTeleport().teleport(player, charge);
+ user.getTeleport().teleport(player, charge, TeleportCause.COMMAND);
throw new NoChargeException();
default:
@@ -44,7 +45,7 @@ public class Commandtp extends EssentialsCommand
user.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
- target.getTeleport().now(toPlayer, false);
+ target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
break;
}
@@ -61,7 +62,7 @@ public class Commandtp extends EssentialsCommand
sender.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
- target.getTeleport().now(toPlayer, false);
+ target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 164a1afad..954f3f038 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtpaccept extends EssentialsCommand
@@ -40,11 +41,11 @@ public class Commandtpaccept extends EssentialsCommand
if (user.isTeleportRequestHere())
{
- user.getTeleport().teleport(target, charge);
+ user.getTeleport().teleport(target, charge, TeleportCause.COMMAND);
}
else
{
- target.getTeleport().teleport(user, charge);
+ target.getTeleport().teleport(user, charge, TeleportCause.COMMAND);
}
user.requestTeleport(null, false);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
index d3b8917aa..f21f1a6bc 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtpall extends EssentialsCommand
@@ -43,7 +44,7 @@ public class Commandtpall extends EssentialsCommand
}
try
{
- player.getTeleport().now(user, false);
+ player.getTeleport().now(user, false, TeleportCause.COMMAND);
}
catch (Exception ex)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
index ecfb6b6a6..733091d1a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
@@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtphere extends EssentialsCommand
@@ -21,7 +22,7 @@ public class Commandtphere extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
- player.getTeleport().teleport(user, new Trade(this.getName(), ess));
+ player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND);
user.sendMessage(_("teleporting"));
player.sendMessage(_("teleporting"));
throw new NoChargeException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index d225725be..7c13b80d4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtpo extends EssentialsCommand
@@ -32,7 +33,7 @@ public class Commandtpo extends EssentialsCommand
// Verify permission
if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
{
- user.getTeleport().now(player, false);
+ user.getTeleport().now(player, false, TeleportCause.COMMAND);
user.sendMessage(_("teleporting"));
}
else
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
index 0a6bc5180..e226f0702 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
@@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtpohere extends EssentialsCommand
@@ -33,7 +34,7 @@ public class Commandtpohere extends EssentialsCommand
// Verify permission
if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
{
- player.getTeleport().now(user, false);
+ player.getTeleport().now(user, false, TeleportCause.COMMAND);
user.sendMessage(_("teleporting"));
}
else
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
index 203628753..226fa44e3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import org.bukkit.Location;
import org.bukkit.Server;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtppos extends EssentialsCommand
@@ -37,7 +38,7 @@ public class Commandtppos extends EssentialsCommand
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.sendMessage(_("teleporting"));
- user.getTeleport().teleport(location, charge);
+ user.getTeleport().teleport(location, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
} \ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index b15af349d..8fe84ba16 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -10,6 +10,7 @@ import java.util.Iterator;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandwarp extends EssentialsCommand
@@ -118,11 +119,11 @@ public class Commandwarp extends EssentialsCommand
{
if (user.isAuthorized("essentials.warp." + name))
{
- user.getTeleport().warp(name, charge);
+ user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
return;
}
throw new Exception(_("warpUsePermission"));
}
- user.getTeleport().warp(name, charge);
+ user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
}
} \ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
index b62276cf8..41554c8ce 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
@@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandworld extends EssentialsCommand
@@ -81,7 +82,7 @@ public class Commandworld extends EssentialsCommand
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.getTeleport().teleport(target, charge);
+ user.getTeleport().teleport(target, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java
index bd56be46e..76e8e730b 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java
@@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class SignWarp extends EssentialsSign
@@ -56,7 +57,7 @@ public class SignWarp extends EssentialsSign
final Trade charge = getTrade(sign, 3, ess);
try
{
- player.getTeleport().warp(warpName, charge);
+ player.getTeleport().warp(warpName, charge, TeleportCause.PLUGIN);
}
catch (Exception ex)
{
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index fe1630b4d..f29707b82 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -7,6 +7,7 @@ import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import static com.earth2me.essentials.I18n._;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandspawn extends EssentialsCommand
@@ -24,7 +25,7 @@ public class Commandspawn extends EssentialsCommand
if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
{
final User otherUser = getPlayer(server, args, 0);
- otherUser.getTeleport().respawn(charge);
+ otherUser.getTeleport().respawn(charge, TeleportCause.COMMAND);
if (!otherUser.equals(user))
{
otherUser.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
@@ -33,7 +34,7 @@ public class Commandspawn extends EssentialsCommand
}
else
{
- user.getTeleport().respawn(charge);
+ user.getTeleport().respawn(charge, TeleportCause.COMMAND);
}
}
@@ -45,7 +46,7 @@ public class Commandspawn extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0);
- user.getTeleport().respawn(null);
+ user.getTeleport().respawn(null, TeleportCause.COMMAND);
user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
sender.sendMessage(_("teleporting"));
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 6bb453f12..8c3678a92 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -9,6 +9,7 @@ import org.bukkit.Location;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EssentialsSpawnPlayerListener extends PlayerListener
@@ -84,7 +85,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
{
try
{
- user.getTeleport().now(spawns.getSpawn(ess.getSettings().getNewbieSpawn()), false);
+ user.getTeleport().now(spawns.getSpawn(ess.getSettings().getNewbieSpawn()), false, TeleportCause.PLUGIN);
}
catch (Exception ex)
{