From 434db05ce39b55004accaf7709c906909a55b4c0 Mon Sep 17 00:00:00 2001 From: brenoepic Date: Tue, 18 Jan 2022 22:50:57 +0000 Subject: [PATCH 1/2] Fix SubscriptionCommand NPE on not online user --- .../eu/habbo/habbohotel/commands/SubscriptionCommand.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java index 25f8b758..96350ae9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboManager; +import com.eu.habbo.habbohotel.users.HabboStats; import com.eu.habbo.habbohotel.users.subscriptions.Subscription; /** @@ -42,8 +43,7 @@ public class SubscriptionCommand extends Command { HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]); if (info != null) { - Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]); - + HabboStats stats = info.getHabboStats(); String subscription = params[2].toUpperCase(); String action = params[3]; @@ -67,11 +67,11 @@ public class SubscriptionCommand extends Command { return true; } - habbo.getHabboStats().createSubscription(subscription, timeToAdd); + stats.createSubscription(subscription, timeToAdd); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.success_add_time", "Successfully added %time% seconds to %subscription% on %user%").replace("%time%", timeToAdd + "").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT); } else if(action.equalsIgnoreCase("remove") || action.equalsIgnoreCase("-") || action.equalsIgnoreCase("r")) { - Subscription s = habbo.getHabboStats().getSubscription(subscription); + Subscription s = stats.getSubscription(subscription); if (s == null) { gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.user_not_have", "%user% does not have the %subscription% subscription").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT); From fd8401d4fd57049b71e5981a469a9c5879d71315 Mon Sep 17 00:00:00 2001 From: dap <90627349+notdap@users.noreply.github.com> Date: Wed, 2 Mar 2022 15:45:31 +0100 Subject: [PATCH 2/2] Fix issue #980 --- .../messages/incoming/rooms/items/PostItSaveDataEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java index 2922fc94..a2bb5524 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItSaveDataEvent.java @@ -39,12 +39,12 @@ public class PostItSaveDataEvent extends MessageHandler { if (!(item instanceof InteractionPostIt)) return; - if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo()) && item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) { + if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo())) { if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) { return; } } else { - if (!room.hasRights(this.client.getHabbo()) && item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) + if (!room.hasRights(this.client.getHabbo())) return; }