mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-24 08:22:56 +01:00
Check bed still exist, for bed homes.
This commit is contained in:
parent
085250c72f
commit
72885e1d6c
@ -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();
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user