mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
Added per player time support. Thanks eisental, Shamebot and needspeed10!
This commit is contained in:
1 parent
a70a5abc3d
commit
cc1b0a005c
5 files changed
+38
-4
No files matched your search
@@ -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 + ")";
|
||||
|
||||
Reference in new issue
Block a user