summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java35
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandback.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtop.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java22
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java22
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java12
11 files changed, 63 insertions, 51 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index 821f0f392..270f7eead 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -79,7 +79,8 @@ public class Teleport implements net.ess3.api.ITeleport
{
cooldown(false);
}
- now(teleportOwner, new LocationTarget(loc), cause);
+ final ITarget target = new LocationTarget(loc);
+ now(teleportOwner, target, cause);
}
@Override
@@ -89,29 +90,31 @@ public class Teleport implements net.ess3.api.ITeleport
{
cooldown(false);
}
- now(teleportOwner, new PlayerTarget(entity), cause);
+ final ITarget target = new PlayerTarget(entity);
+ now(teleportOwner, target, cause);
+ teleportOwner.sendMessage(_("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
}
protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws Exception
{
cancel(false);
teleportee.setLastLocation();
- final Location location = target.getLocation();
+ final Location loc = target.getLocation();
- if (LocationUtil.isBlockUnsafe(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ()))
+ if (LocationUtil.isBlockUnsafe(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
{
if (ess.getSettings().isTeleportSafetyEnabled())
{
- teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, location));
+ teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc));
}
else
{
- throw new Exception(_("unsafeTeleportDestination"));
+ throw new Exception(_("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
}
else
{
- teleportee.getBase().teleport(location);
+ teleportee.getBase().teleport(loc);
}
}
@@ -130,22 +133,30 @@ public class Teleport implements net.ess3.api.ITeleport
teleport(teleportOwner, new LocationTarget(loc), chargeFor, cause);
}
+ //This is used when teleporting to a player
@Override
public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception
{
- teleport(teleportOwner, new PlayerTarget(entity), chargeFor, cause);
+ ITarget target = new PlayerTarget(entity);
+ teleport(teleportOwner, target, chargeFor, cause);
+ teleportOwner.sendMessage(_("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
}
+ //This is used when teleporting to stored location
@Override
public void teleportPlayer(IUser teleportee, Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
teleport(teleportee, new LocationTarget(loc), chargeFor, cause);
}
+ //This is used on /tphere
@Override
public void teleportPlayer(IUser teleportee, Player entity, Trade chargeFor, TeleportCause cause) throws Exception
{
- teleport(teleportee, new PlayerTarget(entity), chargeFor, cause);
+ ITarget target = new PlayerTarget(entity);
+ teleport(teleportee, target, chargeFor, cause);
+ teleportee.sendMessage(_("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
+ teleportOwner.sendMessage(_("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()));
}
private void teleport(IUser teleportee, ITarget target, Trade chargeFor, TeleportCause cause) throws Exception
@@ -228,7 +239,7 @@ public class Teleport implements net.ess3.api.ITeleport
public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception
{
Location loc = ess.getWarps().getWarp(warp);
- teleportee.sendMessage(_("warpingTo", warp));
+ teleportee.sendMessage(_("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
teleport(teleportee, new LocationTarget(loc), chargeFor, cause);
}
@@ -236,7 +247,9 @@ public class Teleport implements net.ess3.api.ITeleport
@Override
public void back(Trade chargeFor) throws Exception
{
- teleport(teleportOwner, new LocationTarget(teleportOwner.getLastLocation()), chargeFor, TeleportCause.COMMAND);
+ final Location loc = teleportOwner.getLastLocation();
+ teleportOwner.sendMessage(_("backUsageMsg", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ teleport(teleportOwner, new LocationTarget(loc), chargeFor, TeleportCause.COMMAND);
}
//This function is used to throw a user back after a jail sentence
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
index 1dedafd9e..ebe305f93 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
@@ -27,7 +27,6 @@ public class Commandback extends EssentialsCommand
}
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.sendMessage(_("backUsageMsg"));
user.getTeleport().back(charge);
throw new NoChargeException();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
index 4909cb059..b088c31e6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
@@ -23,8 +23,9 @@ public class Commandtop extends EssentialsCommand
final int topZ = user.getLocation().getBlockZ();
final float pitch = user.getLocation().getPitch();
final float yaw = user.getLocation().getYaw();
- final Location location = LocationUtil.getSafeDestination(new Location(user.getWorld(), topX, user.getWorld().getMaxHeight(), topZ, yaw, pitch));
- user.getTeleport().teleport(location, new Trade(this.getName(), ess), TeleportCause.COMMAND);
- user.sendMessage(_("teleportTop"));
+ final Location loc = LocationUtil.getSafeDestination(new Location(user.getWorld(), topX, user.getWorld().getMaxHeight(), topZ, yaw, pitch));
+ user.getTeleport().teleport(loc, new Trade(this.getName(), ess), TeleportCause.COMMAND);
+ user.sendMessage(_("teleportTop", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index 119e45f5d..28ae06f39 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -36,7 +36,6 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.worlds." + player.getWorld().getName()));
}
- user.sendMessage(_("teleporting"));
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.getTeleport().teleport(player.getBase(), charge, TeleportCause.COMMAND);
@@ -54,14 +53,14 @@ public class Commandtp extends EssentialsCommand
{
throw new NotEnoughArgumentsException("Value of coordinates cannot be over 30000000"); //TODO: I18n
}
- final Location location = new Location(target2.getWorld(), x, y, z, target2.getLocation().getYaw(), target2.getLocation().getPitch());
+ final Location loc = new Location(target2.getWorld(), x, y, z, target2.getLocation().getYaw(), target2.getLocation().getPitch());
if (!target2.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", target2.getDisplayName()));
}
- target2.getTeleport().now(location, false, TeleportCause.COMMAND);
- user.sendMessage(_("teleporting"));
- target2.sendMessage(_("teleporting"));
+ target2.getTeleport().now(loc, false, TeleportCause.COMMAND);
+ user.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ target2.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
break;
case 2:
default:
@@ -85,7 +84,6 @@ public class Commandtp extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.worlds." + toPlayer.getWorld().getName()));
}
target.getTeleport().now(toPlayer.getBase(), false, TeleportCause.COMMAND);
- user.sendMessage(_("teleporting"));
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
break;
}
@@ -115,12 +113,14 @@ public class Commandtp extends EssentialsCommand
{
throw new NotEnoughArgumentsException("Value of coordinates cannot be over 30000000"); //TODO: I18n
}
- final Location location = new Location(target.getWorld(), x, y, z, target.getLocation().getYaw(), target.getLocation().getPitch());
- target.getTeleport().now(location, false, TeleportCause.COMMAND);
- target.sendMessage(_("teleporting"));
- } else {
+ final Location loc = new Location(target.getWorld(), x, y, z, target.getLocation().getYaw(), target.getLocation().getPitch());
+ target.getTeleport().now(loc, false, TeleportCause.COMMAND);
+ target.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ sender.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ }
+ else
+ {
throw new NotEnoughArgumentsException();
}
- sender.sendMessage(_("teleporting"));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 65930cca2..afff0f4ab 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
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;
@@ -59,7 +60,9 @@ public class Commandtpaccept extends EssentialsCommand
{
if (user.isTpRequestHere())
{
+ final Location loc = user.getTpRequestLocation();
requester.getTeleport().teleportPlayer(user, user.getTpRequestLocation(), charge, TeleportCause.COMMAND);
+ requester.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
else
{
@@ -70,7 +73,7 @@ public class Commandtpaccept extends EssentialsCommand
{
user.sendMessage(_("pendingTeleportCancelled"));
ess.showError(requester.getSource(), ex, commandLabel);
- }
+ }
user.requestTeleport(null, false);
throw new NoChargeException();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
index 74a0136e7..360f9ca2a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
+import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -35,6 +36,7 @@ public class Commandtpall extends EssentialsCommand
private void teleportAllPlayers(Server server, CommandSource sender, User target)
{
sender.sendMessage(_("teleportAll"));
+ final Location loc = target.getLocation();
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
@@ -50,7 +52,7 @@ public class Commandtpall extends EssentialsCommand
}
try
{
- player.getTeleport().now(target.getBase(), false, TeleportCause.COMMAND);
+ player.getTeleport().now(loc, 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 bc5972218..5c47cffad 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
@@ -28,8 +28,6 @@ public class Commandtphere extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName()));
}
user.getTeleport().teleportPlayer(player, user.getBase(), 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 45ed0dfb1..cd80b45fd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -28,7 +28,6 @@ public class Commandtpo extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.worlds." + player.getWorld().getName()));
}
- user.sendMessage(_("teleporting"));
user.getTeleport().now(player.getBase(), false, TeleportCause.COMMAND);
break;
@@ -37,7 +36,6 @@ public class Commandtpo extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.tp.others"));
}
- user.sendMessage(_("teleporting"));
final User target = getPlayer(server, user, args, 0);
final User toPlayer = getPlayer(server, user, args, 1);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
index c4e9cd907..c23c43587 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
@@ -32,7 +32,5 @@ public class Commandtpohere extends EssentialsCommand
// Verify permission
player.getTeleport().now(user.getBase(), false, TeleportCause.COMMAND);
- user.sendMessage(_("teleporting"));
-
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
index 2b8ce49e3..a3b703510 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
@@ -27,14 +27,14 @@ public class Commandtppos extends EssentialsCommand
final double x = args[0].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[0].substring(1)) : Integer.parseInt(args[0]);
final double y = args[1].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
final double z = args[2].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
- final Location location = new Location(user.getWorld(), x, y, z, user.getLocation().getYaw(), user.getLocation().getPitch());
+ final Location loc = new Location(user.getWorld(), x, y, z, user.getLocation().getYaw(), user.getLocation().getPitch());
if (args.length > 3)
{
- location.setYaw((Float.parseFloat(args[3]) + 180 + 360) % 360);
+ loc.setYaw((Float.parseFloat(args[3]) + 180 + 360) % 360);
}
if (args.length > 4)
{
- location.setPitch(Float.parseFloat(args[4]));
+ loc.setPitch(Float.parseFloat(args[4]));
}
if (x > 30000000 || y > 30000000 || z > 30000000 || x < -30000000 || y < -30000000 || z < -30000000)
{
@@ -42,8 +42,8 @@ public class Commandtppos extends EssentialsCommand
}
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
- user.sendMessage(_("teleporting"));
- user.getTeleport().teleport(location, charge, TeleportCause.COMMAND);
+ user.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND);
throw new NoChargeException();
}
@@ -59,22 +59,22 @@ public class Commandtppos extends EssentialsCommand
final double x = args[1].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
final double y = args[2].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
final double z = args[3].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[3].substring(1)) : Integer.parseInt(args[3]);
- final Location location = new Location(user.getWorld(), x, y, z, user.getLocation().getYaw(), user.getLocation().getPitch());
+ final Location loc = new Location(user.getWorld(), x, y, z, user.getLocation().getYaw(), user.getLocation().getPitch());
if (args.length > 4)
{
- location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360);
+ loc.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360);
}
if (args.length > 5)
{
- location.setPitch(Float.parseFloat(args[5]));
+ loc.setPitch(Float.parseFloat(args[5]));
}
if (x > 30000000 || y > 30000000 || z > 30000000 || x < -30000000 || y < -30000000 || z < -30000000)
{
throw new NotEnoughArgumentsException("Value of coordinates cannot be over 30000000"); //TODO: I18n
}
- sender.sendMessage(_("teleporting"));
- user.sendMessage(_("teleporting"));
- user.getTeleport().teleport(location, null, TeleportCause.COMMAND);
+ sender.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ user.sendMessage(_("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
+ user.getTeleport().teleport(loc, null, TeleportCause.COMMAND);
}
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index 2317e774c..cccce4284 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -28,16 +28,15 @@ public class Commandspawn extends EssentialsCommand
if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
{
final User otherUser = getPlayer(server, user, args, 0);
- respawn(user, otherUser, charge);
+ respawn(user.getSource(), user, otherUser, charge);
if (!otherUser.equals(user))
{
otherUser.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
- user.sendMessage(_("teleporting"));
}
}
else
{
- respawn(user, user, charge);
+ respawn(user.getSource(), user, user, charge);
}
throw new NoChargeException();
}
@@ -50,15 +49,16 @@ public class Commandspawn extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final User user = getPlayer(server, args, 0, true, false);
- respawn(null, user, null);
+ respawn(sender, null, user, null);
user.sendMessage(_("teleportAtoB", Console.NAME, "spawn"));
- sender.sendMessage(_("teleporting"));
+
}
- private void respawn(final User teleportOwner, final User teleportee, final Trade charge) throws Exception
+ private void respawn(final CommandSource sender, final User teleportOwner, final User teleportee, final Trade charge) throws Exception
{
final SpawnStorage spawns = (SpawnStorage)this.module;
final Location spawn = spawns.getSpawn(teleportee.getGroup());
+ sender.sendMessage(_("teleporting", spawn.getWorld().getName(), spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()));
if (teleportOwner == null)
{
teleportee.getTeleport().now(spawn, false, TeleportCause.COMMAND);