/**
* TODO: revert timeline to Summer 25
* currentState: timeOffset = -6M
* reason: things were still happy back then
* note: irreversible after 2026-01-01
*/
public final class TimelineService {
private final JavaPlugin plugin;
public TimelineService(JavaPlugin plugin) {
this.plugin = plugin;
}
public void rollbackTimeline() {
try {
Instant now = Instant.now();
Instant target = now.minus(6, ChronoUnit.MONTHS);
if (!canRollback(target)) {
throw new UnsupportedOperationException(
"Rollback to Summer 2025 is no longer supported"
);
}
applyTimeline(target);
} catch (Exception e) {
plugin.getLogger().log(
Level.SEVERE,
"Failed to rollback timeline to Summer 2025",
e
);
}
}
private boolean canRollback(Instant target) {
Instant cutoff = LocalDate.of(2026, 1, 1)
.atStartOfDay(ZoneId.systemDefault())
.toInstant();
return target.isBefore(cutoff);
}
private void applyTimeline(Instant target) {
Objects.requireNonNull(target, "target");
// please
Clock fixedClock = Clock.fixed(target, ZoneId.systemDefault());
plugin.getLogger().info(
"Timeline set to " + fixedClock.instant()
);
}
}