mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 15:08:27 +02:00
SPIGOT-3154: Sleeping players cannot change dimensions
This commit is contained in:
parent
d09304e5db
commit
7dd77d7340
@ -244,7 +244,7 @@
|
||||
|
||||
scoreboardscore.incrementScore();
|
||||
}
|
||||
@@ -402,13 +509,15 @@
|
||||
@@ -402,13 +509,16 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@ -256,13 +256,14 @@
|
||||
@Nullable
|
||||
public Entity c(int i) {
|
||||
- this.worldChangeInvuln = true;
|
||||
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
|
||||
+ // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
if (this.dimension == 1 && i == 1) {
|
||||
+ this.worldChangeInvuln = true; // CraftBukkit - Moved down from above
|
||||
this.world.kill(this);
|
||||
if (!this.viewingCredits) {
|
||||
this.viewingCredits = true;
|
||||
@@ -429,7 +538,10 @@
|
||||
@@ -429,7 +539,10 @@
|
||||
this.b((Statistic) AchievementList.y);
|
||||
}
|
||||
|
||||
@ -274,7 +275,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
@@ -474,6 +586,7 @@
|
||||
@@ -474,6 +587,7 @@
|
||||
}
|
||||
|
||||
public void a(boolean flag, boolean flag1, boolean flag2) {
|
||||
@ -282,7 +283,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -552,23 +665,55 @@
|
||||
@@ -552,23 +666,55 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@ -341,7 +342,7 @@
|
||||
if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)), true);
|
||||
} else {
|
||||
@@ -582,18 +727,21 @@
|
||||
@@ -582,18 +728,21 @@
|
||||
if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.Y, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
|
||||
@ -365,7 +366,7 @@
|
||||
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
@@ -601,8 +749,14 @@
|
||||
@@ -601,8 +750,14 @@
|
||||
}
|
||||
|
||||
public void openTrade(IMerchant imerchant) {
|
||||
@ -381,7 +382,7 @@
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e();
|
||||
@@ -622,13 +776,20 @@
|
||||
@@ -622,13 +777,20 @@
|
||||
}
|
||||
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@ -403,7 +404,7 @@
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
@@ -665,6 +826,11 @@
|
||||
@@ -665,6 +827,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
@ -415,7 +416,7 @@
|
||||
}
|
||||
|
||||
public void setContainerData(Container container, int i, int j) {
|
||||
@@ -679,6 +845,7 @@
|
||||
@@ -679,6 +846,7 @@
|
||||
}
|
||||
|
||||
public void closeInventory() {
|
||||
@ -423,7 +424,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.s();
|
||||
}
|
||||
@@ -760,7 +927,16 @@
|
||||
@@ -760,7 +928,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
@ -440,7 +441,7 @@
|
||||
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, (byte) (flag ? 2 : 0)));
|
||||
@@ -821,6 +997,8 @@
|
||||
@@ -821,6 +998,8 @@
|
||||
}
|
||||
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@ -449,7 +450,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -831,6 +1009,7 @@
|
||||
@@ -831,6 +1010,7 @@
|
||||
|
||||
this.updateAbilities();
|
||||
this.cw();
|
||||
@ -457,7 +458,7 @@
|
||||
}
|
||||
|
||||
public boolean isSpectator() {
|
||||
@@ -846,6 +1025,7 @@
|
||||
@@ -846,6 +1026,7 @@
|
||||
}
|
||||
|
||||
public boolean a(int i, String s) {
|
||||
@ -465,7 +466,7 @@
|
||||
if ("seed".equals(s) && !this.server.aa()) {
|
||||
return true;
|
||||
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
|
||||
@@ -859,6 +1039,15 @@
|
||||
@@ -859,6 +1040,15 @@
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -481,7 +482,7 @@
|
||||
}
|
||||
|
||||
public String A() {
|
||||
@@ -870,6 +1059,12 @@
|
||||
@@ -870,6 +1060,12 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@ -494,7 +495,7 @@
|
||||
this.locale = packetplayinsettings.a();
|
||||
this.cg = packetplayinsettings.c();
|
||||
this.ch = packetplayinsettings.d();
|
||||
@@ -931,7 +1126,7 @@
|
||||
@@ -931,7 +1127,7 @@
|
||||
this.cj = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.cj) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cj));
|
||||
@ -503,7 +504,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -958,7 +1153,7 @@
|
||||
@@ -958,7 +1154,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@ -512,7 +513,7 @@
|
||||
}
|
||||
|
||||
public void a(EnumHand enumhand) {
|
||||
@@ -975,11 +1170,150 @@
|
||||
@@ -975,11 +1171,150 @@
|
||||
}
|
||||
|
||||
public void M() {
|
||||
|
Loading…
Reference in New Issue
Block a user