mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
56 lines
2.8 KiB
Diff
56 lines
2.8 KiB
Diff
|
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
|
||
|
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||
|
index f9794c0eaced71d242cb04b0815bad322ed7165d..7fa13f1fe02a1bdfa93c76e9c2eefc81c9bded50 100644
|
||
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||
|
@@ -738,6 +738,10 @@ public abstract class PlayerList {
|
||
|
|
||
|
entityplayer1.addTag(s);
|
||
|
}
|
||
|
+ // Paper start - Add PlayerPostRespawnEvent
|
||
|
+ boolean isBedSpawn = false;
|
||
|
+ boolean isRespawn = false;
|
||
|
+ // Paper end - Add PlayerPostRespawnEvent
|
||
|
|
||
|
// CraftBukkit start - fire PlayerRespawnEvent
|
||
|
DimensionTransition dimensiontransition;
|
||
|
@@ -745,6 +749,7 @@ public abstract class PlayerList {
|
||
|
dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING, reason);
|
||
|
|
||
|
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||
|
+ isRespawn = true; // Paper - Add PlayerPostRespawnEvent
|
||
|
} else {
|
||
|
dimensiontransition = new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), DimensionTransition.DO_NOTHING);
|
||
|
}
|
||
|
@@ -795,6 +800,11 @@ 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...
|
||
|
@@ -816,6 +826,13 @@ public abstract class PlayerList {
|
||
|
if (entityplayer.connection.isDisconnected()) {
|
||
|
this.save(entityplayer);
|
||
|
}
|
||
|
+
|
||
|
+ // Paper start - Add PlayerPostRespawnEvent
|
||
|
+ if (isRespawn) {
|
||
|
+ cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn));
|
||
|
+ }
|
||
|
+ // Paper end - Add PlayerPostRespawnEvent
|
||
|
+
|
||
|
// CraftBukkit end
|
||
|
|
||
|
return entityplayer1;
|