diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 015213da0..a20fcd541 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -337,4 +337,6 @@ public interface ISettings extends IConf { Set> getNickBlacklist(); double getMaxProjectileSpeed(); + + boolean isSpawnIfNoHome(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 586ec8529..ba965e225 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -1624,4 +1624,9 @@ public class Settings implements net.ess3.api.ISettings { public double getMaxProjectileSpeed() { return maxProjectileSpeed; } + + @Override + public boolean isSpawnIfNoHome() { + return config.getBoolean("spawn-if-no-home", true); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 6885dbdfd..cd4a0309e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -53,7 +53,11 @@ public class Commandhome extends EssentialsCommand { Location bed = player.getBase().getBedSpawnLocation(); final List homes = player.getHomes(); if (homes.isEmpty() && player.equals(user)) { - user.getTeleport().respawn(charge, TeleportCause.COMMAND); + if (ess.getSettings().isSpawnIfNoHome()) { + user.getTeleport().respawn(charge, TeleportCause.COMMAND); + } else { + throw new Exception(tl("noHomeSetPlayer")); + } } else if (homes.isEmpty()) { throw new Exception(tl("noHomeSetPlayer")); } else if (homes.size() == 1 && player.equals(user)) { diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 094e93b73..7a9bb6933 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -920,6 +920,9 @@ spawn-join-listener-priority: high # When users die, should they respawn at their first home or bed, instead of the spawnpoint? respawn-at-home: false +# If no home is set, would you like to send the player to spawn? (Only applies to /home) +spawn-if-no-home: true + # Teleport all joining players to the spawnpoint spawn-on-join: false # The following value of `guests` states that all players in group `guests` will be teleported to spawn when joining.