Added per player time support. Thanks eisental, Shamebot and needspeed10!

By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
CraftBukkit/Spigot 2011-06-17 02:29:16 -04:00
parent 28d4d95e86
commit 51e0c1409b
2 changed files with 22 additions and 1 deletions

View file

@ -424,7 +424,7 @@ public class CraftWorld implements World {
// Forces the client to update to the new time immediately
for (Player p: getPlayers()) {
CraftPlayer cp = (CraftPlayer) p;
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(time));
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime()));
}
}

View file

@ -297,4 +297,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().netServerHandler.sendPacket(new Packet200Statistic(id, amount));
}
public void setPlayerTime(long time, boolean relative) {
getHandle().timeOffset = time;
getHandle().relativeTime = relative;
}
public long getPlayerTimeOffset() {
return getHandle().timeOffset;
}
public long getPlayerTime() {
return getHandle().getPlayerTime();
}
public boolean isPlayerTimeRelative() {
return getHandle().relativeTime;
}
public void resetPlayerTime() {
setPlayerTime(0, true);
}
}