From 300ee9c72987e023e5faf0eccd01edd460c2af8c Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 11 Aug 2011 03:33:45 +0100 Subject: [PATCH] Fix sethome/seen for invalid players. --- .../src/com/earth2me/essentials/commands/Commandseen.java | 2 +- .../src/com/earth2me/essentials/commands/Commandsethome.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 6e87b116f..c355f5aff 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -30,7 +30,7 @@ public class Commandseen extends EssentialsCommand User u = ess.getOfflineUser(args[0]); if (u == null) { - return; + throw new Exception(Util.i18n("playerNotFound")); } sender.sendMessage(Util.format("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout()))); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index e07572f95..154017d43 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -30,6 +30,10 @@ public class Commandsethome extends EssentialsCommand { usersHome = ess.getOfflineUser(args[0]); } + if (usersHome == null) + { + throw new Exception(Util.i18n("playerNotFound")); + } usersHome.setHome(user.getLocation(), args[1].equalsIgnoreCase("default")); } }