diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-01-28 00:49:22 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-01-28 00:49:22 +0000 |
commit | f7c6759433b814d317ffe79d0276d76e0a94a3d8 (patch) | |
tree | 3b61e0d035d93b3a0c95b33baef0e5040c93446c | |
parent | 51375026461495e882e8cf2bddae213f370dd97f (diff) | |
download | Essentials-f7c6759433b814d317ffe79d0276d76e0a94a3d8.tar Essentials-f7c6759433b814d317ffe79d0276d76e0a94a3d8.tar.gz Essentials-f7c6759433b814d317ffe79d0276d76e0a94a3d8.tar.lz Essentials-f7c6759433b814d317ffe79d0276d76e0a94a3d8.tar.xz Essentials-f7c6759433b814d317ffe79d0276d76e0a94a3d8.zip |
Check bed still exist, for bed homes.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandhome.java | 3 | ||||
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 55bd75d0c..2bd09468e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -7,6 +7,7 @@ import com.earth2me.essentials.Util; import java.util.List; import java.util.Locale; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -61,7 +62,7 @@ public class Commandhome extends EssentialsCommand if (homes.isEmpty() && player.equals(user)) { final Location bed = player.getBedSpawnLocation(); - if (bed != null) + if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK) { user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND); throw new NoChargeException(); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 7ec9ee043..4987f6ab1 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -8,6 +8,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; @@ -36,7 +37,12 @@ public class EssentialsSpawnPlayerListener implements Listener Location home = user.getHome(user.getLocation()); if (home == null) { - home = user.getBedSpawnLocation(); + final Location bed = user.getBedSpawnLocation(); + if (bed.getBlock().getType() == Material.BED_BLOCK) + { + home = bed; + } + } if (home != null) { @@ -90,7 +96,7 @@ public class EssentialsSpawnPlayerListener implements Listener { return; } - + try { Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn()); |