mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Prevent users from setting unsafe homes when teleport safety is disabled.
This commit is contained in:
parent
4e6c98ac57
commit
b5976a52e0
1 changed files with 8 additions and 1 deletions
|
@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.utils.LocationUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -44,7 +45,7 @@ public class Commandsethome extends EssentialsCommand
|
||||||
if (usersHome == null)
|
if (usersHome == null)
|
||||||
{
|
{
|
||||||
throw new PlayerNotFoundException();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +57,12 @@ public class Commandsethome extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new NoSuchFieldException(tl("invalidHomeName"));
|
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);
|
usersHome.setHome(name, location);
|
||||||
user.sendMessage(tl("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ(), name));
|
user.sendMessage(tl("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ(), name));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue