Paper/CraftBukkit-Patches/0051-Implement-respawn-API.patch

30 lines
1018 B
Diff
Raw Normal View History

From cf5885b4e85cef41dd80102a7b1c04301a88a47c Mon Sep 17 00:00:00 2001
From: ninja- <xninja@openmailbox.org>
Date: Tue, 8 Oct 2013 14:34:49 +0200
Subject: [PATCH] Implement respawn API.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6ac6520..1a9c381 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1305,6 +1305,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().collidesWithEntities = collides;
getHandle().k = collides; // First boolean of Entity
}
+
+ @Override
+ public void respawn()
+ {
+ if ( getHealth() <= 0 && isOnline() )
+ {
+ server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false );
+ }
+ }
};
public Player.Spigot spigot()
--
1.9.1