Breaking a bed now clears your spawn, just as if you had used the

/clearmyspawn command.
This commit is contained in:
GJ 2012-02-28 16:51:58 -05:00
parent 69b7c3077f
commit 64b46a88c9
2 changed files with 12 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -138,9 +139,18 @@ public class mcBlockListener implements Listener
int id = block.getTypeId(); int id = block.getTypeId();
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
if (event instanceof FakeBlockBreakEvent) if(event instanceof FakeBlockBreakEvent)
return; return;
//Reset player spawn back to world spawn if their bed is destroyed.
if(block.getType().equals(Material.BED_BLOCK) && LoadProperties.enableMySpawn && PP.getMySpawn(player) != null)
{
double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX();
double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY();
double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ();
String worldname = Bukkit.getServer().getWorlds().get(0).getName();
PP.setMySpawn(x, y, z, worldname);
}
/* /*
* HERBALISM * HERBALISM
*/ */