Fix CalendarCommand

This commit is contained in:
brenoepic 2022-04-15 18:56:56 -03:00 committed by Harmonic
parent 963d892934
commit d7e059326e

View File

@ -25,11 +25,16 @@ public class CalendarCommand extends Command {
if (params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) { if (params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) {
campaignName = params[1]; campaignName = params[1];
} }
CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(campaignName); CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(campaignName);
if (campaign == null) return false; if (campaign == null) return false;
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant()); int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
if (daysBetween >= 0) { if (daysBetween >= 0) {
gameClient.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired())); gameClient.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired()));
gameClient.sendResponse(new NuxAlertComposer("openView/calendar"));
} }
} }