Class CalendarManager

java.lang.Object
tk.airshipcraft.commonlib.calendar.impl.CalendarManager
All Implemented Interfaces:
ICalendarManager

public class CalendarManager extends Object implements ICalendarManager
The CalendarManager class is responsible for managing the in-game calendar in Minecraft. It provides functionalities to get the current in-game date, advance the date, and handle date-related operations. This class is a part of the commonlib calendar system and serves as a core component for date and time management.
Since:
2024-01-04
Version:
2.0.0
Author:
notzune
  • Constructor Details

    • CalendarManager

      public CalendarManager(int startYear, int startMonth, int startDay)
      Initializes a new CalendarManager with a specified starting date or default date.
      Parameters:
      startYear - The starting year. Must be a positive integer.
      startMonth - The starting month. Must be a positive integer.
      startDay - The starting day. Must be a positive integer.
  • Method Details

    • advanceDays

      public void advanceDays(int days)
      Advances the in-game date by a specified number of days.
      Specified by:
      advanceDays in interface ICalendarManager
      Parameters:
      days - The number of days to advance. Must be a non-negative integer.
    • newMinecraftDay

      public void newMinecraftDay()
      Advances the calendar by one day. This method is intended to be called when a new Minecraft day starts.
      Specified by:
      newMinecraftDay in interface ICalendarManager
    • getCurrentDate

      public CustomDate getCurrentDate()
      Gets the current in-game date in the custom calendar format.
      Specified by:
      getCurrentDate in interface ICalendarManager
      Returns:
      The current in-game date as a CustomDate.
    • setCurrentDate

      public void setCurrentDate(CustomDate newDate)
      Sets the in-game date to a specific date.
      Specified by:
      setCurrentDate in interface ICalendarManager
      Parameters:
      newDate - The new date to set as the current in-game date.
    • daysUntil

      public int daysUntil(CustomDate targetDate)
      Calculates the number of days until a specified date.
      Specified by:
      daysUntil in interface ICalendarManager
      Parameters:
      targetDate - The date to calculate the days until.
      Returns:
      The number of days until the target date.