summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenmori <thesenmori@gmail.com>2018-08-29 19:06:33 +1000
committermd_5 <git@md-5.net>2018-08-29 19:08:58 +1000
commit1486c295167e8bf63b00a07e281f3e4fa33a21a3 (patch)
treec31f3c34f02852d70751179c0146f910b5631516
parent3831ae621f5b75add3ad528b1f07dd30c154fcae (diff)
downloadcraftbukkit-1486c295167e8bf63b00a07e281f3e4fa33a21a3.tar
craftbukkit-1486c295167e8bf63b00a07e281f3e4fa33a21a3.tar.gz
craftbukkit-1486c295167e8bf63b00a07e281f3e4fa33a21a3.tar.lz
craftbukkit-1486c295167e8bf63b00a07e281f3e4fa33a21a3.tar.xz
craftbukkit-1486c295167e8bf63b00a07e281f3e4fa33a21a3.zip
API to prevent PlayerBedLeaveEvent from changing a player's spawn location
-rw-r--r--nms-patches/EntityHuman.patch15
1 files changed, 8 insertions, 7 deletions
diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch
index 79cdbe3e..f6414772 100644
--- a/nms-patches/EntityHuman.patch
+++ b/nms-patches/EntityHuman.patch
@@ -332,7 +332,7 @@
this.releaseShoulderEntities();
this.a(StatisticList.CUSTOM.b(StatisticList.TIME_SINCE_REST));
this.setSize(0.2F, 0.2F);
-@@ -1212,6 +1354,23 @@
+@@ -1212,6 +1354,24 @@
this.world.everyoneSleeping();
}
@@ -348,15 +348,16 @@
+ bed = this.world.getWorld().getBlockAt(player.getLocation());
+ }
+
-+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
++ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, flag2);
+ this.world.getServer().getPluginManager().callEvent(event);
++ flag2 = event.shouldSetSpawnLocation();
+ }
+ // CraftBukkit end
+
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
this.setRespawnPosition(this.bedPosition, false);
-@@ -1263,9 +1422,11 @@
+@@ -1263,9 +1423,11 @@
if (blockposition != null) {
this.e = blockposition;
this.f = flag;
@@ -368,7 +369,7 @@
}
}
-@@ -1331,7 +1492,11 @@
+@@ -1331,7 +1493,11 @@
this.motY = d3 * 0.6D;
this.aU = f3;
this.fallDistance = 0.0F;
@@ -381,7 +382,7 @@
} else {
super.a(f, f1, f2);
}
-@@ -1631,13 +1796,17 @@
+@@ -1631,13 +1797,17 @@
}
protected void releaseShoulderEntities() {
@@ -404,7 +405,7 @@
if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
Entity entity = EntityTypes.a(nbttagcompound, this.world);
-@@ -1646,9 +1815,10 @@
+@@ -1646,9 +1816,10 @@
}
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
@@ -416,7 +417,7 @@
}
public abstract boolean isSpectator();
-@@ -1859,7 +2029,7 @@
+@@ -1859,7 +2030,7 @@
return entitymonster.c(this.a);
}