summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-05-22 00:39:23 +0100
committerKHobbits <rob@khobbits.co.uk>2012-05-22 00:39:23 +0100
commitb841878a33759a414483cb7d0883549a9b9f120e (patch)
tree444a26b270fba9ffaae9698c88f17e8215eea462
parente4e1c950b5c04ebb48742379f2fa06272ca1b28c (diff)
downloadEssentials-b841878a33759a414483cb7d0883549a9b9f120e.tar
Essentials-b841878a33759a414483cb7d0883549a9b9f120e.tar.gz
Essentials-b841878a33759a414483cb7d0883549a9b9f120e.tar.lz
Essentials-b841878a33759a414483cb7d0883549a9b9f120e.tar.xz
Essentials-b841878a33759a414483cb7d0883549a9b9f120e.zip
Patch null error in /home after recent update.
-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);
}
}