QoL/src/main/java/xyz/etztech/qol/other/ReminderList.java

47 lines
1.1 KiB
Java

package xyz.etztech.qol.other;
import net.md_5.bungee.api.ChatColor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class ReminderList implements Comparable<ReminderList>{
private final List<String> reminders;
private final int period;
private final ChatColor color;
private int ndx;
private int count;
public ReminderList(List<String> reminders, int period, ChatColor color) {
this.reminders = reminders;
this.period = period;
this.color = color;
this.ndx = 0;
this.count = 0;
}
public void incCount() {
count = (count + 1) % (period + 1);
}
public boolean isReady() {
return count == period;
}
public String nextReminder() {
String nextReminder = reminders.get(ndx);
ndx = (ndx + 1) % reminders.size();
return nextReminder;
}
@Override
public int compareTo(@NotNull ReminderList o) {
return Integer.compare(o.period, this.period);
}
public ChatColor getColor() {
return color;
}
}