summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-07-12 16:34:18 +0100
committerKHobbits <rob@khobbits.co.uk>2014-07-12 16:34:18 +0100
commit5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d (patch)
tree40e532990fa9c65ef19c977837b586eda0a492e3
parent93a2b484a1a2259bcf060b71b4b3aa435dcd6d54 (diff)
downloadEssentials-5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d.tar
Essentials-5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d.tar.gz
Essentials-5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d.tar.lz
Essentials-5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d.tar.xz
Essentials-5e06f7ea1f50f009a32743c8d82d0ac0f0112e9d.zip
Prevent users from setting unsafe homes when teleport safety is disabled.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsethome.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
index 6a432d660..866a15c1e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.utils.LocationUtil;
import com.earth2me.essentials.utils.NumberUtil;
import java.util.Locale;
import org.bukkit.Location;
@@ -44,7 +45,7 @@ public class Commandsethome extends EssentialsCommand
if (usersHome == null)
{
throw new PlayerNotFoundException();
- }
+ }
}
}
}
@@ -56,6 +57,12 @@ public class Commandsethome extends EssentialsCommand
{
throw new NoSuchFieldException(tl("invalidHomeName"));
}
+
+ if (!ess.getSettings().isTeleportSafetyEnabled() && LocationUtil.isBlockUnsafeForUser(usersHome, location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ()))
+ {
+ throw new Exception(tl("unsafeTeleportDestination", location.getWorld().getName(), location.getBlockX(), location.getBlockY(), location.getBlockZ()));
+ }
+
usersHome.setHome(name, location);
user.sendMessage(tl("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ(), name));