Fix player dimension change invulnerability never getting unset when certain dimensions are disabled

By: Zach Brown <zach.brown@destroystokyo.com>
This commit is contained in:
CraftBukkit/Spigot
2016-03-22 12:39:41 -05:00
parent 637ea51428
commit 97cca957f7
2 changed files with 45 additions and 30 deletions

View File

@@ -18,7 +18,14 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bQ = LogManager.getLogger();
@@ -43,6 +54,18 @@
@@ -37,12 +48,24 @@
private boolean cg = true;
private long ch = System.currentTimeMillis();
private Entity ci = null;
- private boolean cj;
+ protected boolean cj; // PAIL: private -> protected, rename worldChangeInvuln
private int containerCounter;
public boolean f;
public int ping;
public boolean viewingCredits;
@@ -250,7 +257,7 @@
scoreboardscore.incrementScore();
}
@@ -381,7 +504,8 @@
@@ -381,12 +504,14 @@
}
private boolean canPvP() {
@@ -260,7 +267,14 @@
}
public Entity c(int i) {
@@ -407,7 +531,10 @@
- this.cj = true;
+ //this.cj = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
if (this.dimension == 1 && i == 1) {
+ this.cj = true; // CraftBukkit - Moved down from above
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
@@ -407,7 +532,10 @@
this.b((Statistic) AchievementList.y);
}
@@ -272,7 +286,7 @@
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
@@ -452,6 +579,7 @@
@@ -452,6 +580,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@@ -280,7 +294,7 @@
if (this.isSleeping()) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
@@ -530,23 +658,48 @@
@@ -530,23 +659,48 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@@ -338,7 +352,7 @@
if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) {
this.sendMessage((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)));
} else {
@@ -560,18 +713,21 @@
@@ -560,18 +714,21 @@
if (itileinventory.x_() && !this.a(itileinventory.y_()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.W, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
@@ -362,7 +376,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -579,8 +735,14 @@
@@ -579,8 +736,14 @@
}
public void openTrade(IMerchant imerchant) {
@@ -378,7 +392,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e();
@@ -599,14 +761,21 @@
@@ -599,14 +762,21 @@
}
@@ -402,7 +416,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -646,6 +815,11 @@
@@ -646,6 +816,11 @@
public void a(Container container, List<ItemStack> list) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@@ -414,7 +428,7 @@
}
public void setContainerData(Container container, int i, int j) {
@@ -660,6 +834,7 @@
@@ -660,6 +835,7 @@
}
public void closeInventory() {
@@ -422,7 +436,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.s();
}
@@ -741,8 +916,17 @@
@@ -741,8 +917,17 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@@ -440,7 +454,7 @@
public void b(IChatBaseComponent ichatbasecomponent) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
}
@@ -802,6 +986,8 @@
@@ -802,6 +987,8 @@
}
public void a(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@@ -449,7 +463,7 @@
this.playerInteractManager.setGameMode(worldsettings_enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) worldsettings_enumgamemode.getId()));
if (worldsettings_enumgamemode == WorldSettings.EnumGamemode.SPECTATOR) {
@@ -812,6 +998,7 @@
@@ -812,6 +999,7 @@
this.updateAbilities();
this.cq();
@@ -457,7 +471,7 @@
}
public boolean isSpectator() {
@@ -827,6 +1014,7 @@
@@ -827,6 +1015,7 @@
}
public boolean a(int i, String s) {
@@ -465,7 +479,7 @@
if ("seed".equals(s) && !this.server.aa()) {
return true;
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
@@ -840,6 +1028,12 @@
@@ -840,6 +1029,12 @@
} else {
return true;
}
@@ -478,7 +492,7 @@
}
public String A() {
@@ -938,7 +1132,7 @@
@@ -938,7 +1133,7 @@
}
public IChatBaseComponent getPlayerListName() {
@@ -487,7 +501,7 @@
}
public void a(EnumHand enumhand) {
@@ -955,11 +1149,139 @@
@@ -955,11 +1150,139 @@
}
public void M() {