Skip to content

Instantly share code, notes, and snippets.

@SpaceManiac
Created May 25, 2011 18:13
Show Gist options
  • Save SpaceManiac/991528 to your computer and use it in GitHub Desktop.
Save SpaceManiac/991528 to your computer and use it in GitHub Desktop.
public long getTime(){
long time = getServer().getWorld("world").getTime();
return time;
}
// somewhere
bool justMidnight = false;
...
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
if (getTime() >= 0 && getTime() <= 0100) {
if (!justMidnight) {
justMidnight = true;
// do something
}
} else {
justMidnight = false;
}
}
}, 0, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment