From 1486c295167e8bf63b00a07e281f3e4fa33a21a3 Mon Sep 17 00:00:00 2001 From: Senmori Date: Wed, 29 Aug 2018 19:06:33 +1000 Subject: API to prevent PlayerBedLeaveEvent from changing a player's spawn location --- nms-patches/EntityHuman.patch | 15 ++++++++------- 1 file 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); } -- cgit v1.2.3