Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Vilius
- *
- */
- public class Scheduler extends TaskScriptEmulator<TaskScript> {
- private Calendar date;
- static long midnight;
- private int rotationTick;
- public Scheduler() {
- date = new GregorianCalendar(TimeZone.getTimeZone("Etc/GMT+0"));
- date.set(Calendar.HOUR_OF_DAY, 0);
- date.set(Calendar.MINUTE, 0);
- date.set(Calendar.SECOND, 0);
- date.set(Calendar.MILLISECOND, 0);
- midnight = date.getTime().getTime();
- }
- public static int getCurrentTick() {
- return (int) Math.floor((System.currentTimeMillis() - midnight) / 300000);
- }
- public enum FarmingTick {
- ALLOTMENT(2), HERB(4), TREE(8), FRUIT_TREE(32);
- int tick;
- FarmingTick(int tick) {
- this.tick = tick;
- }
- public int getTickMultiplier() {
- return tick;
- }
- public int getMinutesOf(FarmingTick farmingTick) {
- return farmingTick.getTickMultiplier() * 5;
- }
- public int getTick() {
- return (int) Math.floor(getCurrentTick() / tick);
- }
- }
- public void setRotation(FarmingTick tick) {
- rotationTick = tick.getTick();
- }
- public int getCurrentRotationTick() {
- return rotationTick;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement