public void toggleDailyTimer(boolean on) {
if (on && !isDailyTimerRunning()) {
long timeTillNextDay = TownyUtil.townyTime();
TownyMessaging.sendMsg("Time until a New Day: " + TimeMgmt.formatCountdownTime(timeTillNextDay));
dailyTask = getPlugin().getServer().getScheduler().scheduleSyncRepeatingTask(getPlugin(), new DailyTimerTask(this), MinecraftTools.convertToTicks(timeTillNextDay), MinecraftTools.convertToTicks(TownySettings.getDayInterval()));
if (dailyTask == -1)
TownyMessaging.sendErrorMsg("Could not schedule new day loop.");
} else if (!on && isDailyTimerRunning()) {
getPlugin().getServer().getScheduler().cancelTask(dailyTask);
dailyTask = -1;