From d7e059326e083b3ea9237051a7355fbb4fd296c2 Mon Sep 17 00:00:00 2001 From: brenoepic <59066707+brenoepics@users.noreply.github.com> Date: Fri, 15 Apr 2022 18:56:56 -0300 Subject: [PATCH] Fix CalendarCommand --- .../habbo/habbohotel/commands/CalendarCommand.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java index dd2a773f..1cc03971 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java @@ -22,14 +22,19 @@ public class CalendarCommand extends Command { if (Emulator.getConfig().getBoolean("hotel.calendar.enabled")) { String campaignName = Emulator.getConfig().getValue("hotel.calendar.default"); - if(params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) { + if (params.length > 1 && gameClient.getHabbo().hasPermission("cmd_calendar_staff")) { campaignName = params[1]; } + CalendarCampaign campaign = Emulator.getGameEnvironment().getCalendarManager().getCalendarCampaign(campaignName); - if(campaign == null) return false; - int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant()); - if(daysBetween >= 0) { + + if (campaign == null) return false; + + int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant()); + + if (daysBetween >= 0) { gameClient.sendResponse(new AdventCalendarDataComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired())); + gameClient.sendResponse(new NuxAlertComposer("openView/calendar")); } }