13
0
geforkt von Mirrors/Paper

#1095: Add PlayerSpawnChangeEvent

By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-04-17 19:33:17 +10:00
Ursprung 41bd40bcaa
Commit 9e30ea471f
5 geänderte Dateien mit 163 neuen und 89 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,11 @@
--- a/net/minecraft/server/commands/CommandSpawnpoint.java
+++ b/net/minecraft/server/commands/CommandSpawnpoint.java
@@ -41,7 +41,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- entityplayer.setRespawnPosition(resourcekey, blockposition, f, true, false);
+ entityplayer.setRespawnPosition(resourcekey, blockposition, f, true, false, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.COMMAND); // CraftBukkit
}
String s = resourcekey.location().toString();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java --- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java +++ b/net/minecraft/server/level/EntityPlayer.java
@@ -155,6 +155,36 @@ @@ -155,6 +155,37 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria; import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -28,6 +28,7 @@
+import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerChangedWorldEvent;
+import org.bukkit.event.player.PlayerLocaleChangeEvent; +import org.bukkit.event.player.PlayerLocaleChangeEvent;
+import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.event.player.PlayerPortalEvent;
+import org.bukkit.event.player.PlayerSpawnChangeEvent;
+import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent;
@ -37,7 +38,7 @@
public class EntityPlayer extends EntityHuman { public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -212,6 +242,21 @@ @@ -212,6 +243,21 @@
public int latency; public int latency;
public boolean wonGame; public boolean wonGame;
@ -59,7 +60,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile); super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL; this.chatVisibility = EnumChatVisibility.FULL;
@@ -275,12 +320,56 @@ @@ -275,12 +321,56 @@
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this); this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
this.setMaxUpStep(1.0F); this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(worldserver); this.fudgeSpawnLocation(worldserver);
@ -68,8 +69,8 @@
+ this.displayName = this.getScoreboardName(); + this.displayName = this.getScoreboardName();
+ this.bukkitPickUpLoot = true; + this.bukkitPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth(); + this.maxHealthCache = this.getMaxHealth();
} + }
+
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now. + // Yes, this doesn't match Vanilla, but it's the best we can do for now.
+ // If this is an issue, PRs are welcome + // If this is an issue, PRs are welcome
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) { + public final BlockPosition getSpawnPoint(WorldServer worldserver) {
@ -106,9 +107,9 @@
+ } + }
+ +
+ return blockposition; + return blockposition;
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
private void fudgeSpawnLocation(WorldServer worldserver) { private void fudgeSpawnLocation(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSharedSpawnPos(); BlockPosition blockposition = worldserver.getSharedSpawnPos();
@ -117,7 +118,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver)); int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ())); int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -329,7 +418,7 @@ @@ -329,7 +419,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) { public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound); super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) { if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
@ -126,7 +127,7 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -348,17 +437,26 @@ @@ -348,17 +438,26 @@
if (nbttagcompound.contains("recipeBook", 10)) { if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager()); this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
} }
@ -154,7 +155,7 @@
Logger logger1 = EntityPlayer.LOGGER; Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger1); Objects.requireNonNull(logger1);
@@ -371,7 +469,7 @@ @@ -371,7 +470,7 @@
@Override @Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) { public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
@ -163,7 +164,7 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -392,7 +490,20 @@ @@ -392,7 +491,20 @@
Entity entity = this.getRootVehicle(); Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle(); Entity entity1 = this.getVehicle();
@ -185,13 +186,13 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -417,9 +528,33 @@ @@ -417,8 +529,32 @@
nbttagcompound.put("SpawnDimension", nbtbase); nbttagcompound.put("SpawnDimension", nbtbase);
}); });
} }
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
+
} + }
+ // CraftBukkit start - World fallback code, either respawn location or global spawn + // CraftBukkit start - World fallback code, either respawn location or global spawn
+ public void spawnIn(World world) { + public void spawnIn(World world) {
@ -213,13 +214,12 @@
+ this.setPos(position.x(), position.y(), position.z()); + this.setPos(position.x(), position.y(), position.z());
+ } + }
+ this.gameMode.setLevel((WorldServer) world); + this.gameMode.setLevel((WorldServer) world);
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
public void setExperiencePoints(int i) { public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel(); float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f; @@ -478,6 +614,11 @@
@@ -478,6 +613,11 @@
@Override @Override
public void tick() { public void tick() {
@ -231,7 +231,7 @@
this.gameMode.tick(); this.gameMode.tick();
this.wardenSpawnTracker.tick(); this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime; --this.spawnInvulnerableTime;
@@ -534,7 +674,7 @@ @@ -534,7 +675,7 @@
} }
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) { if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@ -240,7 +240,7 @@
this.lastSentHealth = this.getHealth(); this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel(); this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F; this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -565,6 +705,12 @@ @@ -565,6 +706,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience)); this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
} }
@ -253,7 +253,7 @@
if (this.experienceLevel != this.lastRecordedLevel) { if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel; this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel)); this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -579,6 +725,20 @@ @@ -579,6 +726,20 @@
CriterionTriggers.LOCATION.trigger(this); CriterionTriggers.LOCATION.trigger(this);
} }
@ -274,7 +274,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked"); CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -621,7 +781,8 @@ @@ -621,7 +782,8 @@
} }
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) { private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -284,7 +284,7 @@
scoreboardscore.setScore(i); scoreboardscore.setScore(i);
}); });
} }
@@ -630,9 +791,47 @@ @@ -630,9 +792,47 @@
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@ -334,7 +334,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true; boolean flag1 = true;
@@ -663,12 +862,18 @@ @@ -663,12 +863,18 @@
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied(); this.tellNeutralMobsThatIDied();
} }
@ -357,7 +357,7 @@
EntityLiving entityliving = this.getKillCredit(); EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) { if (entityliving != null) {
@@ -706,10 +911,12 @@ @@ -706,10 +912,12 @@
String s = this.getScoreboardName(); String s = this.getScoreboardName();
String s1 = entity.getScoreboardName(); String s1 = entity.getScoreboardName();
@ -372,7 +372,7 @@
} else { } else {
this.awardStat(StatisticList.MOB_KILLS); this.awardStat(StatisticList.MOB_KILLS);
} }
@@ -727,7 +934,8 @@ @@ -727,7 +935,8 @@
int i = scoreboardteam.getColor().getId(); int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) { if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -382,7 +382,7 @@
} }
} }
@@ -777,18 +985,20 @@ @@ -777,18 +986,20 @@
} }
private boolean isPvpAllowed() { private boolean isPvpAllowed() {
@ -406,7 +406,7 @@
} else { } else {
return shapedetectorshape; return shapedetectorshape;
} }
@@ -797,11 +1007,20 @@ @@ -797,11 +1008,20 @@
@Nullable @Nullable
@Override @Override
public Entity changeDimension(WorldServer worldserver) { public Entity changeDimension(WorldServer worldserver) {
@ -430,7 +430,7 @@
this.unRide(); this.unRide();
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) { if (!this.wonGame) {
@@ -812,6 +1031,8 @@ @@ -812,6 +1032,8 @@
return this; return this;
} else { } else {
@ -439,7 +439,7 @@
WorldData worlddata = worldserver.getLevelData(); WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation())); this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
@@ -821,20 +1042,50 @@ @@ -821,20 +1043,50 @@
playerlist.sendPlayerPermissionLevel(this); playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved(); this.unsetRemoved();
@ -495,7 +495,7 @@
this.connection.resetPosition(); this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this); worldserver.addDuringPortalTeleport(this);
worldserver1.getProfiler().pop(); worldserver1.getProfiler().pop();
@@ -854,39 +1105,66 @@ @@ -854,39 +1106,66 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -568,7 +568,7 @@
} }
return optional1; return optional1;
@@ -896,13 +1174,21 @@ @@ -896,13 +1175,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) { public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension(); ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level.dimension(); ResourceKey<World> resourcekey1 = this.level.dimension();
@ -593,7 +593,7 @@
this.enteredNetherPosition = null; this.enteredNetherPosition = null;
} }
@@ -919,12 +1205,10 @@ @@ -919,19 +1206,17 @@
this.containerMenu.broadcastChanges(); this.containerMenu.broadcastChanges();
} }
@ -609,7 +609,15 @@
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
} else if (!this.bedInRange(blockposition, enumdirection)) { } else if (!this.bedInRange(blockposition, enumdirection)) {
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY); return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
@@ -948,7 +1232,36 @@ } else if (this.bedBlocked(blockposition, enumdirection)) {
return Either.left(EntityHuman.EnumBedResult.OBSTRUCTED);
} else {
- this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true);
+ this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
if (this.level.isDay()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
} else {
@@ -948,7 +1233,36 @@
} }
} }
@ -647,7 +655,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED); this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this); CriterionTriggers.SLEPT_IN_BED.trigger(this);
}); });
@@ -961,9 +1274,8 @@ @@ -961,9 +1275,8 @@
return either; return either;
} }
} }
@ -658,7 +666,7 @@
} }
@Override @Override
@@ -990,6 +1302,24 @@ @@ -990,6 +1303,24 @@
@Override @Override
public void stopSleepInBed(boolean flag, boolean flag1) { public void stopSleepInBed(boolean flag, boolean flag1) {
@ -683,7 +691,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2)); this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
} }
@@ -1038,8 +1368,9 @@ @@ -1038,8 +1369,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos())); this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
} }
@ -694,7 +702,7 @@
} }
@Override @Override
@@ -1047,13 +1378,35 @@ @@ -1047,13 +1379,35 @@
if (itileinventory == null) { if (itileinventory == null) {
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -730,7 +738,7 @@
if (container == null) { if (container == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true); this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1061,9 +1414,11 @@ @@ -1061,9 +1415,11 @@
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -744,7 +752,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -1076,13 +1431,24 @@ @@ -1076,13 +1432,24 @@
@Override @Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -771,7 +779,7 @@
this.initMenu(this.containerMenu); this.initMenu(this.containerMenu);
} }
@@ -1105,6 +1471,7 @@ @@ -1105,6 +1472,7 @@
@Override @Override
public void closeContainer() { public void closeContainer() {
@ -779,7 +787,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId)); this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer(); this.doCloseContainer();
} }
@@ -1127,6 +1494,16 @@ @@ -1127,6 +1495,16 @@
} }
this.jumping = flag; this.jumping = flag;
@ -796,7 +804,7 @@
this.setShiftKeyDown(flag1); this.setShiftKeyDown(flag1);
} }
@@ -1135,7 +1512,7 @@ @@ -1135,7 +1513,7 @@
@Override @Override
public void awardStat(Statistic<?> statistic, int i) { public void awardStat(Statistic<?> statistic, int i) {
this.stats.increment(this, statistic, i); this.stats.increment(this, statistic, i);
@ -805,7 +813,7 @@
scoreboardscore.add(i); scoreboardscore.add(i);
}); });
} }
@@ -1143,7 +1520,7 @@ @@ -1143,7 +1521,7 @@
@Override @Override
public void resetStat(Statistic<?> statistic) { public void resetStat(Statistic<?> statistic) {
this.stats.setValue(this, statistic, 0); this.stats.setValue(this, statistic, 0);
@ -814,7 +822,7 @@
} }
@Override @Override
@@ -1159,7 +1536,7 @@ @@ -1159,7 +1537,7 @@
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
MinecraftKey minecraftkey = aminecraftkey1[j]; MinecraftKey minecraftkey = aminecraftkey1[j];
@ -823,7 +831,7 @@
Objects.requireNonNull(list); Objects.requireNonNull(list);
optional.ifPresent(list::add); optional.ifPresent(list::add);
@@ -1194,6 +1571,7 @@ @@ -1194,6 +1572,7 @@
public void resetSentInfo() { public void resetSentInfo() {
this.lastSentHealth = -1.0E8F; this.lastSentHealth = -1.0E8F;
@ -831,7 +839,7 @@
} }
@Override @Override
@@ -1252,7 +1630,7 @@ @@ -1252,7 +1631,7 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -840,7 +848,7 @@
this.seenCredits = entityplayer.seenCredits; this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition; this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
@@ -1302,6 +1680,12 @@ @@ -1302,6 +1681,12 @@
@Override @Override
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) { public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
@ -853,7 +861,7 @@
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2)); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId()); worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
@@ -1311,9 +1695,9 @@ @@ -1311,9 +1696,9 @@
} }
if (worldserver == this.level) { if (worldserver == this.level) {
@ -865,7 +873,7 @@
} }
this.setYHeadRot(f); this.setYHeadRot(f);
@@ -1417,7 +1801,20 @@ @@ -1417,7 +1802,20 @@
} }
} }
@ -886,7 +894,7 @@
this.chatVisibility = packetplayinsettings.chatVisibility(); this.chatVisibility = packetplayinsettings.chatVisibility();
this.canChatColor = packetplayinsettings.chatColors(); this.canChatColor = packetplayinsettings.chatColors();
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled(); this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
@@ -1492,7 +1889,7 @@ @@ -1492,7 +1890,7 @@
if (world instanceof WorldServer) { if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world; WorldServer worldserver = (WorldServer) world;
@ -895,7 +903,7 @@
} }
if (entity != null) { if (entity != null) {
@@ -1529,7 +1926,7 @@ @@ -1529,7 +1927,7 @@
@Nullable @Nullable
public IChatBaseComponent getTabListDisplayName() { public IChatBaseComponent getTabListDisplayName() {
@ -904,7 +912,7 @@
} }
@Override @Override
@@ -1550,9 +1947,16 @@ @@ -1550,9 +1948,16 @@
return this.advancements; return this.advancements;
} }
@ -921,7 +929,7 @@
if (worldserver == this.level) { if (worldserver == this.level) {
this.connection.teleport(d0, d1, d2, f, f1); this.connection.teleport(d0, d1, d2, f, f1);
} else { } else {
@@ -1572,6 +1976,9 @@ @@ -1572,6 +1977,9 @@
this.server.getPlayerList().sendLevelInfo(this, worldserver); this.server.getPlayerList().sendLevelInfo(this, worldserver);
this.server.getPlayerList().sendAllPlayerInfo(this); this.server.getPlayerList().sendAllPlayerInfo(this);
} }
@ -931,7 +939,40 @@
} }
@@ -1762,4 +2169,146 @@ @@ -1593,6 +2001,32 @@
}
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
+ // CraftBukkit start
+ this.setRespawnPosition(resourcekey, blockposition, f, flag, flag1, PlayerSpawnChangeEvent.Cause.UNKNOWN);
+ }
+
+ public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1, PlayerSpawnChangeEvent.Cause cause) {
+ WorldServer newWorld = this.server.getLevel(resourcekey);
+ Location newSpawn = (blockposition != null) ? new Location(newWorld.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ(), f, 0) : null;
+
+ PlayerSpawnChangeEvent event = new PlayerSpawnChangeEvent(this.getBukkitEntity(), newSpawn, flag, cause);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ newSpawn = event.getNewSpawn();
+ flag = event.isForced();
+
+ if (newSpawn != null) {
+ resourcekey = ((CraftWorld) newSpawn.getWorld()).getHandle().dimension();
+ blockposition = BlockPosition.containing(newSpawn.getX(), newSpawn.getY(), newSpawn.getZ());
+ f = newSpawn.getYaw();
+ } else {
+ resourcekey = World.OVERWORLD;
+ blockposition = null;
+ f = 0.0F;
+ }
+ // CraftBukkit end
if (blockposition != null) {
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
@@ -1762,4 +2196,146 @@
this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot()); this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
this.connection.send(new ClientboundHurtAnimationPacket(this)); this.connection.send(new ClientboundHurtAnimationPacket(this));
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/players/PlayerList.java --- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java
@@ -108,6 +108,26 @@ @@ -108,6 +108,27 @@
import net.minecraft.world.scores.ScoreboardTeamBase; import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -22,12 +22,13 @@
+import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason; +import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
+import org.bukkit.event.player.PlayerSpawnChangeEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public abstract class PlayerList { public abstract class PlayerList {
public static final File USERBANLIST_FILE = new File("banned-players.json"); public static final File USERBANLIST_FILE = new File("banned-players.json");
@@ -119,14 +139,16 @@ @@ -119,14 +140,16 @@
private static final int SEND_PLAYER_INFO_INTERVAL = 600; private static final int SEND_PLAYER_INFO_INTERVAL = 600;
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server; private final MinecraftServer server;
@ -47,7 +48,7 @@
public final WorldNBTStorage playerIo; public final WorldNBTStorage playerIo;
private boolean doWhiteList; private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries; private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -138,13 +160,23 @@ @@ -138,13 +161,23 @@
private static final boolean ALLOW_LOGOUTIVATOR = false; private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn; private int sendAllPlayerInfoIn;
@ -73,7 +74,7 @@
this.server = minecraftserver; this.server = minecraftserver;
this.registries = layeredregistryaccess; this.registries = layeredregistryaccess;
this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze(); this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze();
@@ -161,9 +193,15 @@ @@ -161,9 +194,15 @@
usercache.add(gameprofile); usercache.add(gameprofile);
NBTTagCompound nbttagcompound = this.load(entityplayer); NBTTagCompound nbttagcompound = this.load(entityplayer);
ResourceKey resourcekey; ResourceKey resourcekey;
@ -90,7 +91,7 @@
Logger logger = PlayerList.LOGGER; Logger logger = PlayerList.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -190,7 +228,8 @@ @@ -190,7 +229,8 @@
s1 = networkmanager.getRemoteAddress().toString(); s1 = networkmanager.getRemoteAddress().toString();
} }
@ -100,7 +101,7 @@
WorldData worlddata = worldserver1.getLevelData(); WorldData worlddata = worldserver1.getLevelData();
entityplayer.loadGameTypes(nbttagcompound); entityplayer.loadGameTypes(nbttagcompound);
@@ -200,6 +239,7 @@ @@ -200,6 +240,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation())); playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation()));
@ -108,7 +109,7 @@
playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures()))); playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures())));
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName()))); playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -219,8 +259,10 @@ @@ -219,8 +260,10 @@
} else { } else {
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
} }
@ -120,7 +121,7 @@
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot()); playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
ServerPing serverping = this.server.getStatus(); ServerPing serverping = this.server.getStatus();
@@ -231,10 +273,61 @@ @@ -231,10 +274,61 @@
entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
this.players.add(entityplayer); this.players.add(entityplayer);
this.playersByUUID.put(entityplayer.getUUID(), entityplayer); this.playersByUUID.put(entityplayer.getUUID(), entityplayer);
@ -185,7 +186,7 @@
this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> { this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> {
entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt()); entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt());
}); });
@@ -248,8 +341,11 @@ @@ -248,8 +342,11 @@
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@ -199,7 +200,7 @@
}); });
if (entity != null) { if (entity != null) {
@@ -292,6 +388,8 @@ @@ -292,6 +389,8 @@
} }
entityplayer.initInventoryMenu(); entityplayer.initInventoryMenu();
@ -208,7 +209,7 @@
} }
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
@@ -324,30 +422,31 @@ @@ -324,30 +423,31 @@
} }
public void addWorldborderListener(WorldServer worldserver) { public void addWorldborderListener(WorldServer worldserver) {
@ -245,7 +246,7 @@
} }
@Override @Override
@@ -375,14 +474,15 @@ @@ -375,14 +475,15 @@
} }
protected void save(EntityPlayer entityplayer) { protected void save(EntityPlayer entityplayer) {
@ -263,7 +264,7 @@
if (advancementdataplayer != null) { if (advancementdataplayer != null) {
advancementdataplayer.save(); advancementdataplayer.save();
@@ -390,10 +490,24 @@ @@ -390,10 +491,24 @@
} }
@ -289,7 +290,7 @@
this.save(entityplayer); this.save(entityplayer);
if (entityplayer.isPassenger()) { if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle(); Entity entity = entityplayer.getRootVehicle();
@@ -417,18 +531,66 @@ @@ -417,18 +532,66 @@
if (entityplayer1 == entityplayer) { if (entityplayer1 == entityplayer) {
this.playersByUUID.remove(uuid); this.playersByUUID.remove(uuid);
@ -362,7 +363,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile); GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason()); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
@@ -436,10 +598,12 @@ @@ -436,10 +599,12 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires()))); ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
} }
@ -378,7 +379,7 @@
IpBanEntry ipbanentry = this.ipBans.get(socketaddress); IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason()); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
@@ -447,13 +611,25 @@ @@ -447,13 +612,25 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires()))); ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
} }
@ -407,7 +408,7 @@
UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile); UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile);
List<EntityPlayer> list = Lists.newArrayList(); List<EntityPlayer> list = Lists.newArrayList();
@@ -480,14 +656,24 @@ @@ -480,14 +657,24 @@
} }
return new EntityPlayer(this.server, this.server.overworld(), gameprofile); return new EntityPlayer(this.server, this.server.overworld(), gameprofile);
@ -433,7 +434,7 @@
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension()); WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
Optional optional; Optional optional;
@@ -499,6 +685,11 @@ @@ -499,6 +686,11 @@
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld(); WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile()); EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile());
@ -445,7 +446,7 @@
entityplayer1.connection = entityplayer.connection; entityplayer1.connection = entityplayer.connection;
entityplayer1.restoreFrom(entityplayer, flag); entityplayer1.restoreFrom(entityplayer, flag);
@@ -514,50 +705,112 @@ @@ -514,50 +706,112 @@
boolean flag2 = false; boolean flag2 = false;
@ -485,13 +486,13 @@
+ f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D); + f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
+ } + }
+ +
+ entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false); + // entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false); // CraftBukkit - not required, just copies old location into reused entity
+ flag2 = !flag && flag3; + flag2 = !flag && flag3;
+ isBedSpawn = true; + isBedSpawn = true;
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F); + location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
+ } else if (blockposition != null) { + } else if (blockposition != null) {
+ entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); + entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed + entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
+ } + }
+ } + }
@ -581,7 +582,7 @@
return entityplayer1; return entityplayer1;
} }
@@ -570,7 +823,18 @@ @@ -570,7 +824,18 @@
public void tick() { public void tick() {
if (++this.sendAllPlayerInfoIn > 600) { if (++this.sendAllPlayerInfoIn > 600) {
@ -601,7 +602,7 @@
this.sendAllPlayerInfoIn = 0; this.sendAllPlayerInfoIn = 0;
} }
@@ -587,6 +851,25 @@ @@ -587,6 +852,25 @@
} }
@ -627,7 +628,7 @@
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) { public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
@@ -665,7 +948,7 @@ @@ -665,7 +949,7 @@
} }
public void deop(GameProfile gameprofile) { public void deop(GameProfile gameprofile) {
@ -636,7 +637,7 @@
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId()); EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
if (entityplayer != null) { if (entityplayer != null) {
@@ -689,6 +972,7 @@ @@ -689,6 +973,7 @@
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0)); entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
} }
@ -644,7 +645,7 @@
this.server.getCommands().sendCommands(entityplayer); this.server.getCommands().sendCommands(entityplayer);
} }
@@ -721,6 +1005,12 @@ @@ -721,6 +1006,12 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -657,7 +658,7 @@
if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) { if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) {
double d4 = d0 - entityplayer.getX(); double d4 = d0 - entityplayer.getX();
double d5 = d1 - entityplayer.getY(); double d5 = d1 - entityplayer.getY();
@@ -760,23 +1050,35 @@ @@ -760,23 +1051,35 @@
public void reloadWhiteList() {} public void reloadWhiteList() {}
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) { public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
@ -698,7 +699,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -832,12 +1134,22 @@ @@ -832,12 +1135,22 @@
} }
public void removeAll() { public void removeAll() {
@ -723,7 +724,7 @@
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> { this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
return ichatbasecomponent; return ichatbasecomponent;
@@ -895,16 +1207,23 @@ @@ -895,16 +1208,23 @@
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now()); return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
} }
@ -751,7 +752,7 @@
Path path = file2.toPath(); Path path = file2.toPath();
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) { if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -913,7 +1232,7 @@ @@ -913,7 +1233,7 @@
} }
serverstatisticmanager = new ServerStatisticManager(this.server, file1); serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -760,7 +761,7 @@
} }
return serverstatisticmanager; return serverstatisticmanager;
@@ -921,13 +1240,13 @@ @@ -921,13 +1241,13 @@
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) { public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUUID(); UUID uuid = entityplayer.getUUID();
@ -776,7 +777,7 @@
} }
advancementdataplayer.setPlayer(entityplayer); advancementdataplayer.setPlayer(entityplayer);
@@ -978,13 +1297,20 @@ @@ -978,13 +1298,20 @@
} }
public void reloadResources() { public void reloadResources() {

Datei anzeigen

@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/block/BlockRespawnAnchor.java
+++ b/net/minecraft/world/level/block/BlockRespawnAnchor.java
@@ -80,7 +80,7 @@
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
if (entityplayer.getRespawnDimension() != world.dimension() || !blockposition.equals(entityplayer.getRespawnPosition())) {
- entityplayer.setRespawnPosition(world.dimension(), blockposition, 0.0F, false, true);
+ entityplayer.setRespawnPosition(world.dimension(), blockposition, 0.0F, false, true, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.RESPAWN_ANCHOR); // CraftBukkit
world.playSound((EntityHuman) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, SoundEffects.RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
return EnumInteractionResult.SUCCESS;
}
@@ -120,7 +120,7 @@
private void explode(IBlockData iblockdata, World world, final BlockPosition blockposition) {
world.removeBlock(blockposition, false);
- Stream stream = EnumDirection.EnumDirectionLimit.HORIZONTAL.stream();
+ Stream<EnumDirection> stream = EnumDirection.EnumDirectionLimit.HORIZONTAL.stream(); // CraftBukkit - decompile error
Objects.requireNonNull(blockposition);
boolean flag = stream.map(blockposition::relative).anyMatch((blockposition1) -> {

Datei anzeigen

@ -146,6 +146,7 @@ import org.bukkit.event.player.PlayerHideEntityEvent;
import org.bukkit.event.player.PlayerRegisterChannelEvent; import org.bukkit.event.player.PlayerRegisterChannelEvent;
import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason; import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
import org.bukkit.event.player.PlayerShowEntityEvent; import org.bukkit.event.player.PlayerShowEntityEvent;
import org.bukkit.event.player.PlayerSpawnChangeEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerUnregisterChannelEvent; import org.bukkit.event.player.PlayerUnregisterChannelEvent;
import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.EquipmentSlot;
@ -1031,9 +1032,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setBedSpawnLocation(Location location, boolean override) { public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) { if (location == null) {
getHandle().setRespawnPosition(null, null, 0.0F, override, false); getHandle().setRespawnPosition(null, null, 0.0F, override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
} else { } else {
getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), location.getYaw(), override, false); getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), location.getYaw(), override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
} }
} }