From 8a753895ea40d6cd9532f00eee46028f8d288984 Mon Sep 17 00:00:00 2001 From: xjoao Date: Sun, 7 Jun 2020 19:15:04 -0400 Subject: [PATCH 1/8] @Override added --- src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java b/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java index 8650144e..736625f7 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java +++ b/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java @@ -32,6 +32,7 @@ public abstract class RCONMessage { public abstract void handle(Gson gson, T json); public static class RCONMessageSerializer implements JsonSerializer { + @Override public JsonElement serialize(final RCONMessage rconMessage, final Type type, final JsonSerializationContext context) { JsonObject result = new JsonObject(); result.add("status", new JsonPrimitive(rconMessage.status)); From 9ace236d32f13129af1c2e29f94c31e68ebbc602 Mon Sep 17 00:00:00 2001 From: SenpaiDipper Date: Mon, 5 Oct 2020 02:14:39 -0400 Subject: [PATCH 2/8] Typo Fix --- src/main/java/com/eu/habbo/Emulator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 9954c318..40ca1da3 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -141,7 +141,7 @@ public final class Emulator { Emulator.rconServer.connect(); Emulator.badgeImager = new BadgeImager(); - LOGGER.info("Arcturus Morningstar has succesfully loaded."); + LOGGER.info("Arcturus Morningstar has successfully loaded."); LOGGER.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2); LOGGER.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024)); From 8abcf7d5aa9064f8eedf1b5762fa7ca5d96c40d6 Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 6 Oct 2020 19:00:40 -0400 Subject: [PATCH 3/8] Resolve "Having too many friends will make your account unusable" --- .../friends/RequestInitFriendsEvent.java | 3 +- .../handshake/SecureLoginEvent_BACKUP.java | 2 +- .../outgoing/friends/FriendsComposer.java | 86 ++++++++++--------- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/RequestInitFriendsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/RequestInitFriendsEvent.java index c77adfec..2ce35cf7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/RequestInitFriendsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/RequestInitFriendsEvent.java @@ -11,9 +11,8 @@ public class RequestInitFriendsEvent extends MessageHandler { @Override public void handle() throws Exception { ArrayList messages = new ArrayList<>(); -// messages.add(new MessengerInitComposer(this.client.getHabbo()).compose()); - messages.add(new FriendsComposer(this.client.getHabbo()).compose()); + messages.addAll(FriendsComposer.getMessagesForBuddyList(this.client.getHabbo().getMessenger().getFriends().values())); this.client.sendResponses(messages); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java index 881579ba..a74220f0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java @@ -52,7 +52,7 @@ public class SecureLoginEvent_BACKUP extends MessageHandler { messages.add(new UserPerksComposer(habbo).compose()); messages.add(new SessionRightsComposer().compose()); messages.add(new FavoriteRoomsCountComposer(habbo).compose()); - messages.add(new FriendsComposer(this.client.getHabbo()).compose()); + //messages.add(new FriendsComposer(this.client.getHabbo()).compose()); //messages.add(new NewUserIdentityComposer().compose()); //messages.add(new UserDataComposer(this.client.getHabbo()).compose()); //messages.add(new SessionRightsComposer().compose()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java index 0253f33f..2fd69a9a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/friends/FriendsComposer.java @@ -1,24 +1,28 @@ package com.eu.habbo.messages.outgoing.friends; -import com.eu.habbo.habbohotel.messenger.Messenger; import com.eu.habbo.habbohotel.messenger.MessengerBuddy; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import gnu.trove.set.hash.THashSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Map; +import java.util.ArrayList; +import java.util.Collection; public class FriendsComposer extends MessageComposer { private static final Logger LOGGER = LoggerFactory.getLogger(FriendsComposer.class); - private final Habbo habbo; + private final int totalPages; + private final int pageIndex; + private final Collection friends; - public FriendsComposer(Habbo habbo) { - this.habbo = habbo; + public FriendsComposer(int totalPages, int pageIndex, Collection friends) { + this.totalPages = totalPages; + this.pageIndex = pageIndex; + this.friends = friends; } @Override @@ -26,52 +30,54 @@ public class FriendsComposer extends MessageComposer { try { this.response.init(Outgoing.FriendsComposer); - //this.response.appendInt(300); - //this.response.appendInt(300); - //this.response.appendInt(3); //Club level - this.response.appendInt(this.habbo.hasPermission("acc_infinite_friends") ? Integer.MAX_VALUE : Messenger.MAXIMUM_FRIENDS); - this.response.appendInt(this.habbo.hasPermission("acc_infinite_friends") ? Integer.MAX_VALUE : Messenger.MAXIMUM_FRIENDS); - this.response.appendInt(this.habbo.getMessenger().getFriends().size()/* + (this.habbo.hasPermission("acc_staff_chat") ? 1 : 0)*/); + this.response.appendInt(this.totalPages); + this.response.appendInt(this.pageIndex); + this.response.appendInt(this.friends.size()); - for (Map.Entry row : this.habbo.getMessenger().getFriends().entrySet()) { - this.response.appendInt(row.getKey()); - this.response.appendString(row.getValue().getUsername()); - this.response.appendInt(row.getValue().getGender().equals(HabboGender.M) ? 0 : 1); - this.response.appendBoolean(row.getValue().getOnline() == 1); - this.response.appendBoolean(row.getValue().inRoom()); //IN ROOM - this.response.appendString(row.getValue().getOnline() == 1 ? row.getValue().getLook() : ""); + for (MessengerBuddy row : this.friends) { + this.response.appendInt(row.getId()); + this.response.appendString(row.getUsername()); + this.response.appendInt(row.getGender().equals(HabboGender.M) ? 0 : 1); + this.response.appendBoolean(row.getOnline() == 1); + this.response.appendBoolean(row.inRoom()); //IN ROOM + this.response.appendString(row.getOnline() == 1 ? row.getLook() : ""); this.response.appendInt(0); - this.response.appendString(row.getValue().getMotto()); + this.response.appendString(row.getMotto()); this.response.appendString(""); this.response.appendString(""); this.response.appendBoolean(false); //Offline messaging. this.response.appendBoolean(false); this.response.appendBoolean(false); - this.response.appendShort(row.getValue().getRelation()); + this.response.appendShort(row.getRelation()); } - - /*if(this.habbo.hasPermission("acc_staff_chat")) - { - this.response.appendInt(-1); - this.response.appendString("Staff Chat"); - this.response.appendInt(this.habbo.getHabboInfo().getGender().equals(HabboGender.M) ? 0 : 1); - this.response.appendBoolean(true); - this.response.appendBoolean(false); //IN ROOM - this.response.appendString("ADM"); - this.response.appendInt(0); - this.response.appendString(""); - this.response.appendString(""); - this.response.appendString(""); - this.response.appendBoolean(true); //Offline messaging. - this.response.appendBoolean(false); - this.response.appendBoolean(false); - this.response.appendShort(0); - }*/ - return this.response; } catch (Exception e) { LOGGER.error("Caught exception", e); } return null; } + + public static ArrayList getMessagesForBuddyList(Collection buddies) { + ArrayList messages = new ArrayList(); + THashSet friends = new THashSet(); + + int totalPages = (int)Math.ceil(buddies.size() / 750.0); + int page = 0; + + for(MessengerBuddy buddy : buddies) { + friends.add(buddy); + + if(friends.size() == 750) { + messages.add(new FriendsComposer(totalPages, page, friends).compose()); + friends.clear(); + page++; + } + } + + if(page == 0 || friends.size() > 0) { + messages.add(new FriendsComposer(totalPages, page, friends).compose()); + } + + return messages; + } } \ No newline at end of file From 2b0ec5b6af6e1e94d94042165b82ba89b88e9228 Mon Sep 17 00:00:00 2001 From: Kitt Mustang Date: Tue, 6 Oct 2020 19:11:58 -0400 Subject: [PATCH 4/8] Fix banzai tiles flicker. See merge request morningstar/Arcturus-Community!312 --- README.md | 2 +- .../eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a4a8145..364c2985 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/VERSION-2.4.0-success.svg?style=for-the-badge&logo=appveyor) -![image](https://img.shields.io/badge/STATUS-UNSTABLE-red.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases diff --git a/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java b/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java index 77eb02ef..0993c1b3 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java +++ b/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java @@ -41,7 +41,7 @@ public class BattleBanzaiTilesFlicker implements Runnable { this.room.sendComposer(new ItemsDataUpdateComposer(this.items).compose()); - if (this.count == 5) { + if (this.count == 9) { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { item.setExtradata("0"); this.room.updateItemState(item); From e10ef764e8ae01e8b7070f6166f5fa02ae0e9a9a Mon Sep 17 00:00:00 2001 From: Kitt Mustang Date: Tue, 6 Oct 2020 19:40:49 -0400 Subject: [PATCH 5/8] The furni Background Toner can now be walked on --- README.md | 2 +- .../items/interactions/InteractionBackgroundToner.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a4a8145..364c2985 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/VERSION-2.4.0-success.svg?style=for-the-badge&logo=appveyor) -![image](https://img.shields.io/badge/STATUS-UNSTABLE-red.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java index 813ce782..ab6bf36e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java @@ -52,7 +52,7 @@ public class InteractionBackgroundToner extends HabboItem { @Override public boolean isWalkable() { - return false; + return this.getBaseItem().allowWalk(); } @Override From 1932eb856f3c6e444845a372c4c4bd30e148a27d Mon Sep 17 00:00:00 2001 From: Kitt Mustang Date: Tue, 6 Oct 2020 19:43:11 -0400 Subject: [PATCH 6/8] Wired "Change Furni Direction" now activates even if the Habbo is sitting in a chair. See merge request morningstar/Arcturus-Community!308 --- README.md | 2 +- .../wired/effects/WiredEffectChangeFurniDirection.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a4a8145..364c2985 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/VERSION-2.4.0-success.svg?style=for-the-badge&logo=appveyor) -![image](https://img.shields.io/badge/STATUS-UNSTABLE-red.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java index 7ac99dae..9733b4a7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java @@ -68,7 +68,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { count++; } - if (targetTile != null && targetTile.state == RoomTileState.OPEN) { + if (targetTile != null && targetTile.state != RoomTileState.INVALID) { boolean hasHabbos = false; for (Habbo habbo : room.getHabbosAt(targetTile)) { hasHabbos = true; From 76d593df065478a8c73a884bf307237beab42ac7 Mon Sep 17 00:00:00 2001 From: Beny Date: Tue, 6 Oct 2020 23:47:48 +0000 Subject: [PATCH 7/8] Merge branch 'master' into 'master' Fixed ArrayIndexOutOfBoundsException See merge request morningstar/Arcturus-Community!304 (cherry picked from commit d6d0f80c7cf844b4777e74afffd9cab561c387ef) 0a93514b Fixed ArrayIndexOutOfBoundsException --- .../habbohotel/commands/WordQuizCommand.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java index 09a6c4dc..ba74d5d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java @@ -2,6 +2,9 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; + +import java.util.Arrays; public class WordQuizCommand extends Command { public WordQuizCommand() { @@ -11,21 +14,21 @@ public class WordQuizCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) throws Exception { if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz()) { + if(params.length == 1) { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.description.cmd_word_quiz"), RoomChatMessageBubbles.ALERT); + return true; + } StringBuilder question = new StringBuilder(); int duration = 60; - if (params.length > 2) { - for (int i = 1; i < params.length - 1; i++) { - question.append(" ").append(params[i]); - } + try { + duration = Integer.parseInt(params[params.length-1]); + params = Arrays.copyOf(params, params.length-1); + } + catch (Exception e) {} - try { - duration = Integer.valueOf(params[params.length - 1]); - } catch (Exception e) { - question.append(" ").append(params[params.length - 1]); - } - } else { - question = new StringBuilder(params[1]); + for (int i = 1; i < params.length; i++) { + question.append(" ").append(params[i]); } gameClient.getHabbo().getHabboInfo().getCurrentRoom().startWordQuiz(question.toString(), duration * 1000); From 13ac1c9cef6aaeb44f5ecb8379712681c2100be6 Mon Sep 17 00:00:00 2001 From: xjoao Date: Wed, 7 Oct 2020 10:29:36 -0400 Subject: [PATCH 8/8] Logging corrected in TextsManager. See merge request morningstar/Arcturus-Community!235 --- src/main/java/com/eu/habbo/core/TextsManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/core/TextsManager.java b/src/main/java/com/eu/habbo/core/TextsManager.java index 90c6520a..4b0bf66e 100644 --- a/src/main/java/com/eu/habbo/core/TextsManager.java +++ b/src/main/java/com/eu/habbo/core/TextsManager.java @@ -72,7 +72,7 @@ public class TextsManager { public int getInt(String key, Integer defaultValue) { try { return Integer.parseInt(this.getValue(key, defaultValue.toString())); - } catch (Exception e) { + } catch (NumberFormatException e) { LOGGER.error("Caught exception", e); } return defaultValue;