Skip to content

Commit

Permalink
Tweak player movement updates to prevent falling through the ground w…
Browse files Browse the repository at this point in the history
…hen logging in

Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed Feb 5, 2013
1 parent 5765b91 commit 29811ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/patches-deobfuscated.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</class>
<class id="net.minecraft.network.NetServerHandler">
<addAll fromClass="me.nallar.patched.PatchNetServerHandler"/>
<insertBefore code="teleported = 40;">setPlayerLocation</insertBefore>
<insertBefore code="teleported = 20;">setPlayerLocation</insertBefore>
<replaceMethodCall method="warning"
code="{ javassist.is.faulty.Redirects.notifyAdmins($1); }"
>handleFlying</replaceMethodCall>
Expand Down
2 changes: 1 addition & 1 deletion src/common/me/nallar/patched/PatchNetServerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class PatchNetServerHandler extends NetServerHandler {
public long lastNotify_;

public void construct() {
teleported = 30;
teleported = 3;
averageSpeed = -1000;
}

Expand Down
14 changes: 14 additions & 0 deletions src/common/me/nallar/patched/PatchServerConfigurationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import me.nallar.tickthreading.patcher.Declare;
import me.nallar.tickthreading.util.concurrent.TwoWayReentrantReadWriteLock;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ServerConfigurationManager;

Expand All @@ -17,6 +19,18 @@ public void construct() {
playerUpdateLock = reentrantReadWriteLock.readLock();
}

@Override
public void readPlayerDataFromFile(EntityPlayerMP par1EntityPlayerMP) {
NBTTagCompound var2 = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound();

if (par1EntityPlayerMP.getCommandSenderName().equals(this.mcServer.getServerOwner()) && var2 != null) {
par1EntityPlayerMP.readFromNBT(var2);
} else {
this.playerNBTManagerObj.readPlayerData(par1EntityPlayerMP);
}
par1EntityPlayerMP.posY += 0.05;
}

public PatchServerConfigurationManager(MinecraftServer par1MinecraftServer) {
super(par1MinecraftServer);
}
Expand Down

0 comments on commit 29811ee

Please sign in to comment.