PaperMC/patches/server/Add-PlayerPostRespawnEvent.patch

59 lines
3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Fri, 26 Oct 2018 21:31:00 -0700
Subject: [PATCH] Add PlayerPostRespawnEvent
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
2021-06-13 11:41:07 +02:00
2024-06-13 22:14:13 +02:00
entityplayer1.addTag(s);
}
+ // Paper start - Add PlayerPostRespawnEvent
2021-06-11 14:02:28 +02:00
+ boolean isBedSpawn = false;
+ boolean isRespawn = false;
+ // Paper end - Add PlayerPostRespawnEvent
2024-06-13 22:14:13 +02:00
2021-06-11 14:02:28 +02:00
// CraftBukkit start - fire PlayerRespawnEvent
2024-06-13 22:14:13 +02:00
DimensionTransition dimensiontransition;
2021-06-11 14:02:28 +02:00
@@ -0,0 +0,0 @@ public abstract class PlayerList {
2024-06-13 22:14:13 +02:00
dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING, reason);
2021-06-11 14:02:28 +02:00
if (!flag) entityplayer.reset(); // SPIGOT-4785
+ // Paper start - Add PlayerPostRespawnEvent
+ isRespawn = true;
+ location = CraftLocation.toBukkit(dimensiontransition.pos(), dimensiontransition.newLevel().getWorld(), dimensiontransition.yRot(), dimensiontransition.xRot());
+ // Paper end - Add PlayerPostRespawnEvent
2021-06-11 14:02:28 +02:00
} else {
2024-06-13 22:14:13 +02:00
dimensiontransition = new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), DimensionTransition.DO_NOTHING);
2021-06-11 14:02:28 +02:00
}
2024-06-13 22:14:13 +02:00
@@ -0,0 +0,0 @@ public abstract class PlayerList {
if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) {
entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver.getRandom().nextLong()));
}
+ // Paper start - Add PlayerPostRespawnEvent
+ if (iblockdata.is(net.minecraft.tags.BlockTags.BEDS) && !dimensiontransition.missingRespawnBlock()) {
+ isBedSpawn = true;
+ }
+ // Paper end - Add PlayerPostRespawnEvent
}
// Added from changeDimension
this.sendAllPlayerInfo(entityplayer); // Update health, etc...
2021-06-11 14:02:28 +02:00
@@ -0,0 +0,0 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer);
}
+
+ // Paper start - Add PlayerPostRespawnEvent
2021-06-11 14:02:28 +02:00
+ if (isRespawn) {
+ cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn));
+ }
+ // Paper end - Add PlayerPostRespawnEvent
2021-06-11 14:02:28 +02:00
+
// CraftBukkit end
2024-06-13 22:14:13 +02:00
2021-06-11 14:02:28 +02:00
return entityplayer1;