diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-09-23 20:20:18 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-09-23 20:20:18 +0200 |
commit | a2957c7b8f72180912b4ad1a04b4bee35f91c57a (patch) | |
tree | 98f6122e0688ede34cef23dacf504ac316681fde /src/main/java/net | |
parent | e08535d68853d48388accc0a4f3c7504c2d15bf9 (diff) | |
download | craftbukkit-a2957c7b8f72180912b4ad1a04b4bee35f91c57a.tar craftbukkit-a2957c7b8f72180912b4ad1a04b4bee35f91c57a.tar.gz craftbukkit-a2957c7b8f72180912b4ad1a04b4bee35f91c57a.tar.lz craftbukkit-a2957c7b8f72180912b4ad1a04b4bee35f91c57a.tar.xz craftbukkit-a2957c7b8f72180912b4ad1a04b4bee35f91c57a.zip |
Stop sending multiple time packets to each client
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/MinecraftServer.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 8d560875..1fc7940f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -436,20 +436,27 @@ public class MinecraftServer implements Runnable, ICommandListener { Vec3D.a(); ++this.ticks; - ((CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks); // CraftBukkit + // CraftBukkit start - only send timeupdates to the people in that world - for (j = 0; j < this.worlds.size(); ++j) { // CraftBukkit - // if (j == 0 || this.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit - WorldServer worldserver = this.worlds.get(j); // CraftBukkit + ((CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks); + // Send timeupdates to everyone, it will get the right time from the world the player is in. + if (this.ticks % 20 == 0) { + for (int i = 0; i < this.serverConfigurationManager.players.size(); ++i) { + EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i); + entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time + } + } + + for (j = 0; j < this.worlds.size(); ++j) { + // if (j == 0 || this.propertyManager.getBoolean("allow-nether", true)) { + WorldServer worldserver = this.worlds.get(j); + + /* Drop global timeupdates if (this.ticks % 20 == 0) { - // CraftBukkit start - only send timeupdates to the people in that world - for (int i = 0; i < this.serverConfigurationManager.players.size(); ++i) { - EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i); - entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time - } - // CraftBukkit end + this.serverConfigurationManager.a(new Packet4UpdateTime(worldserver.getTime()), worldserver.worldProvider.dimension); } + // CraftBukkit end */ worldserver.doTick(); |