Only list bed home if it is set.

This commit is contained in:
KHobbits 2012-01-28 01:39:51 +00:00
parent 137b60c5f2
commit 2f96c9763f

View file

@ -58,11 +58,15 @@ public class Commandhome extends EssentialsCommand
}
catch (NotEnoughArgumentsException e)
{
Location bed = player.getBedSpawnLocation();
if (bed != null && bed.getBlock().getType() != Material.BED_BLOCK)
{
bed = null;
}
final List<String> homes = player.getHomes();
if (homes.isEmpty() && player.equals(user))
{
final Location bed = player.getBedSpawnLocation();
if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
if (bed != null)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
throw new NoChargeException();
@ -80,7 +84,10 @@ public class Commandhome extends EssentialsCommand
}
else
{
homes.add("bed");
if (bed != null)
{
homes.add("bed");
}
user.sendMessage(_("homes", Util.joinList(homes)));
}
}