summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java14
2 files changed, 12 insertions, 11 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index 9c21ffc6d..9d05f9368 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -277,14 +277,9 @@ public class Teleport implements Runnable, ITeleport
{
now(new Target(user.getLastLocation()), TeleportCause.COMMAND);
}
-
- public void home(IUser user, String home, Trade chargeFor) throws Exception
+
+ public void home(Location loc, Trade chargeFor) throws Exception
{
- final Location loc = user.getHome(home);
- if (loc == null)
- {
- throw new NotEnoughArgumentsException();
- }
teleport(new Target(loc), chargeFor, TeleportCause.COMMAND);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index bc59f4c2b..4a28565ee 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
+import com.earth2me.essentials.Teleport;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
@@ -96,11 +97,16 @@ public class Commandhome extends EssentialsCommand
private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
{
- if (user.getWorld() != player.getHome(home).getWorld() && ess.getSettings().isWorldTeleportPermissions()
- && !user.isAuthorized("essentials.world." + player.getHome(home).getWorld().getName()))
+ final Location loc = player.getHome(home);
+ if (loc == null)
{
- throw new Exception(_("noPerm", "essentials.world." + player.getHome(home).getWorld().getName()));
+ throw new NotEnoughArgumentsException();
}
- user.getTeleport().home(player, home, charge);
+ if (user.getWorld() != loc.getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !user.isAuthorized("essentials.world." + loc.getWorld().getName()))
+ {
+ throw new Exception(_("noPerm", "essentials.world." + loc.getWorld().getName()));
+ }
+ user.getTeleport().home(loc, charge);
}
}