disable teleport across worlds & other fixes
This commit is contained in:
parent
4470365d6c
commit
e9ab5431e2
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -44,11 +44,17 @@ public class CommandServerTp extends CommandBase {
|
||||||
throw new PlayerNotFoundException();
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var3.mountEntity((Entity) null);
|
// var3.mountEntity((Entity) null);
|
||||||
|
|
||||||
if (var11.worldObj != var3.worldObj) {
|
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,
|
var3.playerNetServerHandler.setPlayerLocation(var11.posX, var11.posY, var11.posZ, var11.rotationYaw,
|
||||||
var11.rotationPitch);
|
var11.rotationPitch);
|
||||||
|
|
|
@ -816,7 +816,9 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
|
||||||
var2 = (var2 >> 5) + 2;
|
var2 = (var2 >> 5) + 2;
|
||||||
|
|
||||||
if (var2 > 3 && var2 < 15) {
|
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.lastRenderDistance != this.renderDistance) {
|
||||||
if(this.mcServer.isSinglePlayer() && this.mcServer.getServerOwner().equals(this.username)) {
|
if(this.mcServer.isSinglePlayer() && this.mcServer.getServerOwner().equals(this.username)) {
|
||||||
for(int i = 0; i < this.mcServer.worldServers.length; ++i) {
|
for(int i = 0; i < this.mcServer.worldServers.length; ++i) {
|
||||||
|
|
|
@ -131,8 +131,10 @@ public class NetLoginHandler extends NetHandler {
|
||||||
if (var1 != null) {
|
if (var1 != null) {
|
||||||
this.kickUser(var1);
|
this.kickUser(var1);
|
||||||
} else {
|
} 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);
|
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) {
|
if (var2 != null) {
|
||||||
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
|
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -40,7 +40,11 @@ public class Packet204ClientInfo extends Packet {
|
||||||
* Passes this Packet on to the NetHandler for processing.
|
* Passes this Packet on to the NetHandler for processing.
|
||||||
*/
|
*/
|
||||||
public void processPacket(NetHandler par1NetHandler) {
|
public void processPacket(NetHandler par1NetHandler) {
|
||||||
par1NetHandler.handleClientInfo(this);
|
try {
|
||||||
|
par1NetHandler.handleClientInfo(this);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class PlayerManager {
|
||||||
}else {
|
}else {
|
||||||
if(player.lastRenderDistance != player.renderDistance) {
|
if(player.lastRenderDistance != player.renderDistance) {
|
||||||
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;
|
player = player.playerNetServerHandler.playerEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class PlayerManager {
|
||||||
boolean returnThisOne = playerReload.equals(player);
|
boolean returnThisOne = playerReload.equals(player);
|
||||||
if (playerReload.lastRenderDistance != player.renderDistance) {
|
if (playerReload.lastRenderDistance != player.renderDistance) {
|
||||||
playerReload.lastRenderDistance = playerReload.renderDistance = 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;
|
playerReload = playerReload.playerNetServerHandler.playerEntity;
|
||||||
}
|
}
|
||||||
if (returnThisOne) player = playerReload;
|
if (returnThisOne) player = playerReload;
|
||||||
|
|
|
@ -297,9 +297,8 @@ public class ServerConfigurationManager {
|
||||||
.removePlayerEntityDangerously(par1EntityPlayerMP);
|
.removePlayerEntityDangerously(par1EntityPlayerMP);
|
||||||
ChunkCoordinates var4 = par1EntityPlayerMP.getBedLocation();
|
ChunkCoordinates var4 = par1EntityPlayerMP.getBedLocation();
|
||||||
boolean var5 = par1EntityPlayerMP.isSpawnForced();
|
boolean var5 = par1EntityPlayerMP.isSpawnForced();
|
||||||
if (teleport) {
|
int startDim = par1EntityPlayerMP.dimension;
|
||||||
par1EntityPlayerMP.dimension = par2;
|
par1EntityPlayerMP.dimension = par2;
|
||||||
}
|
|
||||||
Object var6 = new ItemInWorldManager(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension));
|
Object var6 = new ItemInWorldManager(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension));
|
||||||
|
|
||||||
EntityPlayerMP var7 = new EntityPlayerMP(this.mcServer,
|
EntityPlayerMP var7 = new EntityPlayerMP(this.mcServer,
|
||||||
|
@ -339,7 +338,7 @@ public class ServerConfigurationManager {
|
||||||
var7.setPosition(var7.posX, var7.posY + 1.0D, var7.posZ);
|
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
|
// see https://wiki.vg/index.php?title=Protocol&oldid=1092
|
||||||
// footnotes of packet Respawn (0x09)
|
// footnotes of packet Respawn (0x09)
|
||||||
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(((var7.dimension + 2) % 3) - 1,
|
var7.playerNetServerHandler.sendPacket(new Packet9Respawn(((var7.dimension + 2) % 3) - 1,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user