From ad47ce7d1b3f058881aabdeeabe89f284603bac5 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Thu, 1 Sep 2011 19:18:56 -0600 Subject: [PATCH] Add Bed Respawns back in! Thanks @Vaht --- .../MultiverseCore/listeners/MVPlayerListener.java | 9 +++++++-- src/main/resources/defaults/config.yml | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java index 166a9aff..cadcbcd8 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java @@ -1,5 +1,7 @@ package com.onarandombox.MultiverseCore.listeners; +import java.util.logging.Level; + import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; @@ -59,14 +61,17 @@ public class MVPlayerListener extends PlayerListener { @Override public void onPlayerRespawn(PlayerRespawnEvent event) { - // TODO: Reimplement bed respawning, needs to be a way to persist the bed location or something otherwise it's not very effective. - World world = event.getPlayer().getWorld(); // If it's not a World MV manages we stop. if (!this.worldManager.isMVWorld(world.getName())) { return; } + + if(event.isBedSpawn() && this.plugin.getConfig().getBoolean("bedrespawn", true)) { + this.plugin.log(Level.FINE, "Spawning " + event.getPlayer().getName() + " at their bed"); + return; + } // Get the MVWorld MVWorld mvWorld = this.worldManager.getMVWorld(world.getName()); diff --git a/src/main/resources/defaults/config.yml b/src/main/resources/defaults/config.yml index e5f62255..ffbc5ab1 100644 --- a/src/main/resources/defaults/config.yml +++ b/src/main/resources/defaults/config.yml @@ -30,6 +30,10 @@ disableautoheal: false # Players will be notified when they punch/shoot and it's not allowed. fakepvp: false +# When this is enabled, users will spawn at their last bed slept at. If the bed is destroyed or obstructed, +# they will spawn according to your mvm respawn rules, and then whatever the server does. +bedrespawn: true + # This just signifies the version number so we can see what version of config you have. # NEVER TOUCH THIS VALUE version: 2.1 \ No newline at end of file