mffs/src/main/java/mffs/DelayedEvent.java

26 lines
511 B
Java
Raw Normal View History

2022-10-28 16:20:12 +02:00
package mffs;
public abstract class DelayedEvent {
2023-01-08 16:58:21 +01:00
public int ticks;
protected IDelayedEventHandler handler;
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
public DelayedEvent(final IDelayedEventHandler handler, final int ticks) {
this.ticks = 0;
this.handler = handler;
this.ticks = ticks;
}
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
protected abstract void onEvent();
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
public void update() {
--this.ticks;
if (this.ticks <= 0) {
this.onEvent();
}
2022-10-28 16:20:12 +02:00
}
2023-01-08 16:58:21 +01:00
public int getPriority() {
return 0;
}
2022-10-28 16:20:12 +02:00
}