1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-10-01 16:46:51 +02:00

Updated EssentialsSpawn to use the new config code

/spawn and /home now call the PlayerRespawnEvent to make it more compatible with other plugins.
This commit is contained in:
snowleo
2011-12-06 13:41:29 +01:00
parent a44bd360c0
commit 4c2b9b8d0f
21 changed files with 406 additions and 79 deletions

View File

@@ -7,6 +7,8 @@ import java.util.GregorianCalendar;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerRespawnEvent;
public class Teleport implements Runnable
@@ -122,9 +124,13 @@ public class Teleport implements Runnable
this.ess = ess;
}
public void respawn(Spawn spawn, Trade chargeFor) throws Exception
public void respawn(final Trade chargeFor) throws Exception
{
teleport(new Target(spawn.getSpawn(user.getGroup())), chargeFor);
final Player player = user.getBase();
final Location bed = player.getBedSpawnLocation();
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, bed == null ? player.getWorld().getSpawnLocation() : bed, bed != null);
ess.getServer().getPluginManager().callEvent(pre);
teleport(new Target(pre.getRespawnLocation()), chargeFor);
}
public void warp(String warp, Trade chargeFor) throws Exception