private void tick(Info info) { if (Utils.shouldDefer(info)) return; // else if (OFFSET == -1) { info.sendMessage( "Tick not sychronized yet. Wait for the next tick and execute /msg " + info.getBot().getName() + " !setTickor find out how long until the next tick and execute /msg " + info.getBot().getName() + " !setTick <mins>"); return; } int timeRemaining = 15 - ((15 + Utils.getRealMinutes(info) - OFFSET) % 15); long daysSinceSet = (System.currentTimeMillis() - tickTime) / (1000 * 60 * 60 * 24); info.sendMessage( timeRemaining + " minutes until the next tick (last set " + daysSinceSet + " days ago)"); }
private void tickAlarm(Info info) { if (OFFSET == -1) { info.sendMessage( "Tick not sychronized yet. Wait for the next tick and execute /msg " + info.getBot().getName() + " !setTick or find out how long until the next tick and execute /msg " + info.getBot().getName() + " !setTick <mins>"); return; } int timeRemaining = 15 - ((15 + Utils.getRealMinutes(info) - OFFSET) % 15); if (timeRemaining < 2) { info.sendMessage(Colors.BLUE + Colors.BOLD + "The tick is in " + timeRemaining + " minutes."); } else { PingTask ptask = new PingTask(info, "the tick is in one minute."); timer.schedule(ptask, (int) ((timeRemaining - 1) * 60 * 1000)); info.sendMessage("I'll alert you."); } }