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

This commit is contained in:
EvilSeph
2011-06-17 02:29:16 -04:00
parent a70a5abc3d
commit cc1b0a005c
5 changed files with 38 additions and 4 deletions

View File

@@ -483,6 +483,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// CraftBukkit start
public long timeOffset = 0;
public boolean relativeTime = true;
public long getPlayerTime() {
if (relativeTime) {
// Adds timeOffset to the current server time.
return world.getTime() + timeOffset;
} else {
// Adds timeOffset to the beginning of this day.
return world.getTime() - (world.getTime() % 24000) + timeOffset;
}
}
@Override
public String toString() {
return super.toString() + "(" + name + " at " + locX + "," + locY + "," + locZ + ")";