2017-05-07 00:18:59 +00:00
|
|
|
/*
|
2017-05-01 13:32:39 +00:00
|
|
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
2022-01-01 00:07:26 +00:00
|
|
|
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
|
2017-05-01 13:32:39 +00:00
|
|
|
* Send enquiries to dratcliffe@gmail.com
|
|
|
|
*/
|
|
|
|
package dan200.computercraft.shared.util;
|
|
|
|
|
2023-02-09 20:07:55 +00:00
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.Month;
|
2023-03-14 18:41:31 +00:00
|
|
|
import java.time.ZoneId;
|
2023-02-09 20:07:55 +00:00
|
|
|
|
2017-05-01 13:32:39 +00:00
|
|
|
public enum Holiday {
|
2020-01-28 22:28:48 +00:00
|
|
|
NONE,
|
2023-02-09 20:07:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 14th February.
|
|
|
|
*/
|
2020-01-28 22:28:48 +00:00
|
|
|
VALENTINES,
|
2023-02-09 20:07:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 24th-26th December.
|
|
|
|
*
|
|
|
|
* @see net.minecraft.client.renderer.blockentity.ChestRenderer
|
|
|
|
*/
|
|
|
|
CHRISTMAS;
|
|
|
|
|
|
|
|
public static Holiday getCurrent() {
|
2023-03-14 18:41:31 +00:00
|
|
|
var now = LocalDateTime.now(ZoneId.systemDefault());
|
|
|
|
var month = now.getMonth();
|
|
|
|
var day = now.getDayOfMonth();
|
2023-02-09 20:07:55 +00:00
|
|
|
if (month == Month.FEBRUARY && day == 14) return VALENTINES;
|
|
|
|
if (month == Month.DECEMBER && day >= 24 && day <= 26) return CHRISTMAS;
|
|
|
|
return NONE;
|
|
|
|
}
|
2017-05-01 13:32:39 +00:00
|
|
|
}
|