Remove players from vehicle when changing world via NMS methods.

This commit is contained in:
md_5 2017-04-21 14:56:41 +10:00
parent 0ab698655b
commit 7b044defc0

View file

@ -356,7 +356,7 @@
UUID uuid = EntityHuman.a(gameprofile);
ArrayList arraylist = Lists.newArrayList();
@@ -371,17 +525,26 @@
@@ -371,17 +525,27 @@
}
return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object);
@ -371,6 +371,7 @@
+ }
+
+ public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
+ entityplayer.stopRiding(); // CraftBukkit
entityplayer.x().getTracker().untrackPlayer(entityplayer);
- entityplayer.x().getTracker().untrackEntity(entityplayer);
+ // entityplayer.x().getTracker().untrackEntity(entityplayer); // CraftBukkit
@ -384,7 +385,7 @@
entityplayer.dimension = i;
Object object;
@@ -392,6 +555,11 @@
@@ -392,6 +556,11 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
@ -396,7 +397,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyTo(entityplayer, flag);
@@ -406,43 +574,157 @@
@@ -406,43 +575,157 @@
entityplayer1.a(s);
}
@ -571,7 +572,7 @@
public void f(EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
int i = this.isOp(gameprofile) ? this.operators.a(gameprofile) : 0;
@@ -481,12 +763,111 @@
@@ -481,12 +764,111 @@
}
public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
@ -683,7 +684,7 @@
if (entity.dimension == -1) {
d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
d1 = MathHelper.a(d1 / 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
@@ -505,6 +886,8 @@
@@ -505,6 +887,8 @@
BlockPosition blockposition;
if (i == 1) {
@ -692,7 +693,7 @@
blockposition = worldserver1.getSpawn();
} else {
blockposition = worldserver1.getDimensionSpawn();
@@ -518,16 +901,27 @@
@@ -518,16 +902,27 @@
worldserver.entityJoinedWorld(entity, false);
}
}
@ -723,7 +724,7 @@
worldserver1.entityJoinedWorld(entity, false);
}
@@ -535,11 +929,23 @@
@@ -535,11 +930,23 @@
}
entity.spawnIn(worldserver1);
@ -748,7 +749,7 @@
this.u = 0;
}
@@ -552,6 +958,25 @@
@@ -552,6 +959,25 @@
}
@ -774,7 +775,7 @@
public void a(Packet<?> packet, int i) {
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@@ -650,11 +1075,23 @@
@@ -650,11 +1076,23 @@
this.operators.add(new OpListEntry(gameprofile, this.server.q(), this.operators.b(gameprofile)));
this.b(this.a(gameprofile.getId()), i);
@ -798,7 +799,7 @@
}
private void b(EntityPlayer entityplayer, int i) {
@@ -679,7 +1116,7 @@
@@ -679,7 +1117,7 @@
}
public boolean isOp(GameProfile gameprofile) {
@ -807,7 +808,7 @@
}
@Nullable
@@ -703,6 +1140,12 @@
@@ -703,6 +1141,12 @@
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@ -820,7 +821,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
@@ -750,7 +1193,7 @@
@@ -750,7 +1194,7 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@ -829,7 +830,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
@@ -758,16 +1201,21 @@
@@ -758,16 +1202,21 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
if (worldserver.W()) {
@ -855,7 +856,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
@@ -780,7 +1228,7 @@
@@ -780,7 +1229,7 @@
}
public String[] getSeenPlayers() {
@ -864,7 +865,7 @@
}
public boolean getHasWhitelist() {
@@ -829,17 +1277,29 @@
@@ -829,17 +1278,29 @@
}
public void u() {
@ -897,7 +898,7 @@
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@@ -876,8 +1336,10 @@
@@ -876,8 +1337,10 @@
WorldServer[] aworldserver = this.server.worldServer;
int j = aworldserver.length;