mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 17:52:28 +01:00
Added per player time support. Thanks eisental, Shamebot and needspeed10!
By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
parent
28d4d95e86
commit
51e0c1409b
2 changed files with 22 additions and 1 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue