disable teleport across worlds & other fixes

This commit is contained in:
ayunami2000 2022-08-23 22:37:20 -04:00
parent 4470365d6c
commit e9ab5431e2
8 changed files with 9027 additions and 9012 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -44,11 +44,17 @@ public class CommandServerTp extends CommandBase {
throw new PlayerNotFoundException();
}
var3.mountEntity((Entity) null);
// var3.mountEntity((Entity) null);
if (var11.worldObj != var3.worldObj) {
var3.travelToTheEnd(var11.dimension);
notifyAdmins(par1ICommandSender, "commands.tp.notSameDimension", new Object[0]);
return;
// var3.mcServer.getConfigurationManager().transferPlayerToDimension(var3, var11.dimension);
// var3.playerNetServerHandler.playerEntity = var3.mcServer.getConfigurationManager().recreatePlayerEntity(var3, var11.dimension, true, false);
// var3 = var3.playerNetServerHandler.playerEntity;
}
var3.mountEntity((Entity) null);
var3.playerNetServerHandler.setPlayerLocation(var11.posX, var11.posY, var11.posZ, var11.rotationYaw,
var11.rotationPitch);

View File

@ -816,7 +816,9 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
var2 = (var2 >> 5) + 2;
if (var2 > 3 && var2 < 15) {
this.renderDistance = var2 > 10 ? 10 : var2;
EntityPlayerMP fard = this.mcServer.getConfigurationManager().getPlayerEntity(this.mcServer.getServerOwner());
int maxRenderDistance = fard == null ? 10 : (fard.renderDistance > 10 ? 10 : fard.renderDistance);
this.renderDistance = var2 > maxRenderDistance ? maxRenderDistance : var2;
if(this.lastRenderDistance != this.renderDistance) {
if(this.mcServer.isSinglePlayer() && this.mcServer.getServerOwner().equals(this.username)) {
for(int i = 0; i < this.mcServer.worldServers.length; ++i) {

View File

@ -131,8 +131,10 @@ public class NetLoginHandler extends NetHandler {
if (var1 != null) {
this.kickUser(var1);
} else {
EntityPlayerMP fard = this.mcServer.getConfigurationManager().getPlayerEntity(this.mcServer.getServerOwner());
int maxRenderDistance = fard == null ? 10 : (fard.renderDistance > 10 ? 10 : fard.renderDistance);
EntityPlayerMP var2 = this.mcServer.getConfigurationManager().createPlayerForUser(this.clientUsername);
var2.renderDistance = var2.lastRenderDistance = (this.viewDistance > 10 && !this.mcServer.getServerOwner().equals(this.clientUsername)) ? 10 : this.viewDistance;
var2.renderDistance = var2.lastRenderDistance = (this.viewDistance > maxRenderDistance && !this.mcServer.getServerOwner().equals(this.clientUsername)) ? maxRenderDistance : this.viewDistance;
if (var2 != null) {
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
}else {

View File

@ -40,7 +40,11 @@ public class Packet204ClientInfo extends Packet {
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(NetHandler par1NetHandler) {
par1NetHandler.handleClientInfo(this);
try {
par1NetHandler.handleClientInfo(this);
} catch (Throwable e) {
e.printStackTrace();
}
}
/**

View File

@ -92,7 +92,7 @@ public class PlayerManager {
}else {
if(player.lastRenderDistance != player.renderDistance) {
player.lastRenderDistance = player.renderDistance;
player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, 0, true, false);
player.playerNetServerHandler.playerEntity = player.mcServer.getConfigurationManager().recreatePlayerEntity(player, player.dimension, true, false);
player = player.playerNetServerHandler.playerEntity;
}
}
@ -110,7 +110,7 @@ public class PlayerManager {
boolean returnThisOne = playerReload.equals(player);
if (playerReload.lastRenderDistance != player.renderDistance) {
playerReload.lastRenderDistance = playerReload.renderDistance = player.renderDistance;
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, 0, true, false);
playerReload.playerNetServerHandler.playerEntity = playerReload.mcServer.getConfigurationManager().recreatePlayerEntity(playerReload, playerReload.dimension, true, false);
playerReload = playerReload.playerNetServerHandler.playerEntity;
}
if (returnThisOne) player = playerReload;

View File

@ -297,9 +297,8 @@ public class ServerConfigurationManager {
.removePlayerEntityDangerously(par1EntityPlayerMP);
ChunkCoordinates var4 = par1EntityPlayerMP.getBedLocation();
boolean var5 = par1EntityPlayerMP.isSpawnForced();
if (teleport) {
par1EntityPlayerMP.dimension = par2;
}
int startDim = par1EntityPlayerMP.dimension;
par1EntityPlayerMP.dimension = par2;
Object var6 = new ItemInWorldManager(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension));
EntityPlayerMP var7 = new EntityPlayerMP(this.mcServer,
@ -339,7 +338,7 @@ public class ServerConfigurationManager {
var7.setPosition(var7.posX, var7.posY + 1.0D, var7.posZ);
}
if (!teleport) {
if (startDim != par2) {
// 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,