Only mark player as invulnerable if they're actually changing worlds

Fixes GH-96
This commit is contained in:
Zach Brown 2016-03-20 22:38:31 -05:00
parent 84b79f3f41
commit 614aee73bc
2 changed files with 41 additions and 21 deletions

View file

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 20 Mar 2016 19:40:51 -0500
Subject: [PATCH] Only mark player as invulnerable if they're changing worlds
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private boolean cg = true;
private long ch = System.currentTimeMillis();
private Entity ci = null;
- private boolean cj;
+ protected boolean cj; // Paper - private -> protected
private int containerCounter;
public boolean f;
public int ping;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public Entity c(int i) {
- this.cj = true;
+ //this.cj = true; // Paper - Moved to PlayerList#changeDimension
if (this.dimension == 1 && i == 1) {
this.world.kill(this);
if (!this.viewingCredits) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
Location exit = null;
boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
if (exitWorld != null) {
+ entityplayer.cj = true; // Paper - Set teleport invulnerability only if they're actually changing worlds
if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
// THE_END -> NORMAL; use bed if available, otherwise default spawn
exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
--

View file

@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 20 Mar 2016 19:40:51 -0500
Subject: [PATCH] Only mark player as invulnerable if they're going to the end
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public Entity c(int i) {
- this.cj = true;
if (this.dimension == 1 && i == 1) {
+ this.cj = true; // Paper - Moved down, only mark entity as invulnerable if they're going into the end
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
--