Archiviert
13
0

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

Dieser Commit ist enthalten in:
Zach Brown 2016-03-22 12:39:41 -05:00 committet von md_5
Ursprung ace06bd9fd
Commit 712213dacc
2 geänderte Dateien mit 45 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -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() {

Datei anzeigen

@ -391,7 +391,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyTo(entityplayer, flag);
@@ -414,43 +577,155 @@
@@ -414,43 +577,156 @@
entityplayer1.a(s);
}
@ -520,6 +520,7 @@
+ Location exit = null;
+ boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
+ if (exitWorld != null) {
+ entityplayer.cj = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+ if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
+ // THE_END -> NORMAL; use bed if available, otherwise default spawn
+ exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
@ -565,7 +566,7 @@
public void f(EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
int i = this.isOp(gameprofile) ? this.operators.a(gameprofile) : 0;
@@ -489,12 +764,111 @@
@@ -489,12 +765,111 @@
}
public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
@ -677,7 +678,7 @@
if (entity.dimension == -1) {
d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
@@ -513,6 +887,8 @@
@@ -513,6 +888,8 @@
BlockPosition blockposition;
if (i == 1) {
@ -686,7 +687,7 @@
blockposition = worldserver1.getSpawn();
} else {
blockposition = worldserver1.getDimensionSpawn();
@@ -526,15 +902,26 @@
@@ -526,15 +903,26 @@
worldserver.entityJoinedWorld(entity, false);
}
}
@ -715,7 +716,7 @@
worldserver1.addEntity(entity);
worldserver1.entityJoinedWorld(entity, false);
}
@@ -543,6 +930,7 @@
@@ -543,6 +931,7 @@
}
entity.spawnIn(worldserver1);
@ -723,7 +724,7 @@
}
public void tick() {
@@ -560,6 +948,25 @@
@@ -560,6 +949,25 @@
}
@ -749,7 +750,7 @@
public void a(Packet<?> packet, int i) {
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@@ -658,11 +1065,23 @@
@@ -658,11 +1066,23 @@
this.operators.add(new OpListEntry(gameprofile, this.server.q(), this.operators.b(gameprofile)));
this.b(this.a(gameprofile.getId()), i);
@ -773,7 +774,7 @@
}
private void b(EntityPlayer entityplayer, int i) {
@@ -687,7 +1106,7 @@
@@ -687,7 +1107,7 @@
}
public boolean isOp(GameProfile gameprofile) {
@ -782,7 +783,7 @@
}
public EntityPlayer getPlayer(String s) {
@@ -710,6 +1129,12 @@
@@ -710,6 +1130,12 @@
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@ -795,7 +796,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
@@ -757,21 +1182,26 @@
@@ -757,21 +1183,26 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@ -827,7 +828,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
@@ -784,7 +1214,7 @@
@@ -784,7 +1215,7 @@
}
public String[] getSeenPlayers() {
@ -836,7 +837,7 @@
}
public boolean getHasWhitelist() {
@@ -834,16 +1264,26 @@
@@ -834,16 +1265,26 @@
public void u() {
for (int i = 0; i < this.players.size(); ++i) {
@ -865,7 +866,7 @@
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@@ -880,8 +1320,10 @@
@@ -880,8 +1321,10 @@
WorldServer[] aworldserver = this.server.worldServer;
int j = aworldserver.length;