Class CalendarManager
java.lang.Object
tk.airshipcraft.commonlib.calendar.impl.CalendarManager
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionCalendarManager(int startYear, int startMonth, int startDay) Initializes a new CalendarManager with a specified starting date or default date. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceDays(int days) Advances the in-game date by a specified number of days.intdaysUntil(CustomDate targetDate) Calculates the number of days until a specified date.Gets the current in-game date in the custom calendar format.voidAdvances the calendar by one day.voidsetCurrentDate(CustomDate newDate) Sets the in-game date to a specific date.
-
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:
advanceDaysin interfaceICalendarManager- 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:
newMinecraftDayin interfaceICalendarManager
-
getCurrentDate
Gets the current in-game date in the custom calendar format.- Specified by:
getCurrentDatein interfaceICalendarManager- Returns:
- The current in-game date as a CustomDate.
-
setCurrentDate
Sets the in-game date to a specific date.- Specified by:
setCurrentDatein interfaceICalendarManager- Parameters:
newDate- The new date to set as the current in-game date.
-
daysUntil
Calculates the number of days until a specified date.- Specified by:
daysUntilin interfaceICalendarManager- Parameters:
targetDate- The date to calculate the days until.- Returns:
- The number of days until the target date.
-