Pull in respawn API, thanks @ninja-

This commit is contained in:
Ammar Askar 2013-10-08 18:56:05 +05:00
parent 8d12b82b81
commit 65e0f8e01f
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From 1b666e47c484bbf9b02653da53a53e978bc645dd Mon Sep 17 00:00:00 2001
From: ninja- <xninja@openmailbox.org>
Date: Tue, 8 Oct 2013 14:35:58 +0200
Subject: [PATCH] Add respawn API.
---
src/main/java/org/bukkit/entity/Player.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 9ee8f5f..8fd9a07 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -762,6 +762,14 @@ public void setCollidesWithEntities(boolean collides)
{
throw new UnsupportedOperationException( "Not supported yet." );
}
+
+ /**
+ * Respawns the player if dead.
+ */
+ public void respawn()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
}
Spigot spigot();
--
1.8.4

View File

@ -0,0 +1,31 @@
From 228b3e3112bbfc6e56b082ffabf68774f8a7c87c 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.
---
src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 33674b1..2c607aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1135,6 +1135,15 @@ public void setCollidesWithEntities(boolean collides)
getHandle().collidesWithEntities = collides;
getHandle().m = collides; // First boolean of Entity
}
+
+ @Override
+ public void respawn()
+ {
+ if ( entity.dead )
+ {
+ server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false );
+ }
+ }
};
public Player.Spigot spigot()
--
1.8.4