Permalink
Browse files

fixed bug when items which don't fit in the player's inventory upon

respawn drop at the wrong location
  • Loading branch information...
Bone008
Bone008 committed Jan 2, 2012
1 parent a5c8632 commit 084ffec2f6a2feba0d12e8d2239a579226470171
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/bone008/bukkit/deathcontrol/DeathControlPlayerListener.java
@@ -15,12 +15,19 @@ public DeathControlPlayerListener(DeathControl plugin){
@Override
public void onPlayerRespawn(PlayerRespawnEvent event){
- Player ply = event.getPlayer();
+ final Player ply = event.getPlayer();
- DeathManager m = plugin.managers.get(ply);
- if(m != null){
- m.respawned();
- }
+ // delay this for the next tick to make sure the player fully respawned to get the correct location
+ // don't use getRespawnLocation(), because it might still be changed by another plugin - this way is safer
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ @Override
+ public void run() {
+ DeathManager m = plugin.managers.get(ply);
+ if(m != null){
+ m.respawned();
+ }
+ }
+ });
}

0 comments on commit 084ffec

Please sign in to comment.