Fix bugs, including invis players & non-interactible entities
This commit is contained in:
parent
58c4a73ac2
commit
2f17ab4a5f
36037
javascript/classes.js
36037
javascript/classes.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -139,22 +139,11 @@ public class EaglerSPRelayConfigRelayList {
|
|||
}
|
||||
|
||||
private static void add(String filename, Collection<RelayServer> loading, RelayType type, String url, String user, String pass) {
|
||||
if(type == RelayType.STUN) {
|
||||
|
||||
if(url == null) {
|
||||
EaglerSPRelay.logger.error("Error: Invalid [STUN] in {}, missing 'url'", filename);
|
||||
}else {
|
||||
loading.add(new RelayServer(RelayType.STUN, url));
|
||||
}
|
||||
}else if(type == RelayType.TURN) {
|
||||
if(url == null) {
|
||||
EaglerSPRelay.logger.error("Error: Invalid [TURN] in {}, missing 'url'", filename);
|
||||
}else if(user == null) {
|
||||
EaglerSPRelay.logger.error("Error: Invalid [TURN] in {}, missing 'user' for {}", filename, url);
|
||||
}else if(pass == null) {
|
||||
EaglerSPRelay.logger.error("Error: Invalid [TURN] in {}, missing 'pass' for {}", filename, url);
|
||||
}else {
|
||||
loading.add(new RelayServer(RelayType.TURN, url, user, pass));
|
||||
}
|
||||
loading.add(new RelayServer(type, url, user, pass));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,6 +128,9 @@ public class EntityTracker {
|
|||
}
|
||||
|
||||
public void untrackEntity(Entity par1Entity) {
|
||||
untrackEntity(par1Entity, false);
|
||||
}
|
||||
public void untrackEntity(Entity par1Entity, boolean asap) {
|
||||
if (par1Entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP var2 = (EntityPlayerMP) par1Entity;
|
||||
Iterator var3 = this.trackedEntities.iterator();
|
||||
|
@ -142,7 +145,7 @@ public class EntityTracker {
|
|||
|
||||
if (var5 != null) {
|
||||
this.trackedEntities.remove(var5);
|
||||
var5.sendDestroyEntityPacketToTrackedPlayers();
|
||||
var5.sendDestroyEntityPacketToTrackedPlayers(asap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -268,14 +268,22 @@ public class EntityTrackerEntry {
|
|||
}
|
||||
|
||||
public void sendDestroyEntityPacketToTrackedPlayers() {
|
||||
sendDestroyEntityPacketToTrackedPlayers(false);
|
||||
}
|
||||
|
||||
public void sendDestroyEntityPacketToTrackedPlayers(boolean asap) {
|
||||
Iterator var1 = this.trackingPlayers.iterator();
|
||||
|
||||
while (var1.hasNext()) {
|
||||
EntityPlayerMP var2 = (EntityPlayerMP) var1.next();
|
||||
//System.out.println(this.trackedEntity.getEntityName() + ": sendDestroyEntityPacketToTrackedPlayers");
|
||||
if (asap) {
|
||||
var2.playerNetServerHandler.sendPacket(new Packet29DestroyEntity(Integer.valueOf(this.trackedEntity.entityId)));
|
||||
} else {
|
||||
var2.destroyedItemsNetCache.add(Integer.valueOf(this.trackedEntity.entityId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromTrackedPlayers(EntityPlayerMP par1EntityPlayerMP) {
|
||||
if (this.trackingPlayers.contains(par1EntityPlayerMP)) {
|
||||
|
|
|
@ -188,7 +188,7 @@ public class NetServerHandler extends NetHandler {
|
|||
this.playerEntity.ridingEntity.updateRiderPosition();
|
||||
}
|
||||
|
||||
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
this.lastPosX = this.playerEntity.posX;
|
||||
this.lastPosY = this.playerEntity.posY;
|
||||
this.lastPosZ = this.playerEntity.posZ;
|
||||
|
@ -329,7 +329,7 @@ public class NetServerHandler extends NetHandler {
|
|||
}
|
||||
|
||||
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
||||
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
||||
this.playerEntity.handleFalling(this.playerEntity.posY - var3, par1Packet10Flying.onGround);
|
||||
}
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ public class NetServerHandler extends NetHandler {
|
|||
public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) {
|
||||
if (par1Packet205ClientCommand.forceRespawn == 1) {
|
||||
if (this.playerEntity.playerConqueredTheEnd) {
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, true, true);
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, true);
|
||||
} else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) {
|
||||
if (this.mcServer.isSinglePlayer()
|
||||
&& this.playerEntity.username.equals(this.mcServer.getServerOwner())) {
|
||||
|
@ -677,7 +677,7 @@ public class NetServerHandler extends NetHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false, true);
|
||||
this.playerEntity = this.mcServer.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,9 +86,9 @@ public class PlayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void cycleRenderDistance(EntityPlayerMP player) {
|
||||
public EntityPlayerMP cycleRenderDistance(EntityPlayerMP player) {
|
||||
if(player.mcServer.getServerOwner().equals(player.username)) {
|
||||
cycleAllRenderDistance(player);
|
||||
player = cycleAllRenderDistance(player);
|
||||
}else {
|
||||
if(player.lastRenderDistance != player.renderDistance) {
|
||||
// these 2 are called within recreatePlayerEntity
|
||||
|
@ -99,9 +99,10 @@ public class PlayerManager {
|
|||
// addPlayer(player.playerNetServerHandler.playerEntity);
|
||||
}
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
public void cycleAllRenderDistance(EntityPlayerMP player) {
|
||||
public EntityPlayerMP cycleAllRenderDistance(EntityPlayerMP player) {
|
||||
if(player.lastRenderDistance != player.renderDistance) {
|
||||
player.mcServer.getConfigurationManager().viewDistance = player.renderDistance;
|
||||
player.lastRenderDistance = player.renderDistance;
|
||||
|
@ -109,14 +110,19 @@ public class PlayerManager {
|
|||
curList.addAll(players);
|
||||
for(int i = 0, l = curList.size(); i < l; ++i) {
|
||||
EntityPlayerMP playerReload = (EntityPlayerMP)curList.get(i);
|
||||
boolean returnThisOne = playerReload.equals(player);
|
||||
if (playerReload.lastRenderDistance != player.renderDistance) {
|
||||
// these 2 are called within recreatePlayerEntity
|
||||
// removePlayer(playerReload);
|
||||
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, 0, true, false);
|
||||
playerReload = playerReload.playerNetServerHandler.playerEntity;
|
||||
playerReload.lastRenderDistance = playerReload.renderDistance;
|
||||
}
|
||||
if (returnThisOne) player = playerReload;
|
||||
// addPlayer(playerReload.playerNetServerHandler.playerEntity);
|
||||
}
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,16 +147,16 @@ public class PlayerManager {
|
|||
}
|
||||
|
||||
this.players.add(par1EntityPlayerMP);
|
||||
this.filterChunkLoadQueue(par1EntityPlayerMP);
|
||||
this.filterChunkLoadQueue(par1EntityPlayerMP); // above, it sets lastRenderDistance to renderDistance, meaning this never recreates the player.
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all chunks from the given player's chunk load queue that are not in
|
||||
* viewing range of the player.
|
||||
*/
|
||||
public void filterChunkLoadQueue(EntityPlayerMP par1EntityPlayerMP) {
|
||||
public EntityPlayerMP filterChunkLoadQueue(EntityPlayerMP par1EntityPlayerMP) {
|
||||
if(par1EntityPlayerMP.lastRenderDistance != par1EntityPlayerMP.renderDistance) {
|
||||
cycleRenderDistance(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP = cycleRenderDistance(par1EntityPlayerMP);
|
||||
}
|
||||
ArrayList var2 = new ArrayList(par1EntityPlayerMP.loadedChunks);
|
||||
int var3 = 0;
|
||||
|
@ -195,6 +201,7 @@ public class PlayerManager {
|
|||
par1EntityPlayerMP.loadedChunks.add(var9);
|
||||
}
|
||||
}
|
||||
return par1EntityPlayerMP;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,6 +218,8 @@ public class PlayerManager {
|
|||
|
||||
if (var6 != null) {
|
||||
var6.removePlayer(par1EntityPlayerMP);
|
||||
// long var7 = ((long) var4 + 2147483647L) | (((long) var5 + 2147483647L) << 32);
|
||||
// this.freePlayerInstance(var7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,9 +237,9 @@ public class PlayerManager {
|
|||
/**
|
||||
* update chunks around a player being moved by server logic (e.g. cart, boat)
|
||||
*/
|
||||
public void updateMountedMovingPlayer(final EntityPlayerMP par1EntityPlayerMP) {
|
||||
public EntityPlayerMP updateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
||||
if(par1EntityPlayerMP.renderDistance != par1EntityPlayerMP.lastRenderDistance) {
|
||||
cycleRenderDistance(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP = cycleRenderDistance(par1EntityPlayerMP);
|
||||
}
|
||||
int var2 = (int) par1EntityPlayerMP.posX >> 4;
|
||||
int var3 = (int) par1EntityPlayerMP.posZ >> 4;
|
||||
|
@ -262,11 +271,12 @@ public class PlayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
this.filterChunkLoadQueue(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP = this.filterChunkLoadQueue(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP.managedPosX = par1EntityPlayerMP.posX;
|
||||
par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ;
|
||||
}
|
||||
}
|
||||
return par1EntityPlayerMP;
|
||||
}
|
||||
|
||||
public boolean isPlayerWatchingChunk(EntityPlayerMP par1EntityPlayerMP, int par2, int par3) {
|
||||
|
|
|
@ -213,8 +213,8 @@ public class ServerConfigurationManager {
|
|||
* using player's dimension, update their movement when in a vehicle (e.g. cart,
|
||||
* boat)
|
||||
*/
|
||||
public void serverUpdateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
||||
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().updateMountedMovingPlayer(par1EntityPlayerMP);
|
||||
public EntityPlayerMP serverUpdateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) {
|
||||
return par1EntityPlayerMP.getServerForPlayer().getPlayerManager().updateMountedMovingPlayer(par1EntityPlayerMP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,11 +286,11 @@ public class ServerConfigurationManager {
|
|||
* Called on respawn
|
||||
*/
|
||||
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) {
|
||||
return recreatePlayerEntity(par1EntityPlayerMP, par2, par3, false);
|
||||
return recreatePlayerEntity(par1EntityPlayerMP, par2, par3, true);
|
||||
}
|
||||
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3, boolean teleport) {
|
||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP);
|
||||
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().untrackEntity(par1EntityPlayerMP, true);
|
||||
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
|
||||
this.playerEntityList.remove(par1EntityPlayerMP);
|
||||
this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension)
|
||||
|
@ -339,6 +339,15 @@ public class ServerConfigurationManager {
|
|||
var7.setPosition(var7.posX, var7.posY + 1.0D, var7.posZ);
|
||||
}
|
||||
|
||||
if (!teleport) {
|
||||
// see https://wiki.vg/index.php?title=Protocol&oldid=1092
|
||||
// footnotes of packet Respawn (0x09)
|
||||
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(((var7.dimension + 2) % 3) - 1,
|
||||
(byte) var7.worldObj.difficultySetting, var7.worldObj.getWorldInfo().getTerrainType(),
|
||||
var7.worldObj.getHeight(), var7.theItemInWorldManager.getGameType()));
|
||||
var7.playerNetServerHandler.setPlayerLocation(var7.posX, var7.posY, var7.posZ, var7.rotationYaw,
|
||||
var7.rotationPitch);
|
||||
}
|
||||
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(var7.dimension,
|
||||
(byte) var7.worldObj.difficultySetting, var7.worldObj.getWorldInfo().getTerrainType(),
|
||||
var7.worldObj.getHeight(), var7.theItemInWorldManager.getGameType()));
|
||||
|
|
|
@ -137,7 +137,7 @@ public class LANClientNetworkManager implements INetworkManager {
|
|||
}while(System.currentTimeMillis() - lm < 3000l);
|
||||
|
||||
// no channel was opened
|
||||
sock.writePacket(new IPacket06ClientFailure());
|
||||
sock.writePacket(new IPacket06ClientFailure(ipkt.peerId));
|
||||
sock.close();
|
||||
System.err.println("Relay [" + displayRelay + "|" + displayCode + "] client open data channel timeout");
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user