Dinner time!

This commit is contained in:
Dinnerbone 2011-02-01 14:53:39 +00:00
parent 923ab54e38
commit 657913faeb
2 changed files with 24 additions and 2 deletions

View file

@ -142,12 +142,14 @@ public final class CraftServer implements Server {
return new World[]{console.e.getWorld()};
}
@Deprecated
public long getTime() {
return console.e.e;
return getWorlds()[0].getFullTime();
}
@Deprecated
public void setTime(long time) {
console.e.e = time;
getWorlds()[0].setFullTime(time);
}
public ServerConfigurationManager getHandle() {

View file

@ -243,6 +243,26 @@ public class CraftWorld implements World {
return "CraftWorld";
}
public long getTime() {
long time = getFullTime() % 24000;
if (time < 0) time += 24000;
return time;
}
public void setTime(long time) {
long margin = (time - getFullTime()) % 24000;
if (margin < 0) margin += 24000;
setFullTime(getFullTime() + margin);
}
public long getFullTime() {
return world.e;
}
public void setFullTime(long time) {
world.e = time;
}
private final class ChunkCoordinate {
public final int x;
public final int z;