mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-04 19:12:54 +00:00

OK, so let's get this out of the way, there's some actual changes mixed in here too. I'm really sorry: - Turtles can now not be renamed with unnamed item tags (previously it would clear the name, this seemed a little unideal). - commands.getBlock(s)Data will also include NBT. Now, onto the horror story which is these inspection changes: - Make a lot of methods static - Typo fixes - Make utility classes final + private constructor - Lots of reformatting (ifs -> ternary, invert control flow, etc...) - ??? - Profit! I'm so going to regret this - can pretty much guarantee this is going to break something.
31 lines
990 B
Java
31 lines
990 B
Java
/*
|
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
|
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
|
* Send enquiries to dratcliffe@gmail.com
|
|
*/
|
|
|
|
package dan200.computercraft.shared.util;
|
|
|
|
import java.util.Calendar;
|
|
|
|
public final class HolidayUtil
|
|
{
|
|
private HolidayUtil() {}
|
|
|
|
public static Holiday getCurrentHoliday()
|
|
{
|
|
return getHoliday( Calendar.getInstance() );
|
|
}
|
|
|
|
private static Holiday getHoliday( Calendar calendar )
|
|
{
|
|
int month = calendar.get( Calendar.MONTH );
|
|
int day = calendar.get( Calendar.DAY_OF_MONTH );
|
|
if( month == Calendar.FEBRUARY && day == 14 ) return Holiday.Valentines;
|
|
if( month == Calendar.APRIL && day == 1 ) return Holiday.AprilFoolsDay;
|
|
if( month == Calendar.OCTOBER && day == 31 ) return Holiday.Halloween;
|
|
if( month == Calendar.DECEMBER && day >= 24 && day <= 30 ) return Holiday.Christmas;
|
|
return Holiday.None;
|
|
}
|
|
}
|