Arcturus-Community/src/main/java/com/eu/habbo/core/Scheduler.java

36 lines
714 B
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
2019-05-26 20:14:53 +02:00
public class Scheduler implements Runnable {
2018-07-06 15:30:00 +02:00
protected boolean disposed;
protected int interval;
2019-05-26 20:14:53 +02:00
public Scheduler(int interval) {
2018-07-06 15:30:00 +02:00
this.interval = interval;
}
2019-05-26 20:14:53 +02:00
public boolean isDisposed() {
2018-07-06 15:30:00 +02:00
return this.disposed;
}
2019-05-26 20:14:53 +02:00
public void setDisposed(boolean disposed) {
2018-07-06 15:30:00 +02:00
this.disposed = disposed;
}
2019-05-26 20:14:53 +02:00
public int getInterval() {
2018-07-06 15:30:00 +02:00
return this.interval;
}
2019-05-26 20:14:53 +02:00
public void setInterval(int interval) {
2018-07-06 15:30:00 +02:00
this.interval = interval;
}
@Override
2019-05-26 20:14:53 +02:00
public void run() {
2018-07-06 15:30:00 +02:00
if (this.disposed)
return;
Emulator.getThreading().run(this, this.interval * 1000);
}
}