mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 19:22:50 +01:00
API to prevent PlayerBedLeaveEvent from changing a player's spawn location
This commit is contained in:
parent
3831ae621f
commit
1486c29516
1 changed files with 8 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue