/** * Constructs a date from the provided parameters. * * @param year the year, positive * @param month the month, positive, smaller than or equal to the number of months in a year * @param day the day, positive, smaller than or equal to the number of days in a month */ public Date(long year, long month, long day) { if (year <= 0) { DungeonLogger.warning("Tried to construct Date with nonpositive year."); year = 1; } if (month <= 0) { DungeonLogger.warning("Tried to construct Date with nonpositive month."); month = 1; } else if (month > YEAR.as(MONTH)) { DungeonLogger.warning("Tried to construct Date with nonexistent month."); month = YEAR.as(MONTH); } if (day <= 0) { DungeonLogger.warning("Tried to construct Date with nonpositive day."); day = 1; } else if (day > MONTH.as(DAY)) { DungeonLogger.warning("Tried to construct Date with nonexistent day."); day = MONTH.as(DAY); } time = YEAR.milliseconds * (year - 1) + MONTH.milliseconds * (month - 1) + DAY.milliseconds * (day - 1); }