diff --git a/Emulator/.gitignore b/Emulator/.gitignore
deleted file mode 100644
index 7d36551..0000000
--- a/Emulator/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-logging/
-compiled-builds/
-*.iml
-.idea/
-target/**
-TODO.txt
-packet.pkt
-src/test/
-target/
-config.ini
-*.txt
-*.log
-*.zip
-.DS_Store
-
diff --git a/Emulator/.gitlab-ci.yml b/Emulator/.gitlab-ci.yml
deleted file mode 100644
index e1d0de3..0000000
--- a/Emulator/.gitlab-ci.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-image: maven:latest
-
-stages:
- - build
-
-build:
- stage: build
- script:
- - mvn package
- only:
- changes:
- - src/**/*
- - pom.xml
- artifacts:
- expire_in: 2 weeks
- paths:
- - target/Habbo-*.jar
-
diff --git a/Emulator/.gitmodules b/Emulator/.gitmodules
deleted file mode 100644
index efe4ac3..0000000
--- a/Emulator/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "morningstar-default-database"]
- path = morningstar-default-database
- url = https://git.krews.org/morningstar/morningstar-default-database
diff --git a/Emulator/.idea/.gitignore b/Emulator/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/Emulator/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/Emulator/.idea/compiler.xml b/Emulator/.idea/compiler.xml
new file mode 100644
index 0000000..3376806
--- /dev/null
+++ b/Emulator/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Emulator/.idea/encodings.xml b/Emulator/.idea/encodings.xml
new file mode 100644
index 0000000..aa00ffa
--- /dev/null
+++ b/Emulator/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Emulator/.idea/jarRepositories.xml b/Emulator/.idea/jarRepositories.xml
new file mode 100644
index 0000000..27bf039
--- /dev/null
+++ b/Emulator/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Emulator/.idea/misc.xml b/Emulator/.idea/misc.xml
new file mode 100644
index 0000000..749dacb
--- /dev/null
+++ b/Emulator/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Emulator/Dockerfile b/Emulator/Dockerfile
deleted file mode 100644
index e045ce4..0000000
--- a/Emulator/Dockerfile
+++ /dev/null
@@ -1,19 +0,0 @@
-FROM maven:latest AS builder
-
-# Copy the Emulator sources to the container
-COPY . .
-# Package it
-RUN mvn package && mv /target/Habbo*-with-dependencies.jar /target/Habbo.jar
-
-# Use Java 8 for running
-FROM java:8 AS runner
-
-# Copy the generated source
-COPY --from=builder /target/Habbo.jar /
-
-# Save the script to wait for the database, among running the Arcturus Emulator
-RUN echo "#!/bin/bash \n java -Dfile.encoding=UTF-8 -jar /Habbo.jar" > /entrypoint.sh
-RUN chmod +x /entrypoint.sh
-
-# Run the Emulator with Java
-ENTRYPOINT ["/entrypoint.sh"]
diff --git a/Emulator/LICENSE b/Emulator/LICENSE
deleted file mode 100644
index 418dc9a..0000000
--- a/Emulator/LICENSE
+++ /dev/null
@@ -1,165 +0,0 @@
-GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
\ No newline at end of file
diff --git a/Emulator/featurelist.md b/Emulator/featurelist.md
deleted file mode 100644
index 7f49499..0000000
--- a/Emulator/featurelist.md
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-The following file contains the current feature list for Arcturus Morningstar as of the 4.x Beta Branch.
-We hope this file will provide an easy place to find functions in Arcturus Morningstar for new developers, as well as give people the chance to see exactly what Arcturus Morningstar can do!
-
-If you wish to contribute to this list, features are laid out in the following format:
-
-
-
-## ✍️ Example Header:
-
-##### Example Feature Header- ✔️ (completed) ⭕ (incomplete/ not implemented)
-
-> [`ExampleLinkToRelatedClasses`](https://google.com)
->
-> ###### Example Sub Feature Header - ✔️
->
-> > [`ExampleLinkToRelatedSubClasses`](https://google.com)
-
-
-
-
-
-## 🖥️ Connection / User:
-
-##### Login via SSO Ticket ✔️
-
-> [`SecureLoginEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java)
-> [`HabboManager.loadHabbo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L104)
-
-##### Support RSA Encryption ✔️
-
-> [`HabboRSACrypto`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboRSACrypto.java)
-> [`HabboRC4`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboRC4.java)
-> [`HabboDiffieHellman`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java)
-> [`CompleteDiffieHandshakeEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/CompleteDiffieHandshakeEvent.java)
-> [`InitDiffieHandshakeEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/InitDiffieHandshakeEvent.java)
-
-
-
-## 🧸 RCON:
-
-##### RCON ✔️
-
-> [`RCONMessage`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java)
->
-> ###### RCON Messages - ✔️
->
-> > [`AlertUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/AlertUser.java))
-> > [`ChangeRoomOwner`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java)
-> > [`CreateModToolTicket`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/CreateModToolTicket.java)
-> > [`DisconnectUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java)
-> > [`ExecuteCommand`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ExecuteCommand.java)
-> > [`ForwardUser`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/ForwardUser.java)
-> > // todo finish this
-
-#####
-
-## 💠 Subscriptions:
-
-###### Subscriptions Manager ✔️
-
-> > [`Subscription`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/Subscription.java)
-> > [`SubscriptionManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionManager.java)
-> > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
-> > [`UserSubscriptionCreatedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/users/subscriptions/UserSubscriptionCreatedEvent.java)
-> > [`UserSubscriptionExpiredEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/users/subscriptions/UserSubscriptionExpiredEvent.java)
-> > [`UserSubscriptionExtendedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/master/src/main/java/com/eu/habbo/messages/rcon/RCONMessage.java)
-> >
-> > ##### Habbo Club - ✔️
-> >
-> > > [`SubscriptionHabboClub`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java)
-> > > [`RequestUserClubEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserClubEvent.java)
-> > > [`RequestClubDataEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/catalog/RequestClubDataEvent.java)
-> > > [`ClubDataComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubDataComposer.java)
-> > > [`HabboStats.hasActiveClub()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java#L555)
-> > >
-> > > ###### HC Catalogue - ✔️
-> > >
-> > > > [`ClubBuyLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/ClubBuyLayout.java)
-> > > > [`ClubOffer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java)
-> > > > [`ClubGiftsLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/ClubGiftsLayout.java)
-> > > > [`ClubGiftsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubGiftsComposer.java)
-> > > > [`ClubCenterDataComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/catalog/ClubCenterDataComposer.java)
-> > > > [`ClubGiftReceivedComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/ClubGiftReceivedComposer.java)
-> > >
-> > > ###### HC Payday - ✔️
-> > >
-> > > > [`SecureLoginEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java#L202)
-> > > > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
-> > > > [`SubscriptionHabboClub.calculatePayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L184)
-> > > > [`SubscriptionHabboClub.executePayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L257)
-> > > > [`SubscriptionHabboClub.processUnclaimed()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L316)
-> > > > [`SubscriptionHabboClub.claimPayDay()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L368)
-> > > > [`SubscriptionHabboClub.progressAchievement()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionHabboClub.java#L419)
-> > >
-> > > ###### HC Checks on clothing - ✔️
-> > >
-> > > > [`ClothingValidationManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/ClothingValidationManager.java)
-> > > > [`ClothingValidationManager.validateLook()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/clothingvalidation/ClothingValidationManager.java#L61)
-> > >
-> > > ###### HC dances - ✔️
-> > >
-> > > > [`RoomUserDanceEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserDanceEvent.java)
-> > > > [`RoomUserDanceComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDanceComposer.java)
-> > > > [`RoomUnit.getDanceType()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java#L456)
-> > > > [`RoomUnit.setDanceType()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java#L460)
-> >
-> > Builders Club - ⭕
-> >
-> > > [`SubscriptionScheduler`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/subscriptions/SubscriptionScheduler.java)
-> > > [`BuildersClubExpiredComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/unknown/BuildersClubExpiredComposer.java)
-> > >
-> > > ###### Builders Club Catalogue - ⭕
-> > >
-> > > > [`BuildersClubAddonsLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubAddonsLayout.java)
-> > > > [`BuildersClubLoyaltyLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubLoyaltyLayout.java))
-> > > > [`BuildersClubFrontPageLayout`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/BuildersClubFrontPageLayout.java)
-> >
-> >
-
-
-
-## 🤹 Entities:
-
-##### Habbo ✔️
-
-> [`Habbo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java)
-> [`Habbo.getClient()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L110)
-> [`Habbo.isOnline()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L64)
-> [`Habbo.getHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L90)
-> [`Habbo.getHabboStats()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L94)
-> [`Habbo.getRoomUnit()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L102)
-> [`HabboManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)
-> [`HabboManager.getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47)
-> [`HabboManager.getCloneAccounts()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L203)
-> [`HabboManager.setRank()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L243)
-> [`HabboInfo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)
-
-> ###### Clothing - ✔️
->
->
-> > [`UserClothesComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java)
-> > [`HabboInventory.getWardrobeComponent()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java#L67)
-> > [`HabboInventory.setWardrobeComponent()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java#L71)
->
-> ###### Inventory - ✔️
->
->
-> > [`HabboInventory`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInventory.java)
-> > [`Habbo.getInventory()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L98)
-> > [`ItemsComponent.addItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L67)
-> > [`ItemsComponent.addItems()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L82)
-> > [`ItemsComponent.getHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L99)
-> > [`ItemsComponent.getAndRemoveHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L103)
-> > [`ItemsComponent.removeHabboItem()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L126)
-> > [`ItemsComponent.getItemsAsValueCollection()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/ItemsComponent.java#L141)
-> > [`InventoryItemsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L265)
-> > [`InventoryBotsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryBotsComposer.java)
-> > [`InventoryPetsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryPetsComposer.java)
-> > [`InventoryAchievementsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryAchievementsComposer.java)
-> > [`InventoryRefreshComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/inventory/InventoryRefreshComposer.java)
-> > [`InventoryItemsAddedEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/inventory/InventoryItemsAddedEvent.java)
-> > [`InventoryItemEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/plugin/events/inventory/InventoryItemEvent.java)
->
-> ###### Motto - ✔️
->
->
-> > [`HabboInfo.setMotto()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L269)
-> > [`HabboInfo.getMotto()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java#L265)
->
-> ###### Badges - ✔️
->
->
-> > [`BadgesComponent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java)
-> > [`BadgesComponent.loadBadges()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L28)
-> > [`BadgesComponent.getBadgesOfflineHabbo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L75)
-> > [`BadgesComponent.createBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L90)
-> > [`BadgesComponent.deleteBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L113)
-> > [`BadgesComponent.getWearingBadges()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L123)
-> > [`BadgesComponent.hasBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L147)
-> > [`BadgesComponent.getBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L151)
-> > [`BadgesComponent.removeBadge()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java#L167)
->
-> ##### Load Currency and Seasonal Currency - ✔️
->
-> > [`RequestUserCreditsEvent`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserCreditsEvent.java)
-> > [`UserCurrencyComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserCurrencyComposer.java)
-> > [`UserCreditsComposer`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/messages/outgoing/users/UserCreditsComposer.java)
-> > [`Habbo.getHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L90)
-
-> Save/Load Achievements
->
-> Save/Load Friends
->
-> Save/Load Own Rooms
->
-> Save/Load Guilds
->
-> Save/Load Currencies
->
-> Save/Load Inventory
->
-> Save/Load Friendships - Love/Hate/Like
-
-
-
--
diff --git a/Emulator/pom.xml b/Emulator/pom.xml
index 276a08d..cf63987 100644
--- a/Emulator/pom.xml
+++ b/Emulator/pom.xml
@@ -32,17 +32,17 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.12.1
+ 3.8.1
- 16
- 16
+ 1.8
+ 1.8
org.apache.maven.plugins
maven-assembly-plugin
- 3.6.0
+ 3.3.0
jar-with-dependencies
@@ -67,11 +67,9 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.6.3
+ 3.2.0
-
- -Xdoclint:none
-
+ -Xdoclint:none
public
@@ -94,28 +92,21 @@
io.netty
netty-all
- 4.1.106.Final
+ 4.1.49.Final
com.google.code.gson
gson
- 2.10.1
+ 2.8.6
-
-
- com.mysql
- mysql-connector-j
- 8.3.0
+ mysql
+ mysql-connector-java
+ 8.0.22
runtime
@@ -131,36 +122,14 @@
com.zaxxer
HikariCP
- 5.1.0
+ 3.4.3
compile
-
-
- org.projectlombok
- lombok
- 1.18.30
- provided
-
-
-
-
- org.slf4j
- jcl-over-slf4j
- 2.0.11
- runtime
-
-
-
- org.slf4j
- slf4j-api
- 2.0.11
-
-
org.apache.commons
commons-lang3
- 3.14.0
+ 3.10
compile
@@ -174,27 +143,27 @@
org.jsoup
jsoup
- 1.17.2
+ 1.13.1
compile
ch.qos.logback
logback-classic
- 1.4.7
+ 1.2.3
compile
org.fusesource.jansi
jansi
- 2.4.1
+ 1.18
joda-time
joda-time
- 2.12.6
+ 2.10.6
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/Emulator.java b/Emulator/src/main/java/com/eu/habbo/Emulator.java
index 739b361..9dc8065 100644
--- a/Emulator/src/main/java/com/eu/habbo/Emulator.java
+++ b/Emulator/src/main/java/com/eu/habbo/Emulator.java
@@ -17,8 +17,6 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.util.imager.badges.BadgeImager;
-import io.netty.util.AttributeKey;
-import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,19 +26,18 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
-import java.security.SecureRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-@Slf4j
public final class Emulator {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
private static final String OS_NAME = (System.getProperty("os.name") != null ? System.getProperty("os.name") : "Unknown");
private static final String CLASS_PATH = (System.getProperty("java.class.path") != null ? System.getProperty("java.class.path") : "Unknown");
- private static final SecureRandom secureRandom = new SecureRandom();
+
public final static int MAJOR = 3;
- public final static int MINOR = 6;
- public final static int BUILD = 0;
+ public final static int MINOR = 5;
+ public final static int BUILD = 1;
public final static String PREVIEW = "";
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
@@ -51,12 +48,10 @@ public final class Emulator {
"██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
"██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
- "╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" +
- " Extended version";
+ "╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" ;
public static String build = "";
- public static String debuglevel = "";
public static boolean isReady = false;
public static boolean isShuttingDown = false;
public static boolean stopped = false;
@@ -76,7 +71,6 @@ public final class Emulator {
private static GameEnvironment gameEnvironment;
private static PluginManager pluginManager;
private static BadgeImager badgeImager;
- public static final AttributeKey WS_IP = AttributeKey.valueOf("WS_IP");
static {
Thread hook = new Thread(new Runnable() {
@@ -88,6 +82,13 @@ public final class Emulator {
Runtime.getRuntime().addShutdownHook(hook);
}
+ public static void promptEnterKey(){
+ System.out.println("\n");
+ System.out.println("Press \"ENTER\" if you agree to the terms stated above...");
+ Scanner scanner = new Scanner(System.in);
+ scanner.nextLine();
+ }
+
public static void main(String[] args) throws Exception {
try {
// Check if running on Windows and not in IntelliJ.
@@ -109,8 +110,16 @@ public final class Emulator {
System.out.println(logo);
- log.info("Version: {}", version);
- log.info("Build: {}", build);
+ // Checks if this is a BETA build before allowing them to continue.
+ if (PREVIEW.toLowerCase().contains("beta")) {
+ System.out.println("Warning, this is a beta build, this means that there may be unintended consequences so make sure you take regular backups while using this build. If you notice any issues you should make an issue on the Krews Git.");
+ promptEnterKey();
+ }
+ LOGGER.info("eek. Has it really been a year?");
+ LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
+ LOGGER.info("Version: {}", version);
+ LOGGER.info("Build: {}", build);
+ LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
long startTime = System.nanoTime();
@@ -143,22 +152,16 @@ public final class Emulator {
Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager();
- log.info("Arcturus Morningstar has successfully loaded.");
- log.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
- log.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
+ 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));
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
- Emulator.debuglevel = Emulator.getConfig().getValue("debug.level", "DEBUG");
- /* Debug level can be : INFO WARN DEBUG TRACE*/
if (debugging) {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.DEBUG);
- log.debug("Debugging enabled.");
- Level logLevel = Level.toLevel(Emulator.debuglevel);
- root.setLevel(logLevel);
- log.info("Debugging enabled.");
- log.info("The loaded debug mode is {}", Emulator.debuglevel);
+ LOGGER.debug("Debugging enabled.");
}
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
@@ -166,7 +169,7 @@ public final class Emulator {
Emulator.timeStarted = getIntUnixTimestamp();
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
- log.warn("Emulator settings runtime.threads ({}) can be increased to ({}) to possibly increase performance.",
+ LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to ({}) to possibly increase performance.",
Emulator.getConfig().getInt("runtime.threads"),
Runtime.getRuntime().availableProcessors() * 2);
}
@@ -189,7 +192,7 @@ public final class Emulator {
System.out.println("Waiting for command: ");
} catch (Exception e) {
if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) {
- log.error("Error while reading command", e);
+ LOGGER.error("Error while reading command", e);
}
}
}
@@ -231,7 +234,7 @@ public final class Emulator {
Emulator.isShuttingDown = true;
Emulator.isReady = false;
- log.info("Stopping Arcturus Morningstar {}", version);
+ LOGGER.info("Stopping Arcturus Morningstar {}", version);
try {
if (Emulator.getPluginManager() != null)
@@ -282,7 +285,7 @@ public final class Emulator {
} catch (Exception e) {
}
- log.info("Stopped Arcturus Morningstar {}", version);
+ LOGGER.info("Stopped Arcturus Morningstar {}", version);
if (Emulator.database != null) {
Emulator.getDatabase().dispose();
@@ -332,6 +335,9 @@ public final class Emulator {
return rconServer;
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public static Logging getLogging() {
return logging;
@@ -352,10 +358,6 @@ public final class Emulator {
public static Random getRandom() {
return ThreadLocalRandom.current();
}
-
- public static SecureRandom getRandomDice() {
- return secureRandom;
- }
public static BadgeImager getBadgeImager() {
return badgeImager;
@@ -456,7 +458,7 @@ public final class Emulator {
try {
res = format.parse(date);
} catch (Exception e) {
- log.error("Error parsing date", e);
+ LOGGER.error("Error parsing date", e);
}
return res;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/CleanerThread.java b/Emulator/src/main/java/com/eu/habbo/core/CleanerThread.java
index 04ee5f4..e9e2f12 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/CleanerThread.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/CleanerThread.java
@@ -7,7 +7,8 @@ import com.eu.habbo.messages.incoming.friends.SearchUserEvent;
import com.eu.habbo.messages.incoming.navigator.SearchRoomsEvent;
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
import com.eu.habbo.threading.runnables.AchievementUpdater;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -15,15 +16,17 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
-@Slf4j
public class CleanerThread implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class);
+
private static final int DELAY = 10000;
private static final int RELOAD_HALL_OF_FAME = 1800;
private static final int RELOAD_NEWS_LIST = 3600;
private static final int REMOVE_INACTIVE_ROOMS = 120;
private static final int REMOVE_INACTIVE_GUILDS = 60;
private static final int REMOVE_INACTIVE_TOURS = 600;
+ private static final int SAVE_ERROR_LOGS = 30;
private static final int CLEAR_CACHED_VALUES = 60 * 60;
private static final int CALLBACK_TIME = 60 * 15;
@@ -32,6 +35,7 @@ public class CleanerThread implements Runnable {
private static int LAST_INACTIVE_ROOMS_CLEARED = Emulator.getIntUnixTimestamp();
private static int LAST_INACTIVE_GUILDS_CLEARED = Emulator.getIntUnixTimestamp();
private static int LAST_INACTIVE_TOURS_CLEARED = Emulator.getIntUnixTimestamp();
+ private static int LAST_ERROR_LOGS_SAVED = Emulator.getIntUnixTimestamp();
private static int LAST_DAILY_REFILL = Emulator.getIntUnixTimestamp();
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp();
@@ -77,6 +81,11 @@ public class CleanerThread implements Runnable {
LAST_INACTIVE_TOURS_CLEARED = time;
}
+ if (time - LAST_ERROR_LOGS_SAVED > SAVE_ERROR_LOGS) {
+ Emulator.getDatabaseLogger().save();
+ LAST_ERROR_LOGS_SAVED = time;
+ }
+
if (time - LAST_CALLBACK > CALLBACK_TIME) {
// Emulator.getThreading().run(new HTTPPostStatus());
LAST_CALLBACK = time;
@@ -119,10 +128,10 @@ public class CleanerThread implements Runnable {
statement.execute("DELETE FROM users_effects WHERE total <= 0");
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
- log.info("Database -> Cleaned!");
+ LOGGER.info("Database -> Cleaned!");
}
public void refillDailyRespects() {
@@ -131,7 +140,7 @@ public class CleanerThread implements Runnable {
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
if (Emulator.isReady) {
@@ -153,7 +162,7 @@ public class CleanerThread implements Runnable {
habbo.clearCaches();
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/CommandLog.java b/Emulator/src/main/java/com/eu/habbo/core/CommandLog.java
index a0039a5..1dfb284 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/CommandLog.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/CommandLog.java
@@ -14,13 +14,13 @@ public class CommandLog implements DatabaseLoggable {
private final int timestamp = Emulator.getIntUnixTimestamp();
private final Command command;
private final String params;
- private final boolean success;
+ private final boolean succes;
- public CommandLog(int userId, Command command, String params, boolean success) {
+ public CommandLog(int userId, Command command, String params, boolean succes) {
this.userId = userId;
this.command = command;
this.params = params;
- this.success = success;
+ this.succes = succes;
}
@Override
@@ -34,7 +34,7 @@ public class CommandLog implements DatabaseLoggable {
statement.setInt(2, this.timestamp);
statement.setString(3, this.command.getClass().getSimpleName());
statement.setString(4, this.params);
- statement.setString(5, this.success ? "yes" : "no");
+ statement.setString(5, this.succes ? "yes" : "no");
statement.addBatch();
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java
index e583ea0..19b442f 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java
@@ -3,7 +3,8 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
@@ -13,9 +14,10 @@ import java.sql.*;
import java.util.Map;
import java.util.Properties;
-@Slf4j
public class ConfigurationManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationManager.class);
+
private final Properties properties;
private final String configurationPath;
public boolean loaded = false;
@@ -49,7 +51,7 @@ public class ConfigurationManager {
this.properties.load(input);
} catch (IOException ex) {
- log.error("Failed to load config file.", ex);
+ LOGGER.error("Failed to load config file.", ex);
ex.printStackTrace();
} finally {
if (input != null) {
@@ -90,7 +92,7 @@ public class ConfigurationManager {
String envValue = System.getenv(entry.getValue());
if (envValue == null || envValue.length() == 0) {
- log.info("Cannot find environment-value for variable `" + entry.getValue() + "`");
+ LOGGER.info("Cannot find environment-value for variable `" + entry.getValue() + "`");
} else {
this.properties.setProperty(entry.getKey(), envValue);
}
@@ -102,7 +104,7 @@ public class ConfigurationManager {
}
this.isLoading = false;
- log.info("Configuration Manager -> Loaded!");
+ LOGGER.info("Configuration Manager -> Loaded!");
if (Emulator.getPluginManager() != null) {
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
@@ -110,7 +112,7 @@ public class ConfigurationManager {
}
public void loadFromDatabase() {
- log.info("Loading configuration from database...");
+ LOGGER.info("Loading configuration from database...");
long millis = System.currentTimeMillis();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
@@ -122,10 +124,10 @@ public class ConfigurationManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
- log.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void saveToDatabase() {
@@ -136,7 +138,7 @@ public class ConfigurationManager {
statement.executeUpdate();
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -151,7 +153,7 @@ public class ConfigurationManager {
return defaultValue;
if (!this.properties.containsKey(key)) {
- log.error("Config key not found {}", key);
+ LOGGER.error("Config key not found {}", key);
}
return this.properties.getProperty(key, defaultValue);
}
@@ -167,7 +169,7 @@ public class ConfigurationManager {
try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} catch (Exception e) {
- log.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key));
+ LOGGER.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key));
}
return defaultValue;
}
@@ -183,7 +185,7 @@ public class ConfigurationManager {
try {
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (Exception e) {
- log.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key));
+ LOGGER.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key));
}
return defaultValue;
}
@@ -199,7 +201,7 @@ public class ConfigurationManager {
try {
return Double.parseDouble(this.getValue(key, defaultValue.toString()));
} catch (Exception e) {
- log.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key));
+ LOGGER.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key));
}
return defaultValue;
@@ -218,7 +220,7 @@ public class ConfigurationManager {
statement.setString(2, value);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.update(key, value);
diff --git a/Emulator/src/main/java/com/eu/habbo/core/CreditsScheduler.java b/Emulator/src/main/java/com/eu/habbo/core/CreditsScheduler.java
index 4265226..db5e74f 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/CreditsScheduler.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/CreditsScheduler.java
@@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Map;
-@Slf4j
public class CreditsScheduler extends Scheduler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class);
+
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static double HC_MODIFIER;
@@ -51,7 +55,7 @@ public class CreditsScheduler extends Scheduler {
habbo.giveCredits((int)(habbo.getHabboInfo().getRank().getCreditsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/DatabaseLogger.java b/Emulator/src/main/java/com/eu/habbo/core/DatabaseLogger.java
index ddb4a97..2f8806a 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/DatabaseLogger.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/DatabaseLogger.java
@@ -1,25 +1,46 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+import java.util.concurrent.ConcurrentLinkedQueue;
-@Slf4j
public class DatabaseLogger {
- public void store(final DatabaseLoggable loggable) {
- Emulator.getThreading().run(() -> {
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class);
+
+ private final ConcurrentLinkedQueue loggables = new ConcurrentLinkedQueue<>();
+
+ public void store(DatabaseLoggable loggable) {
+ this.loggables.add(loggable);
+ }
+
+ public void save() {
+ if (Emulator.getDatabase() == null || Emulator.getDatabase().getDataSource() == null) {
+ return;
+ }
+
+ if (this.loggables.isEmpty()) {
+ return;
+ }
+
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
+ while (!this.loggables.isEmpty()) {
+ DatabaseLoggable loggable = this.loggables.remove();
+
try (PreparedStatement statement = connection.prepareStatement(loggable.getQuery())) {
loggable.log(statement);
statement.executeBatch();
}
- } catch (SQLException e) {
- log.error("Exception caught while saving loggable to database.", e);
+
}
- });
+ } catch (SQLException e) {
+ LOGGER.error("Exception caught while saving loggables to database.", e);
+ }
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/ErrorLog.java b/Emulator/src/main/java/com/eu/habbo/core/ErrorLog.java
index 31b4fd8..f0d6207 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/ErrorLog.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/ErrorLog.java
@@ -1,18 +1,23 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-@Slf4j
public class ErrorLog implements DatabaseLoggable {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLog.class);
private static final String QUERY = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
+
public final String version;
public final String buildHash;
+
public final int timeStamp;
public final String type;
public final String stackTrace;
@@ -33,7 +38,7 @@ public class ErrorLog implements DatabaseLoggable {
pw.close();
sw.close();
} catch (IOException e1) {
- log.error("Exception caught", e1);
+ LOGGER.error("Exception caught", e1);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java b/Emulator/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
index add7148..58350a9 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
@@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Map;
-@Slf4j
public class GotwPointsScheduler extends Scheduler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class);
+
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static String GOTW_POINTS_NAME;
@@ -64,7 +68,7 @@ public class GotwPointsScheduler extends Scheduler {
}
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/Logging.java b/Emulator/src/main/java/com/eu/habbo/core/Logging.java
index b64087c..b1384a4 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/Logging.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/Logging.java
@@ -1,63 +1,97 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.SQLException;
-@Slf4j
public class Logging {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger");
+
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logStart(Object line) {
- log.info("[LOADING] {}", line);
+ LOGGER.info("[LOADING] {}", line);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logShutdownLine(Object line) {
- log.info("[SHUTDOWN] {}", line);
+ LOGGER.info("[SHUTDOWN] {}", line);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logUserLine(Object line) {
- log.info("[USER] {}", line);
+ LOGGER.info("[USER] {}", line);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logDebugLine(Object line) {
- log.debug("[DEBUG] {}", line);
+ LOGGER.debug("[DEBUG] {}", line);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logPacketLine(Object line) {
if (Emulator.getConfig().getBoolean("debug.show.packets")) {
- log.debug("[PACKET] {}", line);
+ LOGGER.debug("[PACKET] {}", line);
}
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logUndefinedPacketLine(Object line) {
if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) {
- log.debug("[PACKET] [UNDEFINED] {}", line);
+ LOGGER.debug("[PACKET] [UNDEFINED] {}", line);
}
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logErrorLine(Object line) {
- log.error("[ERROR] {}", line);
+ LOGGER.error("[ERROR] {}", line);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logSQLException(SQLException e) {
- log.error("[ERROR] SQLException", e);
+ LOGGER.error("[ERROR] SQLException", e);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void logPacketError(Object e) {
- log.error("[ERROR] PacketError {}", e);
+ LOGGER.error("[ERROR] PacketError {}", e);
}
+ /**
+ * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
+ */
@Deprecated
public void handleException(Exception e) {
- log.error("[ERROR] Exception", e);
+ LOGGER.error("[ERROR] Exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/PixelScheduler.java b/Emulator/src/main/java/com/eu/habbo/core/PixelScheduler.java
index a75589a..2b0bddd 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/PixelScheduler.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/PixelScheduler.java
@@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Map;
-@Slf4j
public class PixelScheduler extends Scheduler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PixelScheduler.class);
+
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static double HC_MODIFIER;
@@ -48,7 +52,7 @@ public class PixelScheduler extends Scheduler {
habbo.givePixels((int)(habbo.getHabboInfo().getRank().getPixelsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/PointsScheduler.java b/Emulator/src/main/java/com/eu/habbo/core/PointsScheduler.java
index 04a875d..ca863cb 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/PointsScheduler.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/PointsScheduler.java
@@ -2,11 +2,15 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Map;
-@Slf4j
public class PointsScheduler extends Scheduler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PointsScheduler.class);
+
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static double HC_MODIFIER;
@@ -51,7 +55,7 @@ public class PointsScheduler extends Scheduler {
habbo.givePoints((int)(habbo.getHabboInfo().getRank().getDiamondsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java b/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java
index acb5397..4b0bf66 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java
@@ -1,14 +1,16 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.Properties;
-@Slf4j
public class TextsManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TextsManager.class);
+
private final Properties texts;
public TextsManager() {
@@ -19,7 +21,7 @@ public class TextsManager {
try {
this.reload();
- log.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} catch (Exception e) {
e.printStackTrace();
}
@@ -35,7 +37,7 @@ public class TextsManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -45,7 +47,7 @@ public class TextsManager {
public String getValue(String key, String defaultValue) {
if (!this.texts.containsKey(key)) {
- log.error("Text key not found: {}", key);
+ LOGGER.error("Text key not found: {}", key);
}
return this.texts.getProperty(key, defaultValue);
}
@@ -58,7 +60,7 @@ public class TextsManager {
try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return defaultValue;
}
@@ -71,7 +73,7 @@ public class TextsManager {
try {
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (NumberFormatException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return defaultValue;
}
@@ -89,7 +91,7 @@ public class TextsManager {
statement.setString(2, value);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.update(key, value);
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
index c4f50ad..ea10362 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
@@ -1,10 +1,11 @@
package com.eu.habbo.core.consolecommands;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public abstract class ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class);
private static final THashMap commands = new THashMap<>();
public final String key;
@@ -44,19 +45,21 @@ public abstract class ConsoleCommand {
command.handle(message);
return true;
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
} else {
- log.info("Unknown Console Command " + message[0]);
- log.info("Commands Available (" + commands.size() + "): ");
+ LOGGER.info("Unknown Console Command " + message[0]);
+ LOGGER.info("Commands Available (" + commands.size() + "): ");
for (ConsoleCommand c : commands.values()) {
- log.info(c.key + " - " + c.usage);
+ LOGGER.info(c.key + " - " + c.usage);
}
}
}
return false;
}
+
public abstract void handle(String[] args) throws Exception;
+
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
index 3038210..db7c22b 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
@@ -2,12 +2,14 @@ package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
-@Slf4j
public class ConsoleInfoCommand extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class);
+
public ConsoleInfoCommand() {
super("info", "Show current statistics.");
}
@@ -20,21 +22,21 @@ public class ConsoleInfoCommand extends ConsoleCommand {
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
- log.info("Emulator version: " + Emulator.version);
- log.info("Emulator build: " + Emulator.build);
+ LOGGER.info("Emulator version: " + Emulator.version);
+ LOGGER.info("Emulator build: " + Emulator.build);
- log.info("");
+ LOGGER.info("");
- log.info("Hotel Statistics");
- log.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
- log.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
- log.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
- log.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
- log.info("");
- log.info("Server Statistics");
- log.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
- log.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
- log.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
- log.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
+ LOGGER.info("Hotel Statistics");
+ LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
+ LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
+ LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
+ LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
+ LOGGER.info("");
+ LOGGER.info("Server Statistics");
+ LOGGER.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
+ LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
+ LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
+ LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
index 40f1f9b..587130d 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
@@ -1,17 +1,19 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.networking.camera.CameraClient;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class ConsoleReconnectCameraCommand extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class);
+
public ConsoleReconnectCameraCommand() {
super("camera", "Attempt to reconnect to the camera server.");
}
@Override
public void handle(String[] args) throws Exception {
- log.info("Connecting to the camera...");
+ LOGGER.info("Connecting to the camera...");
CameraClient.attemptReconnect = true;
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
index 3f69e05..cd02b90 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
@@ -1,11 +1,14 @@
package com.eu.habbo.core.consolecommands;
+
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class ConsoleTestCommand extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class);
+
public ConsoleTestCommand() {
super("test", "This is just a test.");
}
@@ -13,7 +16,9 @@ public class ConsoleTestCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
if (Emulator.debugging) {
- log.info("This is a test command for live debugging.");
+ LOGGER.info("This is a test command for live debugging.");
+
+
//AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30);
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(1);
habbo.getHabboInfo().getMachineID();
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
index 1d93112..e8487a9 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
@@ -1,11 +1,12 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-
-@Slf4j
public class ShowInteractionsCommand extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class);
+
public ShowInteractionsCommand() {
super("interactions", "Show a list of available furniture interactions.");
}
@@ -13,7 +14,7 @@ public class ShowInteractionsCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) {
- log.info(interaction);
+ LOGGER.info(interaction);
}
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
index 4da7f13..821d2f1 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
@@ -1,10 +1,11 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class ShowRCONCommands extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class);
public ShowRCONCommands() {
super("rconcommands", "Show a list of all RCON commands");
@@ -13,7 +14,7 @@ public class ShowRCONCommands extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
for (String command : Emulator.getRconServer().getCommands()) {
- log.info(command);
+ LOGGER.info(command);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
index ab53bf8..64378af 100644
--- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
@@ -1,10 +1,11 @@
package com.eu.habbo.core.consolecommands;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class ThankyouArcturusCommand extends ConsoleCommand {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ThankyouArcturusCommand.class);
public ThankyouArcturusCommand() {
super("thankyou", "A thankyou message.");
@@ -12,31 +13,31 @@ public class ThankyouArcturusCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
- log.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
- log.info("Thankyou to the following people who have helped with it's development:");
- log.info("TheGeneral - For Creating Arcturus.");
- log.info("Capheus - Decompilation");
- log.info("Beny - Lead Developer");
- log.info("Alejandro - Lead Developer");
- log.info("Harmonic - Developer");
- log.info("ArpyAge - Developer");
- log.info("Mike - Developer");
- log.info("Skeletor - Developer");
- log.info("zGrav - Developer");
- log.info("Swirny - Developer");
- log.info("Quadral - Developer");
- log.info("Dome - Developer");
- log.info("Necmi - Developer");
- log.info("Oliver - Support");
- log.info("Rasmus - Support");
- log.info("Layne - Support");
- log.info("Bill - Support");
- log.info("Harmony - Support");
- log.info("Ridge - Catalogue");
- log.info("Tenshie - Catalogue");
- log.info("Wulles - Catalogue");
- log.info("Gizmo - Catalogue");
- log.info("TheJava - Motivation");
- log.info("The Entire Krews.org Community.");
+ LOGGER.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
+ LOGGER.info("Thankyou to the following people who have helped with it's development:");
+ LOGGER.info("TheGeneral - For Creating Arcturus.");
+ LOGGER.info("Capheus - Decompilation");
+ LOGGER.info("Beny - Lead Developer");
+ LOGGER.info("Alejandro - Lead Developer");
+ LOGGER.info("Harmonic - Developer");
+ LOGGER.info("ArpyAge - Developer");
+ LOGGER.info("Mike - Developer");
+ LOGGER.info("Skeletor - Developer");
+ LOGGER.info("zGrav - Developer");
+ LOGGER.info("Swirny - Developer");
+ LOGGER.info("Quadral - Developer");
+ LOGGER.info("Dome - Developer");
+ LOGGER.info("Necmi - Developer");
+ LOGGER.info("Oliver - Support");
+ LOGGER.info("Rasmus - Support");
+ LOGGER.info("Layne - Support");
+ LOGGER.info("Bill - Support");
+ LOGGER.info("Harmony - Support");
+ LOGGER.info("Ridge - Catalogue");
+ LOGGER.info("Tenshie - Catalogue");
+ LOGGER.info("Wulles - Catalogue");
+ LOGGER.info("Gizmo - Catalogue");
+ LOGGER.info("TheJava - Motivation");
+ LOGGER.info("The Entire Krews.org Community.");
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/database/Database.java b/Emulator/src/main/java/com/eu/habbo/database/Database.java
index 171e7c9..00be0fe 100644
--- a/Emulator/src/main/java/com/eu/habbo/database/Database.java
+++ b/Emulator/src/main/java/com/eu/habbo/database/Database.java
@@ -5,7 +5,9 @@ import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariDataSource;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -13,8 +15,10 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-@Slf4j
public class Database {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Database.class);
+
private HikariDataSource dataSource;
private DatabasePool databasePool;
@@ -26,21 +30,21 @@ public class Database {
try {
this.databasePool = new DatabasePool();
if (!this.databasePool.getStoragePooling(config)) {
- log.info("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down...");
+ LOGGER.info("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down...");
SQLException = true;
return;
}
this.dataSource = this.databasePool.getDatabase();
} catch (Exception e) {
SQLException = true;
- log.error("Failed to connect to your database.", e);
+ LOGGER.error("Failed to connect to your database.", e);
} finally {
if (SQLException) {
Emulator.prepareShutdown();
}
}
- log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
+ LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
}
public void dispose() {
diff --git a/Emulator/src/main/java/com/eu/habbo/database/DatabasePool.java b/Emulator/src/main/java/com/eu/habbo/database/DatabasePool.java
index 5e09e06..9a33ba2 100644
--- a/Emulator/src/main/java/com/eu/habbo/database/DatabasePool.java
+++ b/Emulator/src/main/java/com/eu/habbo/database/DatabasePool.java
@@ -3,58 +3,49 @@ package com.eu.habbo.database;
import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
class DatabasePool {
- private static final String DB_POOL_MAX_SIZE = "db.pool.maxsize";
- private static final String DB_POOL_MIN_SIZE = "db.pool.minsize";
- private static final String DB_HOSTNAME_KEY = "db.hostname";
- private static final String DB_PORT_KEY = "db.port";
- private static final String DB_PASSWORD_KEY = "db.password";
- private static final String DB_NAME_KEY = "db.database";
- private static final String DB_USER_KEY = "db.username";
- private static final String DB_PARAMS_KEY = "db.params";
+ private final Logger log = LoggerFactory.getLogger(DatabasePool.class);
private HikariDataSource database;
- private static DatabasePool instance;
-
- DatabasePool() {
- // Private constructor for singleton pattern
- }
- public static synchronized DatabasePool getInstance() {
- if (instance == null) {
- instance = new DatabasePool();
- }
- return instance;
- }
public boolean getStoragePooling(ConfigurationManager config) {
try {
HikariConfig databaseConfiguration = new HikariConfig();
- databaseConfiguration.setMaximumPoolSize(config.getInt(DB_POOL_MAX_SIZE, 50));
- databaseConfiguration.setMinimumIdle(config.getInt(DB_POOL_MIN_SIZE, 10));
- databaseConfiguration.setJdbcUrl("jdbc:mysql://" + config.getValue(DB_HOSTNAME_KEY, "localhost") + ":" + config.getValue(DB_PORT_KEY, "3306") + "/" + config.getValue(DB_NAME_KEY) + config.getValue(DB_PARAMS_KEY));
- databaseConfiguration.addDataSourceProperty("serverName", config.getValue(DB_HOSTNAME_KEY, "localhost"));
- databaseConfiguration.addDataSourceProperty("port", config.getValue(DB_PORT_KEY, "3306"));
- databaseConfiguration.addDataSourceProperty("databaseName", config.getValue(DB_NAME_KEY));
- databaseConfiguration.addDataSourceProperty("user", config.getValue(DB_USER_KEY));
- databaseConfiguration.addDataSourceProperty("password", config.getValue(DB_PASSWORD_KEY));
- log.info("INITIALIZING DATABASE SERVER: " + config.getValue(DB_HOSTNAME_KEY));
- log.info("ON PORT: " + config.getValue(DB_PORT_KEY));
- log.info("HABBO DATABASE: " + config.getValue(DB_NAME_KEY));
-
+ databaseConfiguration.setMaximumPoolSize(config.getInt("db.pool.maxsize", 50));
+ databaseConfiguration.setMinimumIdle(config.getInt("db.pool.minsize", 10));
+ databaseConfiguration.setJdbcUrl("jdbc:mysql://" + config.getValue("db.hostname", "localhost") + ":" + config.getValue("db.port", "3306") + "/" + config.getValue("db.database", "habbo") + config.getValue("db.params"));
+ databaseConfiguration.addDataSourceProperty("serverName", config.getValue("db.hostname", "localhost"));
+ databaseConfiguration.addDataSourceProperty("port", config.getValue("db.port", "3306"));
+ databaseConfiguration.addDataSourceProperty("databaseName", config.getValue("db.database", "habbo"));
+ databaseConfiguration.addDataSourceProperty("user", config.getValue("db.username"));
+ databaseConfiguration.addDataSourceProperty("password", config.getValue("db.password"));
+ databaseConfiguration.addDataSourceProperty("dataSource.logger", "com.mysql.jdbc.log.StandardLogger");
+ databaseConfiguration.addDataSourceProperty("dataSource.logSlowQueries", "true");
+ databaseConfiguration.addDataSourceProperty("dataSource.dumpQueriesOnException", "true");
+ databaseConfiguration.addDataSourceProperty("prepStmtCacheSize", "500");
+ databaseConfiguration.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
+ // databaseConfiguration.addDataSourceProperty("dataSource.logWriter", Logging.getErrorsSQLWriter());
+ databaseConfiguration.addDataSourceProperty("cachePrepStmts", "true");
+ databaseConfiguration.addDataSourceProperty("useServerPrepStmts", "true");
+ databaseConfiguration.addDataSourceProperty("rewriteBatchedStatements", "true");
+ databaseConfiguration.addDataSourceProperty("useUnicode", "true");
+ databaseConfiguration.setAutoCommit(true);
+ databaseConfiguration.setConnectionTimeout(300000L);
+ databaseConfiguration.setValidationTimeout(5000L);
+ databaseConfiguration.setLeakDetectionThreshold(20000L);
+ databaseConfiguration.setMaxLifetime(1800000L);
+ databaseConfiguration.setIdleTimeout(600000L);
+ //databaseConfiguration.setDriverClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
this.database = new HikariDataSource(databaseConfiguration);
} catch (Exception e) {
- log.error("Error initializing database connection pool: {}", e.getMessage());
return false;
}
return true;
}
public HikariDataSource getDatabase() {
- if (database == null) {
- throw new IllegalStateException("Database connection pool is not initialized.");
- }
- return database;
+ return this.database;
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
index db5e3ba..7944ae8 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
@@ -23,10 +23,13 @@ import com.eu.habbo.habbohotel.rooms.RoomManager;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionManager;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionScheduler;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class GameEnvironment {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class);
+
public CreditsScheduler creditsScheduler;
public PixelScheduler pixelScheduler;
public PointsScheduler pointsScheduler;
@@ -55,7 +58,7 @@ public class GameEnvironment {
private CalendarManager calendarManager;
public void load() throws Exception {
- log.info("GameEnvironment -> Loading...");
+ LOGGER.info("GameEnvironment -> Loading...");
this.permissionsManager = new PermissionsManager();
this.habboManager = new HabboManager();
@@ -97,7 +100,7 @@ public class GameEnvironment {
this.subscriptionScheduler = new SubscriptionScheduler();
Emulator.getThreading().run(this.subscriptionScheduler);
- log.info("GameEnvironment -> Loaded!");
+ LOGGER.info("GameEnvironment -> Loaded!");
}
public void dispose() {
@@ -115,7 +118,7 @@ public class GameEnvironment {
this.hotelViewManager.dispose();
this.subscriptionManager.dispose();
this.calendarManager.dispose();
- log.info("GameEnvironment -> Disposed!");
+ LOGGER.info("GameEnvironment -> Disposed!");
}
public HabboManager getHabboManager() {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/LatencyTracker.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/LatencyTracker.java
deleted file mode 100644
index b2ffb9d..0000000
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/LatencyTracker.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.eu.habbo.habbohotel;
-
-import com.eu.habbo.habbohotel.gameclients.GameClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-
-public class LatencyTracker {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class);
-
- private boolean initialPing;
-
- private long last;
- private long average;
-
- public LatencyTracker() {
- this.initialPing = true;
- this.average = 0;
- }
-
- public void update(long latencyInNano) {
- this.last = latencyInNano;
-
- if (this.initialPing) {
- this.initialPing = false;
- this.average = latencyInNano;
- return;
- }
-
- this.average = (long) (this.average * .7f + latencyInNano * .3f);
- }
-
- public boolean hasInitialized() {
- return !this.initialPing;
- }
-
- public long getLastMs() {
- return TimeUnit.NANOSECONDS.toMillis(this.last);
- }
-
- public long getAverageMs() {
- return TimeUnit.NANOSECONDS.toMillis(this.average);
- }
-
-}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
index 5e614aa..78304cd 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
@@ -18,14 +18,16 @@ import com.eu.habbo.plugin.events.users.achievements.UserAchievementLeveledEvent
import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectIntProcedure;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.LinkedHashMap;
import java.util.Map;
-@Slf4j
public class AchievementManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AchievementManager.class);
+
public static boolean TALENTTRACK_ENABLED = false;
private final THashMap achievements;
@@ -57,7 +59,7 @@ public class AchievementManager {
statement.setInt(4, amount);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -139,7 +141,7 @@ public class AchievementManager {
try {
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
return;
}
}
@@ -207,7 +209,7 @@ public class AchievementManager {
statement.setInt(3, 1);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -221,7 +223,7 @@ public class AchievementManager {
}
statement.executeBatch();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -235,7 +237,7 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return 0;
@@ -258,9 +260,9 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
@@ -280,13 +282,13 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
- log.error("Achievement Manager -> Failed to load!");
+ LOGGER.error("Caught SQL exception", e);
+ LOGGER.error("Achievement Manager -> Failed to load!");
return;
}
}
- log.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public Achievement getAchievement(String name) {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
index b9425a7..e491523 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
@@ -5,13 +5,14 @@ import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class TalentTrackLevel {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TalentTrackLevel.class);
public TalentTrackType type;
public int level;
@@ -38,7 +39,7 @@ public class TalentTrackLevel {
if (achievement != null) {
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
} else {
- log.error("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
+ LOGGER.error("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
}
}
}
@@ -49,7 +50,7 @@ public class TalentTrackLevel {
if (item != null) {
this.items.add(item);
} else {
- log.error("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
+ LOGGER.error("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
index 189106c..b1149aa 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
@@ -12,7 +12,8 @@ import com.eu.habbo.plugin.events.bots.BotShoutEvent;
import com.eu.habbo.plugin.events.bots.BotTalkEvent;
import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
import com.eu.habbo.threading.runnables.BotFollowHabbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -21,8 +22,9 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
-@Slf4j
public class Bot implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Bot.class);
+
public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}";
public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";");
@@ -162,7 +164,7 @@ public class Bot implements Runnable {
statement.execute();
this.needsUpdate = false;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -196,7 +198,7 @@ public class Bot implements Runnable {
.replace(Emulator.getTexts().getValue("wired.variable.item_count", "%item_count%"), this.room.itemCount() + "")
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), this.name)
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), this.room.getName())
- .replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), this.room.getUserCount() + ""); // TODO: Should getUserCount be replaced with getUsersWithoutInvisibleHabbos?
+ .replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), this.room.getUserCount() + "");
if(!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), room, new Object[]{ message })) {
this.talk(message);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
index fa6182e..2eebcc6 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
@@ -17,14 +17,18 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
import com.eu.habbo.plugin.events.bots.BotPickUpEvent;
import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.Map;
-@Slf4j
+
+
public class BotManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class);
+
final private static THashMap> botDefenitions = new THashMap<>();
public static int MINIMUM_CHAT_SPEED = 7;
public static int MAXIMUM_CHAT_SPEED = 604800;
@@ -41,7 +45,7 @@ public class BotManager {
this.reload();
- log.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static void addBotDefinition(String type, Class extends Bot> botClazz) throws Exception {
@@ -56,10 +60,10 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} catch (NoSuchMethodException e) {
- log.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!");
+ LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!");
return false;
} catch (Exception e) {
- log.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
+ LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
return false;
}
}
@@ -86,12 +90,12 @@ public class BotManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return bot;
@@ -147,7 +151,7 @@ public class BotManager {
try {
topItem.onWalkOn(bot.getRoomUnit(), room, null);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -205,11 +209,11 @@ public class BotManager {
if (botClazz != null)
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
else
- log.error("Unknown Bot Type: " + type);
+ LOGGER.error("Unknown Bot Type: " + type);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return null;
@@ -220,7 +224,7 @@ public class BotManager {
statement.setInt(1, bot.getId());
return statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -233,9 +237,9 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} catch (NoSuchMethodException e) {
- log.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
+ LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
} catch (Exception e) {
- log.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
+ LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
index 99ad733..b5acb9f 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
@@ -10,7 +10,8 @@ import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.ResultSet;
@@ -21,8 +22,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-@Slf4j
public class ButlerBot extends Bot {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ButlerBot.class);
public static THashMap, Integer> serveItems = new THashMap<>();
public ButlerBot(ResultSet set) throws SQLException {
@@ -47,7 +48,7 @@ public class ButlerBot extends Bot {
serveItems.put(ks, set.getInt("item"));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/campaign/calendar/CalendarManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/campaign/calendar/CalendarManager.java
index e384ace..1336f88 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/campaign/calendar/CalendarManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/campaign/calendar/CalendarManager.java
@@ -5,7 +5,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarProductComposer;
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
@@ -13,15 +14,17 @@ import java.util.Date;
import static java.time.temporal.ChronoUnit.DAYS;
-@Slf4j
+
public class CalendarManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CalendarCampaign.class);
+
final private static Map calendarCampaigns = new THashMap<>();
public static double HC_MODIFIER;
public CalendarManager() {
long millis = System.currentTimeMillis();
this.reload();
- log.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
+ LOGGER.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
}
public void dispose(){
@@ -37,7 +40,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
return false;
}
@@ -51,7 +54,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
return false;
}
@@ -82,7 +85,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
calendarCampaigns.put(campaign.getId(), campaign);
@@ -95,7 +98,7 @@ public class CalendarManager {
statement.setInt(1, campaign.getId());
return statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -141,7 +144,7 @@ public class CalendarManager {
statement.setInt(5, Emulator.getIntUnixTimestamp());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
index 6cb29e7..c8d015e 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
@@ -7,7 +7,8 @@ import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -15,8 +16,8 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
-@Slf4j
public class CatalogItem implements ISerialize, Runnable, Comparable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CatalogItem.class);
int id;
int limitedStack;
private int pageId;
@@ -28,12 +29,26 @@ public class CatalogItem implements ISerialize, Runnable, Comparable bundle;
public CatalogItem(ResultSet set) throws SQLException {
@@ -168,10 +183,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0) {
@@ -250,8 +261,8 @@ public class CatalogItem implements ISerialize, Runnable, Comparable limitedNumbers;
private int totalSet;
@@ -49,7 +51,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(5, item.getLimitedSells());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -67,7 +69,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.executeBatch();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.totalSet += amount;
@@ -100,7 +102,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(3, this.itemId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
index abe0f5e..acd0551 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
@@ -41,15 +41,17 @@ import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
-@Slf4j
public class CatalogManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CatalogManager.class);
+
public static final THashMap> pageDefinitions = new THashMap>(CatalogPageLayouts.values().length) {
{
for (CatalogPageLayouts layout : CatalogPageLayouts.values()) {
@@ -219,7 +221,7 @@ public class CatalogManager {
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
- log.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
@@ -258,7 +260,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
for (Map.Entry> set : limiteds.entrySet()) {
@@ -278,7 +280,7 @@ public class CatalogManager {
Class extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout"));
if (pageClazz == null) {
- log.info("Unknown Page Layout: " + set.getString("page_layout"));
+ LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
continue;
}
@@ -286,12 +288,12 @@ public class CatalogManager {
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
pages.put(page.getId(), page);
} catch (Exception e) {
- log.error("Failed to load layout: {}", set.getString("page_layout"));
+ LOGGER.error("Failed to load layout: {}", set.getString("page_layout"));
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
pages.forEachValue((object) -> {
@@ -303,7 +305,7 @@ public class CatalogManager {
}
} else {
if (object.parentId != -2) {
- log.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")");
+ LOGGER.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")");
}
}
return true;
@@ -311,7 +313,7 @@ public class CatalogManager {
this.catalogPages.putAll(pages);
- log.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
+ LOGGER.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
}
@@ -332,7 +334,7 @@ public class CatalogManager {
));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -376,7 +378,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
for (CatalogPage page : this.catalogPages.valueCollection()) {
@@ -401,7 +403,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -417,7 +419,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -432,7 +434,7 @@ public class CatalogManager {
this.vouchers.add(new Voucher(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -452,11 +454,11 @@ public class CatalogManager {
this.prizes.get(set.getInt("rarity")).add(item);
} else {
- log.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id"));
+ LOGGER.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id"));
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -481,7 +483,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -496,7 +498,7 @@ public class CatalogManager {
this.clothing.put(set.getInt("id"), new ClothItem(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -573,7 +575,7 @@ public class CatalogManager {
return statement.executeUpdate() >= 1;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -672,13 +674,9 @@ public class CatalogManager {
page = this.getCatalogPage(pageId);
- if (page == null)
- return false;
-
page.getCatalogItems().put(item.getId(), item);
item.setPageId(pageId);
- item.setNeedsUpdate(true);
item.run();
return true;
@@ -701,7 +699,7 @@ public class CatalogManager {
if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) {
return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())];
} else {
- log.error("No rewards specified for rarity level {}", level);
+ LOGGER.error("No rewards specified for rarity level {}", level);
}
return null;
@@ -733,10 +731,10 @@ public class CatalogManager {
try {
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
} else {
- log.error("Unknown page layout: {}", page.getString("page_layout"));
+ LOGGER.error("Unknown page layout: {}", page.getString("page_layout"));
}
}
}
@@ -744,7 +742,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
if (catalogPage != null) {
@@ -803,7 +801,7 @@ public class CatalogManager {
}
}
- log.info("Catalog Manager -> Disposed!");
+ LOGGER.info("Catalog Manager -> Disposed!");
}
@@ -872,7 +870,7 @@ public class CatalogManager {
if (amount > 1 && !CatalogItem.haveOffer(item)) {
String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption());
ScripterManager.scripterDetected(habbo.getClient(), message);
- log.info(message);
+ LOGGER.info(message);
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
@@ -900,9 +898,7 @@ public class CatalogManager {
boolean badgeFound = false;
for (int i = 0; i < amount; i++) {
- if(item.isLimited()) {
- habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp());
- }
+ habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp());
for (Item baseItem : item.getBaseItems()) {
for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++) {
@@ -959,7 +955,7 @@ public class CatalogManager {
try {
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
}
@@ -1018,7 +1014,7 @@ public class CatalogManager {
try {
guildId = Integer.parseInt(extradata);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
@@ -1141,7 +1137,7 @@ public class CatalogManager {
}
} catch (Exception e) {
- log.error("Exception caught", e);
+ LOGGER.error("Exception caught", e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
}
} finally {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
index 96c46db..b161c20 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
@@ -7,14 +7,15 @@ import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
-@Slf4j
public abstract class CatalogPage implements Comparable, ISerialize {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPage.class);
protected final TIntArrayList offerIds = new TIntArrayList();
protected final THashMap childPages = new THashMap<>();
@@ -72,8 +73,8 @@ public abstract class CatalogPage implements Comparable, ISerialize
try {
this.included.add(Integer.valueOf(id));
} catch (Exception e) {
- log.error("Caught exception", e);
- log.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
+ LOGGER.error("Caught exception", e);
+ LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
index 18a23df..468e2a2 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
@@ -1,8 +1,8 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -11,8 +11,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-@Slf4j
public class Voucher {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Voucher.class);
public final int id;
public final String code;
@@ -46,7 +46,7 @@ public class Voucher {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -69,7 +69,7 @@ public class Voucher {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
index 06d2053..d283ada 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
@@ -14,13 +14,14 @@ import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.Map;
-@Slf4j
public class RoomBundleLayout extends SingleBundle {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleLayout.class);
public int roomId;
public Room room;
@@ -47,7 +48,7 @@ public class RoomBundleLayout extends SingleBundle {
if (this.room != null)
this.room.preventUnloading = true;
} else {
- log.error("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")");
+ LOGGER.error("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")");
}
}
@@ -189,7 +190,7 @@ public class RoomBundleLayout extends SingleBundle {
statement.setInt(3, this.room.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -223,7 +224,7 @@ public class RoomBundleLayout extends SingleBundle {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
index 610f038..f4d9aef 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
@@ -16,7 +16,9 @@ import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemCancelledEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemOfferedEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -25,8 +27,9 @@ import java.util.ArrayList;
import java.util.List;
-@Slf4j
public class MarketPlace {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class);
+
//Configuration. Loaded from database & updated accordingly.
public static boolean MARKETPLACE_ENABLED = true;
@@ -44,7 +47,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return offers;
@@ -102,7 +105,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false));
}
}
@@ -166,7 +169,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return offers;
@@ -196,7 +199,7 @@ public class MarketPlace {
message.appendInt(1);
message.appendInt(itemId);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -211,7 +214,7 @@ public class MarketPlace {
number = set.getInt("number");
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return number;
@@ -229,7 +232,7 @@ public class MarketPlace {
avg = set.getInt("avg");
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return calculateCommision(avg);
@@ -296,7 +299,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -323,7 +326,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -389,7 +392,7 @@ public class MarketPlace {
statement.setInt(2, offer.getOfferId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
index d242648..196544e 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
@@ -5,11 +5,14 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
-@Slf4j
public class MarketPlaceOffer implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlaceOffer.class);
+
public int avarage;
public int count;
private int offerId;
@@ -67,7 +70,7 @@ public class MarketPlaceOffer implements Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -87,7 +90,7 @@ public class MarketPlaceOffer implements Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -161,7 +164,7 @@ public class MarketPlaceOffer implements Runnable {
statement.setInt(3, this.offerId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
index cf58ac5..d590bb0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
@@ -3,14 +3,15 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.YoutubeManager;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-@Slf4j
public class AddYoutubePlaylistCommand extends Command {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AddYoutubePlaylistCommand.class);
public AddYoutubePlaylistCommand() {
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";"));
@@ -26,7 +27,7 @@ public class AddYoutubePlaylistCommand extends Command {
int itemId;
try {
- itemId = Integer.parseInt(params[1]);
+ itemId = Integer.valueOf(params[1]);
} catch (NumberFormatException e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
return true;
@@ -44,7 +45,7 @@ public class AddYoutubePlaylistCommand extends Command {
return true;
}
- Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(itemId, playlist);
+ Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(Integer.valueOf(params[1]), playlist);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO `youtube_playlists` (`item_id`, `playlist_id`) VALUES (?, ?)")) {
statement.setInt(1, itemId);
@@ -52,7 +53,7 @@ public class AddYoutubePlaylistCommand extends Command {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist"));
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
index e5a25e8..1328ed1 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
@@ -6,15 +6,16 @@ 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 lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class BadgeCommand extends Command {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BadgeCommand.class);
public BadgeCommand() {
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
@@ -75,7 +76,7 @@ public class BadgeCommand extends Command {
return true;
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
index 90751de..64dd09d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
@@ -16,16 +16,18 @@ import com.eu.habbo.plugin.events.users.UserCommandEvent;
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;
-@Slf4j
public class CommandHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class);
+
private final static THashMap commands = new THashMap<>(5);
private static final Comparator ALPHABETICAL_ORDER = new Comparator() {
public int compare(Command c1, Command c2) {
@@ -37,7 +39,7 @@ public class CommandHandler {
public CommandHandler() {
long millis = System.currentTimeMillis();
this.reloadCommands();
- log.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static void addCommand(Command command) {
@@ -46,8 +48,21 @@ public class CommandHandler {
commands.put(command.getClass().getName(), command);
}
+
+
+ public static void addCommand(Class extends Command> command) {
+ try {
+ //command.getConstructor().setAccessible(true);
+ addCommand(command.newInstance());
+ LOGGER.debug("Added command: {}", command.getName());
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+ }
+
+
public static boolean handleCommand(GameClient gameClient, String commandLine) {
- if (gameClient != null && commandLine != null) {
+ if (gameClient != null) {
if (commandLine.startsWith(":")) {
commandLine = commandLine.replaceFirst(":", "");
@@ -75,7 +90,7 @@ public class CommandHandler {
succes = event.succes;
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
@@ -279,7 +294,6 @@ public class CommandHandler {
addCommand(new AddYoutubePlaylistCommand());
addCommand(new SoftKickCommand());
addCommand(new SubscriptionCommand());
- addCommand(new PingCommand());
addCommand(new TestCommand());
}
@@ -306,6 +320,6 @@ public class CommandHandler {
public void dispose() {
commands.clear();
- log.info("Command Handler -> Disposed!");
+ LOGGER.info("Command Handler -> Disposed!");
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
index 43800a0..cf69a1d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
@@ -5,10 +5,11 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class EnableCommand extends Command {
+ private static final Logger LOGGER = LoggerFactory.getLogger(EnableCommand.class);
public EnableCommand() {
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";"));
@@ -42,7 +43,7 @@ public class EnableCommand extends Command {
}
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
index e1f1647..9e208a0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
@@ -4,13 +4,16 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.modtool.WordFilterWord;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-@Slf4j
public class FilterWordCommand extends Command {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FilterWordCommand.class);
+
public FilterWordCommand() {
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";"));
}
@@ -36,7 +39,7 @@ public class FilterWordCommand extends Command {
statement.setString(2, replacement);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
index 119b1ef..52a3d45 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
@@ -23,7 +23,7 @@ public class HotelAlertCommand extends Command {
message.append(params[i]).append(" ");
}
- ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n\r\nVan:" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
+ ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
index 7f40f52..e433735 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
@@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
-import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
@@ -19,16 +18,14 @@ public class InvisibleCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
- HabboInfo habboInfo = gameClient.getHabbo().getHabboInfo();
RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit();
- habboInfo.toggleInvisibility();
-
- if (!habboInfo.isInvisibleInRooms() && !roomUnit.isInRoom()) {
+ if (roomUnit.isInvisible()) {
RoomLayout roomLayout = roomUnit.getRoom().getLayout();
new RoomUnitTeleport(roomUnit, roomUnit.getRoom(), roomLayout.getDoorTile().x, roomLayout.getDoorTile().y, roomLayout.getDoorTile().z, 0).run();
+ roomUnit.setInvisible(false);
roomUnit.setInRoom(true);
roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose());
@@ -37,12 +34,13 @@ public class InvisibleCommand extends Command {
WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null);
roomUnit.getRoom().habboEntered(gameClient.getHabbo());
- gameClient.getHabbo().whisper("Je bent weer zichtbaar voor anderen.");
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated.back"));
return true;
}
- gameClient.getHabbo().whisper("Je bent nu onzichtbaar. Typ opnieuw :invisible om weer zichtbaar te zijn in kamers.");
+ roomUnit.setInvisible(true);
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated"));
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRemoveComposer(roomUnit).compose());
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java
index dadb88b..13d72c3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/MimicCommand.java
@@ -32,6 +32,9 @@ public class MimicCommand extends Command {
} else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.blocked").replace("%user%", params[1]).replace("%gender_name%", (habbo.getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), RoomChatMessageBubbles.ALERT);
return true;
+ } else if (!habbo.hasPermission("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT);
+ return true;
} else {
gameClient.getHabbo().getHabboInfo().setLook(ClothingValidationManager.VALIDATE_ON_MIMIC ? ClothingValidationManager.validateLook(gameClient.getHabbo(), habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getGender().name()) : habbo.getHabboInfo().getLook());
gameClient.getHabbo().getHabboInfo().setGender(habbo.getHabboInfo().getGender());
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/PingCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/PingCommand.java
deleted file mode 100644
index c76429e..0000000
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/PingCommand.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.eu.habbo.habbohotel.commands;
-
-import com.eu.habbo.habbohotel.LatencyTracker;
-import com.eu.habbo.habbohotel.gameclients.GameClient;
-
-public class PingCommand extends Command {
- public PingCommand() {
- super(null, new String[]{"ping"});
- }
-
- @Override
- public boolean handle(GameClient gameClient, String[] params) throws Exception {
- if (gameClient.getHabbo().getRoomUnit() == null) {
- return true;
- }
-
- final LatencyTracker latencyTracker = gameClient.getLatencyTracker();
-
- if (latencyTracker.hasInitialized()) {
- gameClient.getHabbo().whisper(String.format("Gemiddelde ping %dms, laatste ping %dms",
- latencyTracker.getAverageMs(),
- latencyTracker.getLastMs()));
- } else {
- gameClient.getHabbo().whisper("Ping-snelheid is nog niet berekend, probeer het over een minuut opnieuw.");
- }
-
- return true;
- }
-}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
index 346a1e3..3b3f516 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
@@ -7,12 +7,13 @@ import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts;
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
-@Slf4j
public class RoomBundleCommand extends Command {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleCommand.class);
public RoomBundleCommand() {
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";"));
@@ -65,7 +66,7 @@ public class RoomBundleCommand extends Command {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java
index ef4afe9..d6e9487 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StaffAlertCommand.java
@@ -19,7 +19,7 @@ public class StaffAlertCommand extends Command {
message.append(params[i]).append(" ");
}
- Emulator.getGameEnvironment().getHabboManager().staffAlert(message + "\r\n\r\nVan:" + gameClient.getHabbo().getHabboInfo().getUsername());
+ Emulator.getGameEnvironment().getHabboManager().staffAlert(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername());
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new FriendChatMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message.toString())).compose(), "acc_staff_chat", gameClient);
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffalert.forgot_message"), RoomChatMessageBubbles.ALERT);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
index ac87441..de6bde5 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
@@ -24,11 +24,6 @@ public class StalkCommand extends Command {
return true;
}
- if (habbo.getHabboInfo().isInvisibleInRooms()) {
- gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
- return true;
- }
-
if (habbo.getHabboInfo().getCurrentRoom() == null) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
index 9299a86..b4a3ca7 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
@@ -70,7 +70,7 @@ public class UserInfoCommand extends Command {
message.append(Emulator.getTexts().getValue("seasonal.name." + iterator.key())).append(": ").append(iterator.value()).append("\r");
}
- message.append("\r").append(onlineHabbo != null ? "" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + ((onlineHabbo.getHabboInfo().getCurrentRoom() != null && !onlineHabbo.getHabboInfo().isInvisibleInRooms()) ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().blockFriendRequests) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");
+ message.append("\r").append(onlineHabbo != null ? "" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().blockFriendRequests) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
index 079f31f..9fe611a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
@@ -4,14 +4,17 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class CraftingManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CraftingManager.class);
+
private final THashMap- altars;
public CraftingManager() {
@@ -53,14 +56,14 @@ public class CraftingManager {
recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount"));
altar.addIngredient(ingredientItem);
} else {
- log.error("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id"));
+ LOGGER.error("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id"));
}
}
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -114,7 +117,7 @@ public class CraftingManager {
}
statement.executeBatch();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.altars.clear();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
index ea122b4..a05ef0a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
@@ -2,36 +2,31 @@ package com.eu.habbo.habbohotel.gameclients;
import com.eu.habbo.Emulator;
import com.eu.habbo.crypto.HabboEncryption;
-import com.eu.habbo.habbohotel.LatencyTracker;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.MessageComposer;
import io.netty.channel.Channel;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
-@Slf4j
public class GameClient {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class);
+
private final Channel channel;
private final HabboEncryption encryption;
- private final LatencyTracker latencyTracker;
private Habbo habbo;
private boolean handshakeFinished;
private String machineId = "";
- private boolean finishedReleaseEvent = false;
-
- public void finishedReleaseEvent() {
- this.finishedReleaseEvent = true;
- }
-
- public boolean didFinishReleaseEvent() {
- return this.finishedReleaseEvent;
- }
-
public final ConcurrentHashMap incomingPacketCounter = new ConcurrentHashMap<>(25);
public final ConcurrentHashMap, Long> messageTimestamps = new ConcurrentHashMap<>();
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
@@ -44,7 +39,6 @@ public class GameClient {
Emulator.getCrypto().getModulus(),
Emulator.getCrypto().getPrivateExponent())
: null;
- this.latencyTracker = new LatencyTracker();
}
public Channel getChannel() {
@@ -55,10 +49,6 @@ public class GameClient {
return encryption;
}
- public LatencyTracker getLatencyTracker() {
- return latencyTracker;
- }
-
public Habbo getHabbo() {
return this.habbo;
}
@@ -129,7 +119,7 @@ public class GameClient {
this.habbo = null;
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/Game.java
index b0cb883..24a8051 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/Game.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/Game.java
@@ -20,11 +20,14 @@ import com.eu.habbo.plugin.events.games.GameStartedEvent;
import com.eu.habbo.plugin.events.games.GameStoppedEvent;
import com.eu.habbo.threading.runnables.SaveScoreForTeam;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Map;
import java.util.stream.Collectors;
-@Slf4j
+
public abstract class Game implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Game.class);
protected final THashMap teams = new THashMap<>();
protected final Room room;
private final Class extends GameTeam> gameTeamClazz;
@@ -72,7 +75,7 @@ public abstract class Game implements Runnable {
return true;
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return false;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
index fbd7995..c14f640 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
@@ -17,18 +17,26 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
-@Slf4j
public class BattleBanzaiGame extends Game {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BattleBanzaiGame.class);
+
public static final int effectId = 32;
+
+
public static final int POINTS_HIJACK_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.steal", 0);
+
+
public static final int POINTS_FILL_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.fill", 0);
+
+
public static final int POINTS_LOCK_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.lock", 1);
private static final ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(Emulator.getConfig().getInt("hotel.banzai.fill.threads", 2));
@@ -157,7 +165,7 @@ public class BattleBanzaiGame extends Game {
}
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
index ef8cb6d..642564d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
@@ -23,13 +23,17 @@ import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.HashMap;
import java.util.Map;
-@Slf4j
public class FreezeGame extends Game {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FreezeGame.class);
+
public static final int effectId = 39;
+
public static int POWER_UP_POINTS;
public static int POWER_UP_CHANCE;
public static int POWER_UP_PROTECT_TIME;
@@ -261,7 +265,7 @@ public class FreezeGame extends Game {
}
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
index e778c20..d77f677 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
@@ -1,14 +1,16 @@
package com.eu.habbo.habbohotel.guilds;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class Guild implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Guild.class);
public boolean needsUpdate;
public int lastRequested = Emulator.getIntUnixTimestamp();
private int id;
@@ -92,7 +94,7 @@ public class Guild implements Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -117,7 +119,7 @@ public class Guild implements Runnable {
this.needsUpdate = false;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
index 65c6903..2f84660 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
@@ -13,15 +13,21 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
-@Slf4j
public class GuildManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class);
+
private final THashMap> guildParts;
+
private final TIntObjectMap guilds;
+
private final THashSet views = new THashSet<>();
public GuildManager() {
@@ -32,7 +38,7 @@ public class GuildManager {
this.loadGuildParts();
this.loadGuildViews();
- log.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
@@ -50,7 +56,7 @@ public class GuildManager {
this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -64,7 +70,7 @@ public class GuildManager {
this.views.add(new ForumView(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -105,7 +111,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
habbo.getHabboStats().addGuild(guild.getId());
@@ -150,10 +156,10 @@ public class GuildManager {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
if (room != null) {
- room.setGuildId(0);
+ room.setGuild(0);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -274,7 +280,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -286,7 +292,7 @@ public class GuildManager {
statement.setInt(3, guild.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -301,7 +307,7 @@ public class GuildManager {
statement.setInt(3, guild.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -323,7 +329,7 @@ public class GuildManager {
statement.setInt(2, guild.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -350,7 +356,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return member;
@@ -373,7 +379,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return guildMembers;
@@ -395,7 +401,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return guildMembers;
@@ -414,7 +420,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return 0;
@@ -432,7 +438,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return guildAdmins;
@@ -464,7 +470,7 @@ public class GuildManager {
if (g != null)
g.loadMemberCount();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -492,7 +498,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return guilds;
@@ -512,7 +518,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return guilds;
@@ -591,7 +597,7 @@ public class GuildManager {
statement.setInt(2, furni.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -606,7 +612,7 @@ public class GuildManager {
guildIterator.remove();
}
- log.info("Guild Manager -> Disposed!");
+ LOGGER.info("Guild Manager -> Disposed!");
}
public boolean hasViewedForum(int userId, int guildId) {
@@ -626,7 +632,7 @@ public class GuildManager {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
index 444f34b..f4325c0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
@@ -9,12 +9,16 @@ import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
import java.util.*;
-@Slf4j
public class ForumThread implements Runnable, ISerialize {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ForumThread.class);
+
+
private final static THashMap> guildThreadsCache = new THashMap<>();
private final static THashMap forumThreadsCache = new THashMap<>();
private final int threadId;
@@ -70,7 +74,7 @@ public class ForumThread implements Runnable, ISerialize {
try {
this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id"));
} catch (SQLException e) {
- log.error("ForumThread last_comment_id exception", e);
+ LOGGER.error("ForumThread last_comment_id exception", e);
}
this.comments = new THashMap<>();
@@ -109,7 +113,7 @@ public class ForumThread implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return createdThread;
@@ -157,7 +161,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return threads;
@@ -196,7 +200,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return foundThread;
@@ -338,7 +342,7 @@ public class ForumThread implements Runnable, ISerialize {
addComment(comment);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -462,7 +466,7 @@ public class ForumThread implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
index 7819064..1be9631 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
@@ -8,11 +8,14 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
-@Slf4j
public class ForumThreadComment implements Runnable, ISerialize {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class);
+
private static THashMap forumCommentsCache = new THashMap<>();
private final int commentId;
private final int threadId;
@@ -64,7 +67,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return foundComment;
@@ -103,7 +106,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return createdComment;
@@ -200,7 +203,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
index a6d8cd1..a4c398b 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
@@ -2,22 +2,29 @@ package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-@Slf4j
public class HallOfFame {
+ private static final Logger LOGGER = LoggerFactory.getLogger(HallOfFame.class);
+
private final THashMap winners = new THashMap<>();
+
+
private String competitionName;
+
public HallOfFame() {
this.setCompetitionName("xmasRoomComp");
this.reload();
}
+
public void reload() {
this.winners.clear();
@@ -28,7 +35,7 @@ public class HallOfFame {
this.winners.put(winner.getId(), winner);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
index d8a03d8..998de6f 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
@@ -20,7 +20,7 @@ public class HallOfFameWinner implements Comparable {
this.id = set.getInt("id");
this.username = set.getString("username");
this.look = set.getString("look");
- this.points = set.getInt("achievement_score");
+ this.points = set.getInt("hof_points");
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
index d85eaf8..81048f3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
@@ -1,9 +1,12 @@
package com.eu.habbo.habbohotel.hotelview;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Slf4j
public class HotelViewManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class);
+
private final HallOfFame hallOfFame;
private final NewsList newsList;
@@ -12,7 +15,7 @@ public class HotelViewManager {
this.hallOfFame = new HallOfFame();
this.newsList = new NewsList();
- log.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
+ LOGGER.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public HallOfFame getHallOfFame() {
@@ -24,7 +27,7 @@ public class HotelViewManager {
}
public void dispose() {
- log.info("HotelView Manager -> Disposed!");
+ LOGGER.info("HotelView Manager -> Disposed!");
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
index 3eed86d..b3bebc4 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
@@ -1,15 +1,18 @@
package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
-@Slf4j
public class NewsList {
+ private static final Logger LOGGER = LoggerFactory.getLogger(NewsList.class);
+
private final ArrayList newsWidgets;
public NewsList() {
@@ -26,7 +29,7 @@ public class NewsList {
this.newsWidgets.add(new NewsWidget(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -35,4 +38,4 @@ public class NewsList {
public ArrayList getNewsWidgets() {
return this.newsWidgets;
}
-}
\ No newline at end of file
+}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
index af7cd65..6049779 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
@@ -1,15 +1,17 @@
package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
-@Slf4j
public class CrackableReward {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CrackableReward.class);
public final int itemId;
public final int count;
@@ -46,7 +48,7 @@ public class CrackableReward {
itemId = Integer.valueOf(prize.split(":")[0]);
chance = Integer.valueOf(prize.split(":")[1]);
} else if (prize.contains(":")) {
- log.error("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
+ LOGGER.error("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
} else {
itemId = Integer.valueOf(prize.replace(":", ""));
}
@@ -54,7 +56,7 @@ public class CrackableReward {
this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));
this.totalChance += chance;
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
index 344c066..16ec285 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
@@ -60,13 +60,17 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Constructor;
import java.sql.*;
import java.util.*;
-@Slf4j
public class ItemManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class);
+
//Configuration. Loaded from database & updated accordingly.
public static boolean RECYCLER_ENABLED = true;
@@ -101,7 +105,7 @@ public class ItemManager {
this.highscoreManager.load();
this.loadNewUserGifts();
- log.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
protected void loadItemInteractions() {
@@ -262,6 +266,7 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("wf_cnd_has_handitem", WiredConditionHabboHasHandItem.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_date_rng_active", WiredConditionDateRangeActive.class));
+
this.interactionsList.add(new ItemInteraction("wf_xtra_random", WiredExtraRandom.class));
this.interactionsList.add(new ItemInteraction("wf_xtra_unseen", WiredExtraUnseen.class));
this.interactionsList.add(new ItemInteraction("wf_blob", WiredBlob.class));
@@ -357,7 +362,7 @@ public class ItemManager {
return interaction;
}
- log.debug("Can't find interaction class: {}", type.getName());
+ LOGGER.debug("Can't find interaction class: {}", type.getName());
return this.getItemInteraction(InteractionDefault.class);
}
@@ -387,12 +392,12 @@ public class ItemManager {
else
this.items.get(id).update(set);
} catch (Exception e) {
- log.error("Failed to load Item ({})", set.getInt("id"));
- log.error("Caught exception", e);
+ LOGGER.error("Failed to load Item ({})", set.getInt("id"));
+ LOGGER.error("Caught exception", e);
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -405,16 +410,16 @@ public class ItemManager {
try {
reward = new CrackableReward(set);
} catch (Exception e) {
- log.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
- log.error("Caught exception", e);
+ LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
+ LOGGER.error("Caught exception", e);
continue;
}
this.crackableRewards.put(set.getInt("item_id"), reward);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -448,7 +453,7 @@ public class ItemManager {
this.soundTracks.put(set.getString("code"), new SoundTrack(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -481,16 +486,16 @@ public class ItemManager {
try {
return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
}
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return null;
}
@@ -505,7 +510,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -530,7 +535,7 @@ public class ItemManager {
statement.setInt(1, item.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -557,7 +562,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return item;
@@ -597,9 +602,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return item;
@@ -611,7 +616,7 @@ public class ItemManager {
statement.setInt(2, itemTwoId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -621,7 +626,7 @@ public class ItemManager {
statement.setInt(2, hopper.getBaseItem().getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -636,7 +641,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return a;
@@ -652,9 +657,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return item;
@@ -675,7 +680,7 @@ public class ItemManager {
return (HabboItem) c.newInstance(set, baseItem);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -699,7 +704,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -715,7 +720,7 @@ public class ItemManager {
return null;
if (extraData.length() > 1000) {
- log.error("Extradata exceeds maximum length of 1000 characters: {}", extraData);
+ LOGGER.error("Extradata exceeds maximum length of 1000 characters: {}", extraData);
extraData = extraData.substring(0, 1000);
}
@@ -770,8 +775,9 @@ public class ItemManager {
public void dispose() {
this.items.clear();
+ this.highscoreManager.dispose();
- log.info("Item Manager -> Disposed!");
+ LOGGER.info("Item Manager -> Disposed!");
}
public List getInteractionList() {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
index f046227..4822d78 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
@@ -13,25 +13,7 @@ public enum PostItColor {
PINK("FF9CFF"),
- YELLOW("FFFF33"),
-
-
- RED("FF9C9D"),
-
-
- ORANGE("FFCD9C"),
-
-
- PURPLE("C3B1E1"),
-
-
- LIGHTBLUE("DBDEFB"),
-
-
- WHITE("FFFFFF"),
-
-
- BLACK("282828");
+ YELLOW("FFFF33");
public final String hexColor;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
index ff3babe..bc9662a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
@@ -1,10 +1,13 @@
package com.eu.habbo.habbohotel.items;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Arrays;
-@Slf4j
public class RandomStateParams {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RandomStateParams.class);
+
private int states = -1;
private int delay = -1;
@@ -22,7 +25,7 @@ public class RandomStateParams {
this.delay = Integer.parseInt(keyValue[1]);
break;
default:
- log.warn("RandomStateParams: unknown key: " + keyValue[0]);
+ LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]);
break;
}
});
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
index 9ac2b61..a383541 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
@@ -6,7 +6,9 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.IOException;
@@ -20,8 +22,8 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-@Slf4j
public class YoutubeManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
public static class YoutubeVideo {
private final String id;
@@ -84,7 +86,7 @@ public class YoutubeManager {
Emulator.getThreading().run(() -> {
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
- log.info("YouTube Manager -> Loading...");
+ LOGGER.info("YouTube Manager -> Loading...");
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
try (ResultSet set = statement.executeQuery()) {
@@ -92,22 +94,26 @@ public class YoutubeManager {
final int itemId = set.getInt("item_id");
final String playlistId = set.getString("playlist_id");
-
youtubeDataLoaderPool.submit(() -> {
+ ArrayList playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
+
YoutubePlaylist playlist;
+
try {
playlist = this.getPlaylistDataById(playlistId);
if (playlist != null) {
- this.addPlaylistToItem(itemId, playlist);
+ playlists.add(playlist);
}
} catch (IOException e) {
- log.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
+ LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
}
+
+ this.playlists.put(itemId, playlists);
});
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
youtubeDataLoaderPool.shutdown();
@@ -116,7 +122,8 @@ public class YoutubeManager {
} catch (InterruptedException e) {
e.printStackTrace();
}
- log.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+
+ LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
});
}
@@ -133,7 +140,7 @@ public class YoutubeManager {
BufferedReader playlistBR = new BufferedReader(playlistISR);
JsonObject errorObj = JsonParser.parseReader(playlistBR).getAsJsonObject();
String message = errorObj.get("error").getAsJsonObject().get("message").getAsString();
- log.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, message);
+ LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, message);
return null;
}
InputStream playlistInputStream = playlistCon.getInputStream();
@@ -144,7 +151,7 @@ public class YoutubeManager {
JsonArray playlists = playlistData.get("items").getAsJsonArray();
if (playlists.size() == 0) {
- log.error("Playlist {} not found!", playlistId);
+ LOGGER.error("Playlist {} not found!", playlistId);
return null;
}
JsonObject playlistItem = playlists.get(0).getAsJsonObject().get("snippet").getAsJsonObject();
@@ -207,13 +214,12 @@ public class YoutubeManager {
} while (nextPageToken != null);
if (videos.isEmpty()) {
- log.warn("Playlist {} has no videos!", playlistId);
+ LOGGER.warn("Playlist {} has no videos!", playlistId);
return null;
}
playlist = new YoutubePlaylist(playlistId, name, description, videos);
this.playlistCache.put(playlistId, playlist);
- log.info("Loaded youtube playList into cache:" + playlistId);
return playlist;
@@ -225,6 +231,5 @@ public class YoutubeManager {
public void addPlaylistToItem(int itemId, YoutubePlaylist playlist) {
this.playlists.computeIfAbsent(itemId, k -> new ArrayList<>()).add(playlist);
- log.info("Loaded youtube playList into FurniID:" + itemId);
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
index d045698..133e83c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
@@ -3,12 +3,15 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class InteractionColorPlate extends InteractionDefault {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionColorPlate.class);
+
public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
}
@@ -41,7 +44,7 @@ public class InteractionColorPlate extends InteractionDefault {
try {
state = Integer.valueOf(this.getExtradata());
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
state += amount;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
index 150ae99..4860d0f 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
@@ -9,12 +9,15 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class InteractionDefault extends HabboItem {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionDefault.class);
+
public InteractionDefault(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
}
@@ -76,7 +79,7 @@ public class InteractionDefault extends HabboItem {
try {
currentState = Integer.valueOf(this.getExtradata());
} catch (NumberFormatException e) {
- log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
+ LOGGER.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
@@ -96,36 +99,33 @@ public class InteractionDefault extends HabboItem {
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
- Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo != null && habbo.getHabboInfo().getRiding() == null) {
super.onWalkOn(roomUnit, room, objects);
- if (roomUnit != null) {
- if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
- if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
- if (habbo != null) {
- if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
- room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
- log.error("newHabbos Effect Male");
- return;
- }
- if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
- room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
- log.error("newHabbos Effect Female");
- }
+ if (roomUnit != null) {
+ if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
+ if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
+ Habbo habbo = room.getHabbo(roomUnit);
+
+ if (habbo != null) {
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
+ room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
+ return;
}
- } else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
- Bot bot = room.getBot(roomUnit);
- if (bot != null) {
- if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) {
- room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM(), -1);
- return;
- }
- if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) {
- room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF(), -1);
- }
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
+ room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
+ }
+ }
+ } else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
+ Bot bot = room.getBot(roomUnit);
+
+ if (bot != null) {
+ if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) {
+ room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM(), -1);
+ return;
+ }
+ if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) {
+ room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF(), -1);
}
}
}
@@ -135,58 +135,54 @@ public class InteractionDefault extends HabboItem {
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
- Habbo habboride = room.getHabbo(roomUnit);
+ super.onWalkOff(roomUnit, room, objects);
- if (habboride != null && habboride.getHabboInfo().getRiding() == null) {
- super.onWalkOff(roomUnit, room, objects);
+ if (roomUnit != null) {
+ if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
+ int nextEffectM = 0;
+ int nextEffectF = 0;
- if (roomUnit != null) {
- if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
- int nextEffectM = 0;
- int nextEffectF = 0;
+ if (objects != null && objects.length == 2) {
+ if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
+ RoomTile goalTile = (RoomTile) objects[0];
+ HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y, (objects[0] != objects[1]) ? this : null);
- if (objects != null && objects.length == 2) {
- if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
- RoomTile goalTile = (RoomTile) objects[0];
- HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y, (objects[0] != objects[1]) ? this : null);
+ if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
+ return;
+ }
- if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
- return;
- }
-
- if (topItem != null) {
- nextEffectM = topItem.getBaseItem().getEffectM();
- nextEffectF = topItem.getBaseItem().getEffectF();
- }
+ if(topItem != null) {
+ nextEffectM = topItem.getBaseItem().getEffectM();
+ nextEffectF = topItem.getBaseItem().getEffectF();
}
}
+ }
- if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
- Habbo habbo = room.getHabbo(roomUnit);
+ if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
+ Habbo habbo = room.getHabbo(roomUnit);
- if (habbo != null) {
+ if (habbo != null) {
- if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
- room.giveEffect(habbo, nextEffectM, -1);
- return;
- }
-
- if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
- room.giveEffect(habbo, nextEffectF, -1);
- }
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
+ room.giveEffect(habbo, nextEffectM, -1);
+ return;
}
- } else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
- Bot bot = room.getBot(roomUnit);
- if (bot != null) {
- if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
- room.giveEffect(roomUnit, nextEffectM, -1);
- return;
- }
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
+ room.giveEffect(habbo, nextEffectF, -1);
+ }
+ }
+ } else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
+ Bot bot = room.getBot(roomUnit);
- if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
- room.giveEffect(roomUnit, nextEffectF, -1);
- }
+ if (bot != null) {
+ if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
+ room.giveEffect(roomUnit, nextEffectM, -1);
+ return;
+ }
+
+ if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
+ room.giveEffect(roomUnit, nextEffectF, -1);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
index af3f799..b2255e2 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
@@ -11,14 +11,18 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-@Slf4j
public class InteractionFireworks extends InteractionDefault {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionFireworks.class);
+
private static final String STATE_EMPTY = "0"; // Not used since the removal of pixels
private static final String STATE_CHARGED = "1";
private static final String STATE_EXPLOSION = "2";
@@ -125,7 +129,7 @@ public class InteractionFireworks extends InteractionDefault {
try {
explodeDuration = Integer.parseInt(this.getBaseItem().getCustomParams());
} catch (NumberFormatException e) {
- log.error("Incorrect customparams (" + this.getBaseItem().getCustomParams() + ") for base item ID (" + this.getBaseItem().getId() + ") of type (" + this.getBaseItem().getName() + ")");
+ LOGGER.error("Incorrect customparams (" + this.getBaseItem().getCustomParams() + ") for base item ID (" + this.getBaseItem().getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
index 5aa15da..41fb4dc 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
@@ -8,12 +8,15 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class InteractionGift extends HabboItem {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGift.class);
+
public boolean explode = false;
private int[] itemId;
private int colorId = 0;
@@ -29,7 +32,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
- log.warn("Incorrect extradata for gift with ID " + this.getId());
+ LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
}
}
@@ -39,7 +42,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
- log.warn("Incorrect extradata for gift with ID " + this.getId());
+ LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
index 5009359..f001fc2 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
@@ -5,13 +5,17 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class InteractionMusicDisc extends HabboItem {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionMusicDisc.class);
+
private int songId;
+
public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -21,7 +25,7 @@ public class InteractionMusicDisc extends HabboItem {
try {
this.songId = Integer.valueOf(stuff[6]);
} catch (Exception e) {
- log.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
+ LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
}
}
}
@@ -35,7 +39,7 @@ public class InteractionMusicDisc extends HabboItem {
try {
this.songId = Integer.valueOf(stuff[6]);
} catch (Exception e) {
- log.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
+ LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
index 4e18542..a63dcad 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
@@ -1,29 +1,34 @@
package com.eu.habbo.habbohotel.items.interactions;
-import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
+import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.HorsePet;
+import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
-import com.eu.habbo.threading.runnables.HabboItemNewState;
+import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Objects;
-public class InteractionObstacle extends HabboItem {
+public class InteractionObstacle extends HabboItem implements ICycleable {
+
+ private THashSet middleTiles;
public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
this.setExtradata("0");
+ this.middleTiles = new THashSet<>();
}
public InteractionObstacle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
this.setExtradata("0");
+ this.middleTiles = new THashSet<>();
}
@Override
@@ -51,79 +56,59 @@ public class InteractionObstacle extends HabboItem {
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
- final HorsePet horse = room.getHabboHorse(roomUnit);
+ /*Pet pet = room.getPet(roomUnit);
- if (horse == null) {
- return;
- }
+ if (pet instanceof HorsePet && ((HorsePet) pet).getRider() != null) {
+ if (pet.getTask() != null && pet.getTask().equals(PetTasks.RIDE)) {
+ if (pet.getRoomUnit().hasStatus(RoomUnitStatus.JUMP)) {
+ pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
+ Emulator.getThreading().run(new HabboItemNewState(this, room, "0"), 2000);
+ } else {
+ int state = 0;
+ for (int i = 0; i < 2; i++) {
+ state = Emulator.getRandom().nextInt(4) + 1;
- if (horse.getRoomUnit().hasStatus(RoomUnitStatus.JUMP)) {
- return;
- }
+ if (state == 4)
+ break;
+ }
- // Random state.
- int state = 0;
- for (int i = 0; i < 2; i++) {
- state = Emulator.getRandom().nextInt(4) + 1;
+ this.setExtradata(state + "");
+ pet.getRoomUnit().setStatus(RoomUnitStatus.JUMP, "0");
- if (state == 4)
- break;
- }
+ AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseConsecutiveJumpsCount"));
+ AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseJumping"));
+ }
- this.setExtradata(state + "");
-
- // Reset state.
- Emulator.getThreading().run(new HabboItemNewState(this, room, "0"), 2000);
-
- // Jump animation.
- roomUnit.removeStatus(RoomUnitStatus.MOVE);
- roomUnit.removeStatus(RoomUnitStatus.JUMP);
- roomUnit.statusUpdate(true);
-
- horse.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
- horse.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
- horse.getRoomUnit().setStatus(RoomUnitStatus.JUMP, "0");
- room.updateRoomUnit(horse.getRoomUnit());
-
- Emulator.getThreading().run(() -> {
- horse.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
- room.updateRoomUnit(horse.getRoomUnit());
- }, 1000);
-
- // Achievement.
- final Habbo habbo = horse.getRider();
-
- AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseConsecutiveJumpsCount"));
- AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseJumping"));
-
- room.updateItemState(this);
+ room.updateItemState(this);
+ }
+ }*/
}
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
- final HorsePet horse = room.getHabboHorse(roomUnit);
+ Habbo habbo = room.getHabbo(roomUnit);
- if (horse == null) {
- return;
- }
+ if (habbo == null) {
+ Pet pet = room.getPet(roomUnit);
- if (roomUnit.getBodyRotation().getValue() % 2 != 0) {
- return;
- }
-
- if (this.getRotation() == 2) {
- if (roomUnit.getBodyRotation() == RoomUserRotation.WEST) {
- roomUnit.setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() - 3), roomUnit.getY()));
- } else if (roomUnit.getBodyRotation() == RoomUserRotation.EAST) {
- roomUnit.setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() + 3), roomUnit.getY()));
- }
- } else if (this.getRotation() == 4) {
- if (roomUnit.getBodyRotation() == RoomUserRotation.NORTH) {
- roomUnit.setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() - 3)));
- } else if (roomUnit.getBodyRotation() == RoomUserRotation.SOUTH) {
- roomUnit.setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() + 3)));
+ if (pet instanceof HorsePet && ((HorsePet) pet).getRider() != null) {
+ if (roomUnit.getBodyRotation().getValue() % 2 == 0) {
+ if (this.getRotation() == 2) {
+ if (roomUnit.getBodyRotation().equals(RoomUserRotation.WEST)) {
+ ((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() - 3), roomUnit.getY()));
+ } else if (roomUnit.getBodyRotation().equals(RoomUserRotation.EAST)) {
+ ((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() + 3), roomUnit.getY()));
+ }
+ } else if (this.getRotation() == 4) {
+ if (roomUnit.getBodyRotation().equals(RoomUserRotation.NORTH)) {
+ ((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() - 3)));
+ } else if (roomUnit.getBodyRotation().equals(RoomUserRotation.SOUTH)) {
+ ((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() + 3)));
+ }
+ }
+ }
}
}
}
@@ -132,12 +117,80 @@ public class InteractionObstacle extends HabboItem {
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects);
- final HorsePet horse = room.getHabboHorse(roomUnit);
+ Habbo habbo = room.getHabbo(roomUnit);
- if (horse == null) {
- return;
+ if (habbo == null) {
+ Pet pet = room.getPet(roomUnit);
+
+ if (pet instanceof HorsePet && ((HorsePet) pet).getRider() != null) {
+ pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
+ }
+ }
+ }
+
+ @Override
+ public void onPlace(Room room) {
+ super.onPlace(room);
+ this.calculateMiddleTiles(room);
+ }
+
+ @Override
+ public void onPickUp(Room room) {
+ super.onPickUp(room);
+ middleTiles.clear();
+ }
+
+ @Override
+ public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
+ super.onMove(room, oldLocation, newLocation);
+ this.calculateMiddleTiles(room);
+ }
+
+ private void calculateMiddleTiles(Room room) {
+ middleTiles.clear();
+
+ if(this.getRotation() == 2) {
+ middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), this.getY()));
+ middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1)));
+ }
+ else if(this.getRotation() == 4) {
+ middleTiles.add(room.getLayout().getTile(this.getX(), (short)(this.getY() + 1)));
+ middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1)));
+ }
+ }
+
+ @Override
+ public RoomTileState getOverrideTileState(RoomTile tile, Room room) {
+ if(this.middleTiles.contains(tile))
+ return RoomTileState.BLOCKED;
+
+ return null;
+ }
+
+ @Override
+ public void cycle(Room room) {
+ if(this.middleTiles.size() == 0) {
+ this.calculateMiddleTiles(room);
}
- horse.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
+ for(RoomTile tile : this.middleTiles) {
+ for(RoomUnit unit : tile.getUnits()) {
+ if(unit.getPath().size() == 0 && !unit.hasStatus(RoomUnitStatus.MOVE)) {
+ if(unit.getBodyRotation().getValue() != this.getRotation() && Objects.requireNonNull(unit.getBodyRotation().getOpposite()).getValue() != this.getRotation())
+ continue;
+
+ RoomTile tileInfront = room.getLayout().getTileInFront(unit.getCurrentLocation(), unit.getBodyRotation().getValue());
+ if(tileInfront.state != RoomTileState.INVALID && tileInfront.state != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileInfront).size() == 0) {
+ unit.setGoalLocation(tileInfront);
+ }
+ else {
+ RoomTile tileBehind = room.getLayout().getTileInFront(unit.getCurrentLocation(), Objects.requireNonNull(unit.getBodyRotation().getOpposite()).getValue());
+ if(tileBehind.state != RoomTileState.INVALID && tileBehind.state != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileBehind).size() == 0) {
+ unit.setGoalLocation(tileBehind);
+ }
+ }
+ }
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
index b1c7ba9..48a4d35 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
@@ -12,15 +12,18 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer;
import com.eu.habbo.threading.runnables.ClearRentedSpace;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.awt.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class InteractionRentableSpace extends HabboItem {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionRentableSpace.class);
+
private int renterId;
private String renterName;
private int endTimestamp;
@@ -51,7 +54,7 @@ public class InteractionRentableSpace extends HabboItem {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
} else {
@@ -181,7 +184,7 @@ public class InteractionRentableSpace extends HabboItem {
statement.setInt(1, zero);
statement.setInt(2, zero);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java
index c2e7ea4..1048969 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java
@@ -16,7 +16,7 @@ import java.util.List;
public class InteractionRoller extends HabboItem {
public static boolean NO_RULES = false;
- public static final int DELAY = 400;
+ public static int DELAY = 400;
public InteractionRoller(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -52,7 +52,7 @@ public class InteractionRoller extends HabboItem {
}
@Override
- public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) {
+ public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
index 8a0f084..cf74069 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
@@ -24,9 +24,6 @@ public class InteractionTrap extends InteractionDefault {
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
if (!this.getExtradata().equals("0")) {
Habbo habbo = room.getHabbo(roomUnit);
- if(habbo == null) {
- return;
- }
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
roomUnit.stopWalking();
super.onWalkOn(roomUnit, room, objects);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
index 7aa6231..166768c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
@@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
+import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import gnu.trove.map.hash.TLongLongHashMap;
@@ -14,12 +16,11 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.HashMap;
public abstract class InteractionWired extends InteractionDefault {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
private long cooldown;
- private final HashMap userExecutionCache = new HashMap<>();
+ private TLongLongHashMap userExecutionCache = new TLongLongHashMap(3);
InteractionWired(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -75,10 +76,8 @@ public abstract class InteractionWired extends InteractionDefault {
}
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
- if (!room.isHideWired()) {
- this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
- room.sendComposer(new ItemStateComposer(this).compose());
- }
+ this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
+ room.sendComposer(new ItemStateComposer(this).compose());
if (roomUnit != null) {
this.addUserExecutionCache(roomUnit.getId(), millis);
}
@@ -113,7 +112,7 @@ public abstract class InteractionWired extends InteractionDefault {
} else {
if (this.userExecutionCache.containsKey((long)roomUnitId)) {
long lastTimestamp = this.userExecutionCache.get((long)roomUnitId);
- if (timestamp - lastTimestamp < Math.max(100L, this.requiredCooldown())) {
+ if (timestamp - lastTimestamp < 100L) {
return false;
}
}
@@ -129,4 +128,35 @@ public abstract class InteractionWired extends InteractionDefault {
public void addUserExecutionCache(int roomUnitId, long timestamp) {
this.userExecutionCache.put((long)roomUnitId, timestamp);
}
+
+ public static WiredSettings readSettings(ClientMessage packet, boolean isEffect)
+ {
+ int intParamCount = packet.readInt();
+ int[] intParams = new int[intParamCount];
+
+ for(int i = 0; i < intParamCount; i++)
+ {
+ intParams[i] = packet.readInt();
+ }
+
+ String stringParam = packet.readString();
+
+ int itemCount = packet.readInt();
+ int[] itemIds = new int[itemCount];
+
+ for(int i = 0; i < itemCount; i++)
+ {
+ itemIds[i] = packet.readInt();
+ }
+
+ WiredSettings settings = new WiredSettings(intParams, stringParam, itemIds, -1);
+
+ if(isEffect)
+ {
+ settings.setDelay(packet.readInt());
+ }
+
+ settings.setStuffTypeSelectionCode(packet.readInt());
+ return settings;
+ }
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
index 7bf21fe..ef63491 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
@@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
import java.sql.ResultSet;
@@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
public abstract WiredConditionType getType();
- public abstract boolean saveData(ClientMessage packet);
+ public abstract boolean saveData(WiredSettings settings);
public WiredConditionOperator operator() {
return WiredConditionOperator.AND;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
index 59da2b6..e58e365 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
@@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer;
@@ -43,7 +43,7 @@ public abstract class InteractionWiredEffect extends InteractionWired {
}
}
- public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException;
+ public abstract boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException;
public int getDelay() {
return this.delay;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
index 8bef931..6c8be89 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
@@ -13,16 +13,21 @@ import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreClearType;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreRow;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType;
import com.eu.habbo.messages.ServerMessage;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
-@Slf4j
public class InteractionWiredHighscore extends HabboItem {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWiredHighscore.class);
+
public WiredHighscoreScoreType scoreType;
public WiredHighscoreClearType clearType;
+
private List data;
+
public InteractionWiredHighscore(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -35,7 +40,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
this.reloadData();
@@ -53,7 +58,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
this.reloadData();
@@ -88,7 +93,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
if(client != null && !(objects.length >= 2 && objects[1] instanceof WiredEffectType)) {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
index c0bbaab..91fb8c0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@@ -44,7 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
public abstract WiredTriggerType getType();
- public abstract boolean saveData(ClientMessage packet);
+ public abstract boolean saveData(WiredSettings settings);
protected int getDelay() {
return this.delay;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
index da906a9..bb868c6 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
@@ -15,14 +15,18 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.games.GameTimer;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
-@Slf4j
public class InteractionGameTimer extends HabboItem implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGameTimer.class);
+
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
+
private int baseTime = 0;
private int timeNow = 0;
private boolean isRunning = false;
@@ -91,7 +95,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
}
}).toArray();
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -123,7 +127,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
room.addGame(game);
game.initialise();
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSuper.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSuper.java
deleted file mode 100644
index 46084d9..0000000
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSuper.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.eu.habbo.habbohotel.items.interactions.wired;
-
-import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.items.ItemManager;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredHighscore;
-import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.rooms.RoomUnit;
-import com.eu.habbo.habbohotel.users.Habbo;
-import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreDataEntry;
-import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager;
-import gnu.trove.set.hash.THashSet;
-
-import java.util.Collections;
-import java.util.List;
-
-// Mikee: Lazy, sorry.
-// Mikee: Yeah, duplicate code, sorry.
-public class WiredSuper {
-
- public static void addPoint(final RoomUnit roomUnit, final Room room, final int scoreToAdd) {
- final Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo == null) {
- return;
- }
-
- final ItemManager itemManager = Emulator.getGameEnvironment().getItemManager();
- final WiredHighscoreManager wiredHighscoreManager = itemManager.getHighscoreManager();
- final THashSet wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
- final List userIds = Collections.singletonList(habbo.getHabboInfo().getId());
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- final int itemId = highscore.getId();
- final WiredHighscoreDataEntry entry = new WiredHighscoreDataEntry(itemId, userIds, scoreToAdd, true, Emulator.getIntUnixTimestamp());
-
- wiredHighscoreManager.addOrUpdateHighscoreData(entry);
- }
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- highscore.reloadData();
-
- room.updateItem(highscore);
- }
- }
-
- public static void setPoint(final RoomUnit roomUnit, final Room room, final int scoreToAdd) {
- final Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo == null) {
- return;
- }
-
- final ItemManager itemManager = Emulator.getGameEnvironment().getItemManager();
- final WiredHighscoreManager wiredHighscoreManager = itemManager.getHighscoreManager();
- final THashSet wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
- final List userIds = Collections.singletonList(habbo.getHabboInfo().getId());
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- final int itemId = highscore.getId();
- final WiredHighscoreDataEntry entry = new WiredHighscoreDataEntry(itemId, userIds, scoreToAdd, true, Emulator.getIntUnixTimestamp());
-
- wiredHighscoreManager.setHighscoreData(entry);
- }
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- highscore.reloadData();
-
- room.updateItem(highscore);
- }
- }
-
- public static boolean noTotalClassement(RoomUnit roomUnit, Room room) {
- final Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo == null) {
- return false;
- }
-
- final ItemManager itemManager = Emulator.getGameEnvironment().getItemManager();
- final WiredHighscoreManager wiredHighscoreManager = itemManager.getHighscoreManager();
- final THashSet wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
- final List userIds = Collections.singletonList(habbo.getHabboInfo().getId());
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- final WiredHighscoreDataEntry entry = wiredHighscoreManager.getHighscoreRow(highscore.getId(), userIds);
-
- if (entry != null) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean totalPointEqual(RoomUnit roomUnit, Room room, int score) {
- final Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo == null) {
- return false;
- }
-
- final ItemManager itemManager = Emulator.getGameEnvironment().getItemManager();
- final WiredHighscoreManager wiredHighscoreManager = itemManager.getHighscoreManager();
- final THashSet wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
- final List userIds = Collections.singletonList(habbo.getHabboInfo().getId());
-
- for (final InteractionWiredHighscore highscore : wiredHighscores) {
- final WiredHighscoreDataEntry entry = wiredHighscoreManager.getHighscoreRow(highscore.getId(), userIds);
-
- if (entry != null && entry.getScore() == score) {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
index d4b9296..11f1276 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
@@ -3,12 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -50,10 +51,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.startDate = packet.readInt();
- this.endDate = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.startDate = settings.getIntParams()[0];
+ this.endDate = settings.getIntParams()[1];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
index ddce19a..22ec093 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -136,15 +137,12 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
- this.all = packet.readInt() == 1;
+ this.all = settings.getIntParams()[0] == 1;
- packet.readString();
-
- count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -153,7 +151,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
index a0d0708..6a2a70a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -24,8 +25,6 @@ import java.util.stream.Collectors;
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
-
- protected boolean all;
protected THashSet items;
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@@ -41,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
- this.all = false;
}
@Override
@@ -67,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
- this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@@ -79,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
- this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@@ -92,17 +88,14 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
- this.all = (data[0].equals("1"));
- if (data.length == 2) {
- String[] items = data[1].split(";");
+ String[] items = data[1].split(";");
- for (String s : items) {
- HabboItem item = room.getHabboItem(Integer.parseInt(s));
+ for (String s : items) {
+ HabboItem item = room.getHabboItem(Integer.parseInt(s));
- if (item != null)
- this.items.add(item);
- }
+ if (item != null)
+ this.items.add(item);
}
}
}
@@ -127,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
- message.appendInt(1);
- message.appendInt(this.all ? 1 : 0);
+ message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@@ -136,13 +128,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
- packet.readString();
-
- count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -151,7 +139,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
@@ -182,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
- boolean all;
List itemIds;
- public JsonData(boolean all, List itemIds) {
- this.all = all;
+ public JsonData(List itemIds) {
this.itemIds = itemIds;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
index 47c42d6..9330457 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -117,11 +118,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -130,7 +128,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
index cc01ba7..5d4133d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -69,7 +70,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
index d5e93e2..df8e210 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -86,11 +87,10 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.lowerLimit = packet.readInt();
- this.upperLimit = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.lowerLimit = settings.getIntParams()[0];
+ this.upperLimit = settings.getIntParams()[1];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
index 7e1580f..5f9f5b1 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -76,10 +77,9 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.effectId = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.effectId = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
index 0d351e9..d60dded 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -51,10 +52,9 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.handItem = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.handItem = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
index b4f0df9..8d2b3db 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -88,10 +89,8 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.badge = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.badge = settings.getStringParam();
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
index b40ee5e..f4db5bb 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -81,11 +82,9 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.cycles = packet.readInt();
-
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.cycles = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
index 76ece81..cd185da 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -69,28 +70,24 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
-
- this.state = packet.readInt() == 1;
- this.direction = packet.readInt() == 1;
- this.position = packet.readInt() == 1;
-
- packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 3) return false;
+ this.state = settings.getIntParams()[0] == 1;
+ this.direction = settings.getIntParams()[1] == 1;
+ this.position = settings.getIntParams()[2] == 1;
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return true;
- count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem item = room.getHabboItem(itemId);
if (item != null)
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
index 0be6ba1..83bd300 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -81,11 +82,9 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.cycles = packet.readInt();
-
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.cycles = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
index 279f61b..b09314c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -137,14 +138,11 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.all = settings.getIntParams()[0] == 1;
- this.all = packet.readInt() == 1;
-
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -153,7 +151,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
index 87f3bc9..9409ebe 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -24,8 +25,7 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
-
- protected boolean all;
+
protected THashSet items;
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@@ -41,7 +41,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
- this.all = false;
}
@Override
@@ -67,7 +66,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
- this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@@ -79,7 +77,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
- this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@@ -92,17 +89,13 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
- this.all = (data[0].equals("1"));
+ String[] items = data[1].split(";");
- if (data.length == 2) {
- String[] items = data[1].split(";");
+ for (String s : items) {
+ HabboItem item = room.getHabboItem(Integer.parseInt(s));
- for (String s : items) {
- HabboItem item = room.getHabboItem(Integer.parseInt(s));
-
- if (item != null)
- this.items.add(item);
- }
+ if (item != null)
+ this.items.add(item);
}
}
}
@@ -127,8 +120,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
- message.appendInt(1);
- message.appendInt(this.all ? 1 : 0);
+ message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@@ -136,12 +128,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -150,7 +138,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
@@ -181,11 +169,9 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
- boolean all;
List itemIds;
- public JsonData(boolean all, List itemIds) {
- this.all = all;
+ public JsonData(List itemIds) {
this.itemIds = itemIds;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
index 30c9ea5..595eee3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -117,11 +118,8 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -130,7 +128,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
index 3075c4f..7f1d6ca 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -85,11 +86,10 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.lowerLimit = packet.readInt();
- this.upperLimit = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.lowerLimit = settings.getIntParams()[0];
+ this.upperLimit = settings.getIntParams()[1];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
index ae1c20b..3f1a733 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@@ -76,10 +77,9 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.effectId = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.effectId = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
index 6df96d6..cf84c10 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -89,10 +90,8 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.badge = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.badge = settings.getStringParam();
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
index 520f28b..d7dbfbc 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -69,7 +70,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
index b805c7b..0f9d6c9 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -89,10 +90,9 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.teamColor = GameTeamColors.values()[packet.readInt()];
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
index 027db81..b8376c0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -91,10 +92,9 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.teamColor = GameTeamColors.values()[packet.readInt()];
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
index 61e3fd7..0afdf18 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -118,11 +119,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -131,7 +129,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) {
this.items.add(item);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
index f0a5b3f..24a2888 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
@@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import com.google.gson.Gson;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -49,11 +48,9 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String dataString = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String dataString = settings.getStringParam();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
index ee1b28b..b46d041 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
@@ -6,12 +6,12 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@@ -70,17 +70,18 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
+
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String botName = packet.readString().replace("\t", "");
+ String botName = settings.getStringParam().replace("\t", "");
botName = botName.substring(0, Math.min(botName.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
- packet.readInt();
- int delay = packet.readInt();
+
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
index 27fc788..5b380d3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
@@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -13,7 +14,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
@@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id");
- int itemId = packet.readInt();
+ int itemId = settings.getIntParams()[0];
if(itemId < 0)
itemId = 0;
- String botName = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ String botName = settings.getStringParam();
+
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
index 735b0f3..79fae2c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
@@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
@@ -52,15 +52,14 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String dataString = packet.readString();
+ String dataString = settings.getStringParam();
String splitBy = "\t";
if(!dataString.contains(splitBy))
@@ -71,8 +70,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length");
- packet.readInt();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
index 8fede69..ad0c876 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
@@ -6,13 +6,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@@ -73,15 +73,14 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode");
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String dataString = packet.readString();
+ String dataString = settings.getStringParam();
String splitBy = "\t";
if(!dataString.contains(splitBy))
throw new WiredSaveException("Malformed data string");
@@ -91,8 +90,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length");
- packet.readInt();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
index 07bbac6..822934a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@@ -114,10 +115,9 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String botName = packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String botName = settings.getStringParam();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
index 73906c8..b4b9d26 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -67,10 +68,9 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String botName = packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String botName = settings.getStringParam();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
index 0ce892d..7ee3859 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.*;
@@ -210,9 +211,10 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int startDirectionInt = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
+
+ int startDirectionInt = settings.getIntParams()[0];
if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) {
throw new WiredSaveException("Start direction is invalid");
@@ -220,15 +222,13 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
- int blockedActionInt = packet.readInt();
+ int blockedActionInt = settings.getIntParams()[1];
if(blockedActionInt < 0 || blockedActionInt > 6) {
throw new WiredSaveException("Blocked action is invalid");
}
- packet.readString();
-
- int itemsCount = packet.readInt();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
THashMap newItems = new THashMap<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
newItems.put(it, new WiredChangeDirectionSetting(it.getId(), it.getRotation(), startDirection));
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
index 4d21822..6dafe83 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -67,17 +68,14 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.amount = Integer.parseInt(packet.readString());
+ this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
index 0bd6216..d228c75 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -66,16 +67,14 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.amount = Integer.valueOf(packet.readString());
+ this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
index 4a3b966..91b7846 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
@@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -67,17 +68,14 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.respects = Integer.valueOf(packet.readString());
+ this.respects = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
index f4c3a2b..3c8fb88 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@@ -15,6 +16,7 @@ import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
@@ -174,16 +176,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
- int argsLength = packet.readInt();
- this.rewardTime = packet.readInt();
- this.uniqueRewards = packet.readInt() == 1;
- this.limit = packet.readInt();
- this.limitationInterval = packet.readInt();
+ if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data");
+ this.rewardTime = settings.getIntParams()[0];
+ this.uniqueRewards = settings.getIntParams()[1] == 1;
+ this.limit = settings.getIntParams()[2];
+ this.limitationInterval = settings.getIntParams()[3];
this.given = 0;
- String data = packet.readString();
+ String data = settings.getStringParam();
String[] items = data.split(";");
@@ -204,8 +206,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
WiredHandler.dropRewards(this.getId());
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
index 6632c2e..293515c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
@@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -172,23 +173,20 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
- int score = packet.readInt();
+ int score = settings.getIntParams()[0];
if(score < 1 || score > 100)
throw new WiredSaveException("Score is invalid");
- int timesPerGame = packet.readInt();
+ int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid");
- packet.readString();
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
index dcbc148..a439a66 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
@@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@@ -121,28 +122,25 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
- int points = packet.readInt();
+ int points = settings.getIntParams()[0];
if(points < 1 || points > 100)
throw new WiredSaveException("Points is invalid");
- int timesPerGame = packet.readInt();
+ int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid");
- int team = packet.readInt();
+ int team = settings.getIntParams()[2];
if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid");
- packet.readString();
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
index 8d36700..28bd7c4 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
@@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -134,16 +135,15 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int team = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
+
+ int team = settings.getIntParams()[0];
if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid");
- packet.readInt();
- packet.readString();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
index e0f2ecd..a75f2e3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
@@ -148,11 +149,9 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String message = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String message = settings.getStringParam();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
index deff061..74830cf 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
@@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -116,11 +117,8 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
index bb615d8..8d74e31 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -175,21 +176,18 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- boolean setState = packet.readInt() == 1;
- boolean setDirection = packet.readInt() == 1;
- boolean setPosition = packet.readInt() == 1;
-
- packet.readString();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
+ boolean setState = settings.getIntParams()[0] == 1;
+ boolean setDirection = settings.getIntParams()[1] == 1;
+ boolean setPosition = settings.getIntParams()[2] == 1;
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
throw new WiredSaveException("Trying to save wired in unloaded room");
- int itemsCount = packet.readInt();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -198,7 +196,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
List newSettings = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -207,7 +205,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
newSettings.add(new WiredMatchFurniSetting(it.getId(), this.checkForWiredResetPermission && it.allowWiredResetState() ? it.getExtradata() : " ", it.getRotation(), it.getX(), it.getY()));
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
index 76fe1ed..9f016a9 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -178,10 +179,8 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -190,7 +189,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -199,7 +198,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
index 3b9367e..4118fd0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -12,6 +13,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
@@ -39,7 +41,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
@@ -48,18 +50,16 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
this.items.clear();
this.indexOffset.clear();
- packet.readInt();
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
+ this.direction = settings.getIntParams()[0];
+ this.spacing = settings.getIntParams()[1];
- this.direction = packet.readInt();
- this.spacing = packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
index c069dc9..89f56d3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -314,11 +315,8 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -327,7 +325,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -336,7 +334,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
index 5928e67..fd24af0 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
@@ -5,12 +5,14 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
@@ -185,28 +187,26 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return false;
- packet.readInt();
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
- this.direction = packet.readInt();
- this.rotation = packet.readInt();
+ this.direction = settings.getIntParams()[0];
+ this.rotation = settings.getIntParams()[1];
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
index 3978801..ed3639a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@@ -13,6 +14,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import java.sql.ResultSet;
@@ -49,12 +51,13 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
- this.length = packet.readInt();
- this.message = packet.readString();
- packet.readInt();
- this.setDelay(packet.readInt());
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
+
+ this.length = settings.getIntParams()[0];
+ this.message = settings.getStringParam();
+
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
index 583e4f6..826b8d3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@@ -67,13 +68,8 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
- packet.readString();
- packet.readInt();
- this.delay = packet.readInt();
- this.setDelay(this.delay);
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
index 304703f..cf6197a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@@ -130,11 +131,8 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -143,7 +141,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -152,7 +150,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
index d3d5ab6..7a3a0e1 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
@@ -6,7 +6,9 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard;
+import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
+import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiPuck;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTeleporter;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
@@ -15,6 +17,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -33,7 +36,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArraySet;
import java.util.stream.Collectors;
public class WiredEffectToggleFurni extends InteractionWiredEffect {
@@ -41,7 +43,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
public static final WiredEffectType type = WiredEffectType.TOGGLE_STATE;
- private final CopyOnWriteArraySet items;
+ private final THashSet items;
private static final List> FORBIDDEN_TYPES = new ArrayList>() {
{
@@ -85,12 +87,12 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
public WiredEffectToggleFurni(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
- this.items = new CopyOnWriteArraySet<>();
+ this.items = new THashSet<>();
}
public WiredEffectToggleFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
- this.items = new CopyOnWriteArraySet<>();
+ this.items = new THashSet<>();
}
@Override
@@ -141,11 +143,8 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -154,7 +153,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -163,7 +162,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
index 4fbd920..d5e6092 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
@@ -15,6 +15,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -137,11 +138,8 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -150,7 +148,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -159,7 +157,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
index db37872..4f50f57 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -85,11 +86,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -98,7 +96,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -107,7 +105,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
index 56d6f35..79a7ba5 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
@@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
-import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
@@ -70,19 +69,15 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- String message = packet.readString();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String message = settings.getStringParam();
if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
message = Emulator.getGameEnvironment().getWordFilter().filter(message, null);
message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
}
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
index ebdef5f..8f859fd 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
@@ -10,13 +10,14 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class WiredBlob extends InteractionDefault {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WiredBlob.class);
enum WiredBlobState {
ACTIVE("0"),
@@ -105,14 +106,14 @@ public class WiredBlob extends InteractionDefault {
String[] params = this.getBaseItem().getCustomParams().split(",");
if (params.length != 2) {
- log.error("Wired blobs should have customparams with two parameters (points,resetsWithGame)");
+ LOGGER.error("Wired blobs should have customparams with two parameters (points,resetsWithGame)");
return;
}
try {
this.POINTS_REWARD = Integer.parseInt(params[0]);
} catch (NumberFormatException e) {
- log.error("Wired blobs should have customparams with the first parameter being the amount of points (number)");
+ LOGGER.error("Wired blobs should have customparams with the first parameter being the amount of points (number)");
return;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
index f636464..6075672 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -110,9 +111,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.executeTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.executeTime = settings.getIntParams()[0] * 500;
this.resetTimer();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
index 751d21c..7fdf0a2 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -109,10 +110,9 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.executeTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.executeTime = settings.getIntParams()[0] * 500;
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
index 596fbc8..3de2e34 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -97,17 +98,15 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.botName = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.botName = settings.getStringParam();
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
index 0e7b22f..0023fb6 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
@@ -48,10 +49,8 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.botName = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.botName = settings.getStringParam();
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
index 4e44660..a40bf2e 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -65,7 +66,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
index f97f332..5d315e5 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -135,16 +136,13 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
index abb8417..55ff097 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@@ -83,7 +84,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
index 5631cb4..89c9a65 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@@ -83,7 +84,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
index 9a1400b..d93a1ba 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -85,9 +86,8 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.username = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.username = settings.getStringParam();
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
index f3b90ae..d0bdd63 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -93,10 +94,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.ownerOnly = packet.readInt() == 1;
- this.key = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.ownerOnly = settings.getIntParams()[0] == 1;
+ this.key = settings.getStringParam();
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
index 64e9dae..10b458b 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -128,16 +129,13 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
index 257f23b..d24be48 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -82,16 +83,13 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
index e7ad614..f43ffac 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -109,10 +110,9 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.repeatTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.repeatTime = settings.getIntParams()[0] * 500;
this.counter = 0;
if (this.repeatTime < 500) {
@@ -125,16 +125,10 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
@Override
public void cycle(Room room) {
this.counter += 500;
- long currentMillis = System.currentTimeMillis();
- String Key = Double.toString(this.getX()) + Double.toString(this.getY());
-
- room.repeatersLastTick.putIfAbsent(Key, currentMillis);
-
- if (this.counter >= this.repeatTime && room.repeatersLastTick.get(Key) < currentMillis - 450) {
+ if (this.counter >= this.repeatTime) {
this.counter = 0;
if (this.getRoomId() != 0) {
if (room.isLoaded()) {
- room.repeatersLastTick.put(Key, currentMillis);
WiredHandler.handle(this, null, room, new Object[]{this});
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
index 1480122..536aca8 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -107,10 +108,9 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.repeatTime = packet.readInt() * 5000;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.repeatTime = settings.getIntParams()[0] * 5000;
this.counter = 0;
return true;
}
@@ -119,16 +119,10 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
@Override
public void cycle(Room room) {
this.counter += 500;
- long currentMillis = System.currentTimeMillis();
- String Key = Double.toString(this.getX()) + Double.toString(this.getY());
-
- room.repeatersLastTick.putIfAbsent(Key, currentMillis);
-
- if (this.counter >= this.repeatTime && room.repeatersLastTick.get(Key) < currentMillis - 4950) {
+ if (this.counter >= this.repeatTime) {
this.counter = 0;
if (this.getRoomId() != 0) {
if (room.isLoaded()) {
- room.repeatersLastTick.put(Key, currentMillis);
WiredHandler.handle(this, null, room, new Object[]{this});
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
index 1f558d8..463e5ba 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
@@ -85,9 +86,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.score = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.score = settings.getIntParams()[0];
return true;
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java
index 5008963..a081bfc 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Message.java
@@ -1,13 +1,16 @@
package com.eu.habbo.habbohotel.messenger;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-@Slf4j
public class Message implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Message.class);
+
private final int fromId;
private final int toId;
private final int timestamp;
@@ -32,7 +35,7 @@ public class Message implements Runnable {
statement.setInt(4, this.timestamp);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
index a297ffa..fa4603c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
@@ -11,7 +11,9 @@ import com.eu.habbo.plugin.events.users.friends.UserAcceptFriendRequestEvent;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.StringUtils;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -19,8 +21,10 @@ import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-@Slf4j
public class Messenger {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Messenger.class);
+
//Configuration. Loaded from database & updated accordingly.
public static boolean SAVE_PRIVATE_CHATS = false;
public static int MAXIMUM_FRIENDS = 200;
@@ -42,7 +46,7 @@ public class Messenger {
statement.setInt(4, userOne);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -56,7 +60,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return users;
}
@@ -91,7 +95,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -108,7 +112,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -120,7 +124,7 @@ public class Messenger {
statement.setInt(2, userFrom);
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -139,7 +143,7 @@ public class Messenger {
count = set.getInt("count");
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return count;
@@ -163,7 +167,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return map;
}
@@ -213,7 +217,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -237,7 +241,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return buddy;
@@ -252,7 +256,7 @@ public class Messenger {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -311,7 +315,7 @@ public class Messenger {
statement.setInt(1, userTo);
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -323,7 +327,7 @@ public class Messenger {
statement.setInt(3, userFrom);
return statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return 0;
@@ -345,7 +349,7 @@ public class Messenger {
statement.setInt(3, Emulator.getIntUnixTimestamp());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
Habbo habboTo = Emulator.getGameServer().getGameClientManager().getHabbo(userTo);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java
index 9447e8e..d879d00 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/messenger/MessengerBuddy.java
@@ -7,14 +7,17 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class MessengerBuddy implements Runnable, ISerialize {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MessengerBuddy.class);
+
private int id;
private String username;
private HabboGender gender = HabboGender.M;
@@ -46,7 +49,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -59,7 +62,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
this.userOne = 0;
this.online = set.getInt("online");
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -154,7 +157,7 @@ public class MessengerBuddy implements Runnable, ISerialize {
statement.setInt(3, this.id);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java
index 26be296..3c8517d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolBan.java
@@ -1,15 +1,18 @@
package com.eu.habbo.habbohotel.modtool;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
-@Slf4j
public class ModToolBan implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModToolBan.class);
+
public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public int userId;
public String ip;
@@ -64,7 +67,7 @@ public class ModToolBan implements Runnable {
statement.setInt(9, this.cfhTopic);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java
index 73764c0..3b8e5b3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java
@@ -21,15 +21,18 @@ import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import io.netty.channel.Channel;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.net.InetSocketAddress;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-@Slf4j
public class ModToolManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModToolManager.class);
+
private final TIntObjectMap category;
private final THashMap> presets;
private final THashMap tickets;
@@ -42,7 +45,7 @@ public class ModToolManager {
this.tickets = new THashMap<>();
this.cfhCategories = new TIntObjectHashMap<>();
this.loadModTool();
- log.info("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static void requestUserInfo(GameClient client, ClientMessage packet) {
@@ -59,9 +62,9 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -79,7 +82,7 @@ public class ModToolManager {
this.loadTickets(connection);
this.loadCfhCategories(connection);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -98,7 +101,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -109,7 +112,7 @@ public class ModToolManager {
this.presets.get(set.getString("type")).add(set.getString("preset"));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -121,7 +124,7 @@ public class ModToolManager {
this.tickets.put(set.getInt("id"), new ModToolIssue(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -147,7 +150,7 @@ public class ModToolManager {
this.cfhCategories.get(set.getInt("support_cfh_category_id")).addTopic(new CfhTopic(set, this.getIssuePreset(set.getInt("default_sanction"))));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -197,7 +200,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return chatlogs;
@@ -214,7 +217,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return chatlogs;
@@ -234,7 +237,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return chatLogs;
@@ -271,7 +274,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return chatlogs;
@@ -289,7 +292,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return roomVisits;
@@ -347,7 +350,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return roomVisits;
@@ -377,7 +380,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return null;
@@ -504,7 +507,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return ban;
@@ -533,7 +536,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return banned;
}
@@ -556,7 +559,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -570,7 +573,7 @@ public class ModToolManager {
statement.execute();
return statement.getUpdateCount() > 0;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
@@ -675,7 +678,7 @@ public class ModToolManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return total;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java
index bbe58af..3960d07 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolSanctions.java
@@ -4,7 +4,9 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.plugin.events.sanctions.SanctionEvent;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -12,8 +14,9 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
-@Slf4j
public class ModToolSanctions {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModToolSanctions.class);
+
private final THashMap> sanctionHashmap;
private final THashMap sanctionLevelsHashmap;
@@ -23,7 +26,7 @@ public class ModToolSanctions {
this.sanctionLevelsHashmap = new THashMap<>();
this.loadModSanctions();
- log.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public synchronized void loadModSanctions() {
@@ -41,7 +44,7 @@ public class ModToolSanctions {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -68,7 +71,7 @@ public class ModToolSanctions {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return this.sanctionHashmap;
@@ -87,7 +90,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -98,7 +101,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -109,7 +112,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -120,7 +123,7 @@ public class ModToolSanctions {
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java
index 66248c5..791d12d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java
@@ -9,8 +9,8 @@ import com.eu.habbo.plugin.events.users.UserTriggerWordFilterEvent;
import gnu.trove.iterator.hash.TObjectHashIterator;
import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.ResultSet;
@@ -19,8 +19,8 @@ import java.sql.Statement;
import java.text.Normalizer;
import java.util.regex.Pattern;
-@Slf4j
public class WordFilter {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WordFilter.class);
private static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+");
//Configuration. Loaded from database & updated accordingly.
@@ -33,7 +33,7 @@ public class WordFilter {
public WordFilter() {
long start = System.currentTimeMillis();
this.reload();
- log.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)");
+ LOGGER.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)");
}
private static String stripDiacritics(String str) {
@@ -58,7 +58,7 @@ public class WordFilter {
try {
word = new WordFilterWord(set);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
continue;
}
@@ -71,7 +71,7 @@ public class WordFilter {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -150,7 +150,7 @@ public class WordFilter {
if (Emulator.getPluginManager().fireEvent(new UserTriggerWordFilterEvent(habbo, word)).isCancelled())
continue;
}
- filteredMessage = filteredMessage.replaceAll("(?i)" + Pattern.quote(word.key), word.replacement);
+ filteredMessage = filteredMessage.replace("(?i)" + word.key, word.replacement);
foundShit = true;
if (habbo != null && word.muteTime > 0) {
@@ -184,7 +184,7 @@ public class WordFilter {
continue;
}
- message = message.replaceAll("(?i)" + Pattern.quote(word.key), word.replacement);
+ message = message.replace(word.key, word.replacement);
roomChatMessage.filtered = true;
}
}
@@ -194,10 +194,6 @@ public class WordFilter {
}
}
- public THashSet getWords() {
- return new THashSet<>(this.words);
- }
-
public void addWord(WordFilterWord word) {
this.words.add(word);
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
index df9304e..5c16598 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
@@ -4,7 +4,9 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.ResultSet;
@@ -16,8 +18,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-@Slf4j
public class NavigatorManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NavigatorManager.class);
+
public static int MAXIMUM_RESULTS_PER_PAGE = 10;
public static boolean CATEGORY_SORT_USING_ORDER_NUM = false;
@@ -34,7 +38,7 @@ public class NavigatorManager {
this.filters.put(NavigatorUserFilter.name, new NavigatorUserFilter());
this.filters.put(NavigatorFavoriteFilter.name, new NavigatorFavoriteFilter());
- log.info("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void loadNavigator() {
@@ -47,7 +51,7 @@ public class NavigatorManager {
this.publicCategories.put(set.getInt("id"), new NavigatorPublicCategory(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM navigator_publics WHERE visible = '1'")) {
@@ -60,12 +64,12 @@ public class NavigatorManager {
if (room != null) {
category.addRoom(room);
} else {
- log.error("Public room (ID: {} defined in navigator_publics does not exist!", set.getInt("room_id"));
+ LOGGER.error("Public room (ID: {} defined in navigator_publics does not exist!", set.getInt("room_id"));
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -81,7 +85,7 @@ public class NavigatorManager {
field = clazz.getDeclaredMethod(s);
clazz = field.getReturnType();
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
}
@@ -89,7 +93,7 @@ public class NavigatorManager {
try {
field = clazz.getDeclaredMethod(set.getString("field"));
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
continue;
}
}
@@ -99,11 +103,11 @@ public class NavigatorManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
List staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
index ceac7fd..957b329 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
@@ -6,14 +6,17 @@ import com.eu.habbo.plugin.HabboPlugin;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-@Slf4j
public class PermissionsManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PermissionsManager.class);
+
private final TIntObjectHashMap ranks;
private final TIntIntHashMap enables;
private final THashMap> badges;
@@ -26,7 +29,7 @@ public class PermissionsManager {
this.reload();
- log.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void reload() {
@@ -57,7 +60,7 @@ public class PermissionsManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -70,7 +73,7 @@ public class PermissionsManager {
this.enables.put(set.getInt("effect_id"), set.getInt("min_rank"));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java
index 3b520aa..b488f96 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/GnomePet.java
@@ -4,14 +4,17 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class GnomePet extends Pet implements IPetLook {
+ private static final Logger LOGGER = LoggerFactory.getLogger(GnomePet.class);
+
private final String gnomeData;
public GnomePet(ResultSet set) throws SQLException {
@@ -48,7 +51,7 @@ public class GnomePet extends Pet implements IPetLook {
statement.setInt(2, this.id);
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java
index 26094ad..666fa8d 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/HorsePet.java
@@ -1,14 +1,17 @@
package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class HorsePet extends RideablePet {
+ private static final Logger LOGGER = LoggerFactory.getLogger(HorsePet.class);
+
private int hairColor;
private int hairStyle;
@@ -41,7 +44,7 @@ public class HorsePet extends RideablePet {
statement.setInt(6, super.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
super.run();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java
index 1828ecd..c362cf5 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java
@@ -13,7 +13,9 @@ import com.eu.habbo.messages.outgoing.rooms.pets.PetStatusUpdateComposer;
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetRespectComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import org.apache.commons.math3.util.Pair;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -22,8 +24,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
-@Slf4j
public class MonsterplantPet extends Pet implements IPetLook {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonsterplantPet.class);
+
public static final Map> bodyRarity = new LinkedHashMap>() {
{
this.put(1, new Pair<>("Blungon", 0));
@@ -139,7 +142,7 @@ public class MonsterplantPet extends Pet implements IPetLook {
statement.setInt(13, this.id);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java
index 6f9b976..afd7e03 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java
@@ -14,14 +14,17 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer;
import com.eu.habbo.plugin.events.pets.PetTalkEvent;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
import java.util.Calendar;
import java.util.Map;
import java.util.TimeZone;
-@Slf4j
public class Pet implements ISerialize, Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Pet.class);
+
public int levelThirst;
public int levelHunger;
public boolean needsUpdate = false;
@@ -62,7 +65,7 @@ public class Pet implements ISerialize, Runnable {
this.name = set.getString("name");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type"));
if (this.petData == null) {
- log.error("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!");
+ LOGGER.error("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(0);
}
this.race = set.getInt("race");
@@ -85,7 +88,7 @@ public class Pet implements ISerialize, Runnable {
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type);
if (this.petData == null) {
- log.warn("Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!");
+ LOGGER.warn("Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!");
}
this.race = race;
@@ -205,7 +208,7 @@ public class Pet implements ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.needsUpdate = false;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java
index 109d7ce..8294707 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java
@@ -19,15 +19,17 @@ import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.set.hash.THashSet;
import org.apache.commons.math3.distribution.NormalDistribution;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
-@Slf4j
public class PetManager {
public static int MAXIMUM_PET_INVENTORY_SIZE = 25;
+ private static final Logger LOGGER = LoggerFactory.getLogger(PetManager.class);
public static final int[] experiences = new int[]{100, 200, 400, 600, 900, 1300, 1800, 2400, 3200, 4300, 5700, 7600, 10100, 13300, 17500, 23000, 30200, 39600, 51900};
static int[] skins = new int[]{0, 1, 6, 7};
public final THashMap petActions = new THashMap() {
@@ -81,7 +83,7 @@ public class PetManager {
reloadPetData();
- log.info("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public static int getLevel(int experience) {
@@ -152,8 +154,8 @@ public class PetManager {
this.loadPetCommands(connection);
this.loadPetBreeding(connection);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
- log.error("Pet Manager -> Failed to load!");
+ LOGGER.error("Caught SQL exception", e);
+ LOGGER.error("Pet Manager -> Failed to load!");
}
}
@@ -168,7 +170,7 @@ public class PetManager {
this.petRaces.get(set.getInt("race")).add(new PetRace(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -178,7 +180,7 @@ public class PetManager {
this.petData.put(set.getInt("pet_type"), new PetData(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.loadPetItems(connection);
@@ -218,7 +220,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -232,10 +234,10 @@ public class PetManager {
if (petVocalsType != null) {
this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message")));
} else {
- log.error("Unknown pet vocal type " + set.getString("type"));
+ LOGGER.error("Unknown pet vocal type " + set.getString("type"));
}
} else {
- log.error("Missing pet_actions table entry for pet id " + set.getInt("pet_id"));
+ LOGGER.error("Missing pet_actions table entry for pet id " + set.getInt("pet_id"));
}
} else {
if (!PetData.generalPetVocals.containsKey(PetVocalsType.valueOf(set.getString("type").toUpperCase())))
@@ -245,7 +247,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -256,7 +258,7 @@ public class PetManager {
commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id"))));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_commands ORDER BY pet_id ASC")) {
@@ -268,7 +270,7 @@ public class PetManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -278,7 +280,7 @@ public class PetManager {
this.breedingPetType.put(set.getInt("pet_id"), set.getInt("offspring_id"));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
try (Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM pet_breeding_races")) {
@@ -295,13 +297,13 @@ public class PetManager {
this.breedingReward.get(reward.petType).get(reward.rarityLevel).add(reward);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
public THashSet getBreeds(String petName) {
if (!petName.startsWith("a0 pet")) {
- log.error("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet\"!");
+ LOGGER.error("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet\"!");
return null;
}
@@ -309,7 +311,7 @@ public class PetManager {
int petId = Integer.valueOf(petName.split("t")[1]);
return this.petRaces.get(petId);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return null;
@@ -347,7 +349,7 @@ public class PetManager {
return this.petData.get(type);
} else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
- log.error("Missing petdata for type " + type + ". Adding this to the database...");
+ LOGGER.error("Missing petdata for type " + type + ". Adding this to the database...");
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO pet_actions (pet_type) VALUES (?)")) {
statement.setInt(1, type);
statement.execute();
@@ -359,13 +361,13 @@ public class PetManager {
if (set.next()) {
PetData petData = new PetData(set);
this.petData.put(type, petData);
- log.error("Missing petdata for type " + type + " added to the database!");
+ LOGGER.error("Missing petdata for type " + type + " added to the database!");
return petData;
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -512,7 +514,7 @@ public class PetManager {
statement.setInt(1, pet.getId());
return statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java
index c35acf1..8e2d78a 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java
@@ -3,11 +3,14 @@ package com.eu.habbo.habbohotel.polls;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.map.hash.THashMap;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.*;
-@Slf4j
public class PollManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PollManager.class);
+
private final THashMap activePolls = new THashMap<>();
public PollManager() {
@@ -24,7 +27,7 @@ public class PollManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return false;
}
@@ -64,7 +67,7 @@ public class PollManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java
index f1285fd..3ca0650 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java
@@ -1,14 +1,17 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class CustomRoomLayout extends RoomLayout implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CustomRoomLayout.class);
+
private final int roomId;
private boolean needsUpdate;
@@ -31,7 +34,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable {
statement.setInt(5, this.roomId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
index 73d5d17..119df29 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
@@ -20,11 +20,13 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.Interaction
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeExitTile;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
-import com.eu.habbo.habbohotel.items.interactions.pets.*;
+import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
+import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetBreedingNest;
+import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
+import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.habbohotel.permissions.Permission;
-import com.eu.habbo.habbohotel.pets.HorsePet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.pets.RideablePet;
@@ -49,7 +51,6 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer;
import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
import com.eu.habbo.plugin.Event;
-import com.eu.habbo.plugin.PluginManager;
import com.eu.habbo.plugin.events.furniture.*;
import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
@@ -64,10 +65,13 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.procedure.TIntObjectProcedure;
+import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import io.netty.util.internal.ConcurrentSet;
import org.apache.commons.math3.util.Pair;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.awt.*;
import java.sql.Connection;
@@ -75,25 +79,37 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-@Slf4j
public class Room implements Comparable, ISerialize, Runnable {
- public static final Comparator SORT_SCORE = (o1, o2) -> o2.getScore() - o1.getScore();
- public static final Comparator SORT_ID = (o1, o2) -> o2.getId() - o1.getId();
+ private static final Logger LOGGER = LoggerFactory.getLogger(Room.class);
+
+ public static final Comparator SORT_SCORE = (o1, o2) -> {
+
+ if (!(o1 instanceof Room && o2 instanceof Room))
+ return 0;
+
+ return ((Room) o2).getScore() - ((Room) o1).getScore();
+ };
+ public static final Comparator SORT_ID = (o1, o2) -> {
+
+ if (!(o1 instanceof Room && o2 instanceof Room))
+ return 0;
+
+ return ((Room) o2).getId() - ((Room) o1).getId();
+ };
private static final TIntObjectHashMap defaultMoodData = new TIntObjectHashMap<>();
//Configuration. Loaded from database & updated accordingly.
public static boolean HABBO_CHAT_DELAY = false;
public static int MAXIMUM_BOTS = 10;
public static int MAXIMUM_PETS = 10;
- public static int MAXIMUM_FURNI = 3000;
+ public static int MAXIMUM_FURNI = 2500;
public static int MAXIMUM_POSTITNOTES = 200;
public static int HAND_ITEM_TIME = 10;
public static int IDLE_CYCLES = 240;
@@ -101,7 +117,7 @@ public class Room implements Comparable, ISerialize, Runnable {
public static String PREFIX_FORMAT = "[%prefix%] ";
public static int ROLLERS_MAXIMUM_ROLL_AVATARS = 1;
public static boolean MUTEAREA_CAN_WHISPER = false;
- public static final double MAXIMUM_FURNI_HEIGHT = 40d;
+ public static double MAXIMUM_FURNI_HEIGHT = 40d;
static {
for (int i = 1; i <= 3; i++) {
@@ -132,8 +148,8 @@ public class Room implements Comparable, ISerialize, Runnable {
//Use appropriately. Could potentially cause memory leaks when used incorrectly.
public volatile boolean preventUnloading = false;
public volatile boolean preventUncaching = false;
- public final ConcurrentHashMap.KeySetView scheduledComposers = ConcurrentHashMap.newKeySet();
- public ConcurrentHashMap.KeySetView scheduledTasks = ConcurrentHashMap.newKeySet();
+ public ConcurrentSet scheduledComposers = new ConcurrentSet<>();
+ public ConcurrentSet scheduledTasks = new ConcurrentSet<>();
public String wordQuiz = "";
public int noVotes = 0;
public int yesVotes = 0;
@@ -146,7 +162,7 @@ public class Room implements Comparable, ISerialize, Runnable {
private String description;
private RoomLayout layout;
private boolean overrideModel;
- private final String layoutName;
+ private String layoutName;
private String password;
private RoomState state;
private int usersMax;
@@ -158,7 +174,7 @@ public class Room implements Comparable, ISerialize, Runnable {
private int wallSize;
private int wallHeight;
private int floorSize;
- private int guildId;
+ private int guild;
private String tags;
private volatile boolean publicRoom;
private volatile boolean staffPromotedRoom;
@@ -197,9 +213,6 @@ public class Room implements Comparable, ISerialize, Runnable {
private TraxManager traxManager;
private boolean cycleOdd;
private long cycleTimestamp;
- public Map repeatersLastTick = new HashMap<>();
-
-
public Room(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -234,7 +247,7 @@ public class Room implements Comparable, ISerialize, Runnable {
this.kickOption = set.getInt("who_can_kick");
this.banOption = set.getInt("who_can_ban");
this.pollId = set.getInt("poll_id");
- this.guildId = set.getInt("guild_id");
+ this.guild = set.getInt("guild_id");
this.rollerSpeed = set.getInt("roller_speed");
this.overrideModel = set.getString("override_model").equals("1");
this.layoutName = set.getString("model");
@@ -260,7 +273,7 @@ public class Room implements Comparable, ISerialize, Runnable {
this.loadBans(connection);
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.tradeMode = set.getInt("trade_mode");
@@ -304,21 +317,61 @@ public class Room implements Comparable, ISerialize, Runnable {
}
this.roomSpecialTypes = new RoomSpecialTypes();
- this.loadLayout();
- this.loadRights(connection);
- this.loadItems(connection);
- this.loadHeightmap();
- this.loadBots(connection);
- this.loadPets(connection);
- this.loadWordFilter(connection);
- this.loadWiredData(connection);
+
+ try {
+ this.loadLayout();
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadRights(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadItems(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadHeightmap();
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadBots(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadPets(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadWordFilter(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
+
+ try {
+ this.loadWiredData(connection);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ }
this.idleCycles = 0;
this.loaded = true;
this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
this.traxManager = new TraxManager(this);
@@ -341,35 +394,27 @@ public class Room implements Comparable, ISerialize, Runnable {
}
private synchronized void loadLayout() {
- try {
- if (this.layout == null) {
- if (this.overrideModel) {
- this.layout = Emulator.getGameEnvironment().getRoomManager().loadCustomLayout(this);
- } else {
- this.layout = Emulator.getGameEnvironment().getRoomManager().loadLayout(this.layoutName, this);
- }
+ if (this.layout == null) {
+ if (this.overrideModel) {
+ this.layout = Emulator.getGameEnvironment().getRoomManager().loadCustomLayout(this);
+ } else {
+ this.layout = Emulator.getGameEnvironment().getRoomManager().loadLayout(this.layoutName, this);
}
- } catch (Exception e) {
- log.error("Caught exception", e);
}
}
private synchronized void loadHeightmap() {
- try {
- if (this.layout != null) {
- for (short x = 0; x < this.layout.getMapSizeX(); x++) {
- for (short y = 0; y < this.layout.getMapSizeY(); y++) {
- RoomTile tile = this.layout.getTile(x, y);
- if (tile != null) {
- this.updateTile(tile);
- }
+ if (this.layout != null) {
+ for (short x = 0; x < this.layout.getMapSizeX(); x++) {
+ for (short y = 0; y < this.layout.getMapSizeY(); y++) {
+ RoomTile tile = this.layout.getTile(x, y);
+ if (tile != null) {
+ this.updateTile(tile);
}
}
- } else {
- log.error("Unknown Room Layout for Room (ID: {})", this.id);
}
- } catch (Exception e) {
- log.error("Caught exception", e);
+ } else {
+ LOGGER.error("Unknown Room Layout for Room (ID: {})", this.id);
}
}
@@ -384,13 +429,11 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
- } catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
if (this.itemCount() > Room.MAXIMUM_FURNI) {
- log.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI);
+ LOGGER.error("Room ID: {} has exceeded the furniture limit ({} > {}).", this.getId(), this.itemCount(), Room.MAXIMUM_FURNI);
}
}
@@ -403,18 +446,18 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
HabboItem item = this.getHabboItem(set.getInt("id"));
- if (item instanceof InteractionWired interactionWired) {
- interactionWired.loadWiredData(set, this);
+ if (item instanceof InteractionWired) {
+ ((InteractionWired) item).loadWiredData(set, this);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -432,8 +475,7 @@ public class Room implements Comparable, ISerialize, Runnable {
b.setRoomUnit(new RoomUnit());
b.getRoomUnit().setPathFinderRoom(this);
b.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
- if (b.getRoomUnit().getCurrentLocation() == null || b.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
- b.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
+ if (b.getRoomUnit().getCurrentLocation() == null) {
b.getRoomUnit().setLocation(this.getLayout().getDoorTile());
b.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
} else {
@@ -443,7 +485,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
b.getRoomUnit().setRoomUnitType(RoomUnitType.BOT);
b.getRoomUnit().setDanceType(DanceType.values()[set.getInt("dance")]);
-
+ //b.getRoomUnit().setCanWalk(set.getBoolean("freeroam"));
b.getRoomUnit().setInRoom(true);
this.giveEffect(b.getRoomUnit(), set.getInt("effect"), Integer.MAX_VALUE);
this.addBot(b);
@@ -451,44 +493,42 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
- } catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
private synchronized void loadPets(Connection connection) {
-
this.currentPets.clear();
try (PreparedStatement statement = connection.prepareStatement("SELECT users.username as pet_owner_name, users_pets.* FROM users_pets INNER JOIN users ON users_pets.user_id = users.id WHERE room_id = ?")) {
statement.setInt(1, this.id);
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
+ try {
+ Pet pet = PetManager.loadPet(set);
+ pet.setRoom(this);
+ pet.setRoomUnit(new RoomUnit());
+ pet.getRoomUnit().setPathFinderRoom(this);
+ pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
+ if (pet.getRoomUnit().getCurrentLocation() == null) {
+ pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
+ pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
+ } else {
+ pet.getRoomUnit().setZ(set.getDouble("z"));
+ pet.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
+ }
+ pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET);
+ pet.getRoomUnit().setCanWalk(true);
+ this.addPet(pet);
- Pet pet = PetManager.loadPet(set);
- pet.setRoom(this);
- pet.setRoomUnit(new RoomUnit());
- pet.getRoomUnit().setPathFinderRoom(this);
- pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
- if (pet.getRoomUnit().getCurrentLocation() == null || pet.getRoomUnit().getCurrentLocation().getState() == RoomTileState.INVALID) {
- pet.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
- pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
- pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
- } else {
- pet.getRoomUnit().setZ(set.getDouble("z"));
- pet.getRoomUnit().setRotation(RoomUserRotation.values()[set.getInt("rot")]);
+ this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
+ } catch (SQLException e) {
+ LOGGER.error("Caught SQL exception", e);
}
- pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET);
- pet.getRoomUnit().setCanWalk(true);
- this.addPet(pet);
- this.getFurniOwnerNames().put(pet.getUserId(), set.getString("pet_owner_name"));
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
- } catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -503,7 +543,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -516,9 +556,6 @@ public class Room implements Comparable, ISerialize, Runnable {
public void updateTiles(THashSet tiles) {
for (RoomTile tile : tiles) {
- if(tile == null) {
- continue;
- }
this.tileCache.remove(tile);
tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false));
tile.setState(this.calculateTileState(tile));
@@ -536,7 +573,8 @@ public class Room implements Comparable, ISerialize, Runnable {
return RoomTileState.INVALID;
RoomTileState result = RoomTileState.OPEN;
-
+ //HabboItem highestItem = null;
+ //HabboItem lowestChair = this.getLowestChair(tile);
THashSet items = this.getItemsAt(tile);
if (items == null) return RoomTileState.INVALID;
@@ -550,12 +588,34 @@ public class Room implements Comparable, ISerialize, Runnable {
return RoomTileState.LAY;
}
+ /*if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
+ continue;
+
+ highestItem = item;*/
+
if(tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item))
continue;
result = this.checkStateForItem(item, tile);
tallestItem = item;
+
+ /*if (lowestChair != null && item.getZ() > lowestChair.getZ() + 1.5) {
+ continue;
+ }
+
+ if (lowestItem == null || lowestItem.getZ() < item.getZ()) {
+ lowestItem = item;
+
+ result = this.checkStateForItem(lowestItem, tile);
+ } else if (lowestItem.getZ() == item.getZ()) {
+ if (result == RoomTileState.OPEN) {
+ result = this.checkStateForItem(item, tile);
+ }
+ }*/
}
+
+ //if (lowestChair != null) return RoomTileState.SIT;
+
return result;
}
@@ -564,9 +624,13 @@ public class Room implements Comparable, ISerialize, Runnable {
if (item.isWalkable()) {
result = RoomTileState.OPEN;
- } else if (item.getBaseItem().allowSit()) {
+ }
+
+ if (item.getBaseItem().allowSit()) {
result = RoomTileState.SIT;
- } else if (item.getBaseItem().allowLay()) {
+ }
+
+ if (item.getBaseItem().allowLay()) {
result = RoomTileState.LAY;
}
@@ -586,9 +650,10 @@ public class Room implements Comparable, ISerialize, Runnable {
boolean walkable = this.layout.tileWalkable(x, y);
RoomTile tile = this.getLayout().getTile(x, y);
- if ((walkable && tile != null) && (tile.hasUnits() && !this.allowWalkthrough)) {
- walkable = false;
-
+ if (walkable && tile != null) {
+ if (tile.hasUnits() && !this.allowWalkthrough) {
+ walkable = false;
+ }
}
return walkable;
@@ -630,10 +695,10 @@ public class Room implements Comparable, ISerialize, Runnable {
}
this.sendComposer(new UpdateStackHeightComposer(this, updatedTiles).compose());
this.updateTiles(updatedTiles);
- updatedTiles.forEach(tile -> {
+ for (RoomTile tile : updatedTiles) {
this.updateHabbosAt(tile.x, tile.y);
this.updateBotsAt(tile.x, tile.y);
- });
+ }
} else if (item.getBaseItem().getType() == FurnitureType.WALL) {
this.sendComposer(new RemoveWallItemComposer(item).compose());
}
@@ -692,9 +757,10 @@ public class Room implements Comparable, ISerialize, Runnable {
this.updateHabbosAt(x, y, this.getHabbosAt(x, y));
}
- public void updateHabbosAt(short x, short y, List habbos) {
+ public void updateHabbosAt(short x, short y, THashSet habbos) {
HabboItem item = this.getTopItemAt(x, y);
+ THashSet roomUnits = new THashSet<>();
for (Habbo habbo : habbos) {
double oldZ = habbo.getRoomUnit().getZ();
@@ -723,19 +789,21 @@ public class Room implements Comparable, ISerialize, Runnable {
if(habbo.getRoomUnit().getCurrentLocation().is(x, y) && (oldZ != z || updated || oldRotation != habbo.getRoomUnit().getBodyRotation())) {
habbo.getRoomUnit().statusUpdate(true);
+ //roomUnits.add(habbo.getRoomUnit());
}
}
+
+ /*if (!roomUnits.isEmpty()) {
+ this.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
+ }*/
}
public void updateBotsAt(short x, short y) {
- if(this.layout == null) {
- return;
- }
HabboItem topItem = this.getTopItemAt(x, y);
THashSet roomUnits = new THashSet<>();
- this.getBotsAt(this.layout.getTile(x, y)).forEach(bot -> {
+ for (Bot bot : this.getBotsAt(this.layout.getTile(x, y))) {
if (topItem != null) {
if (topItem.getBaseItem().allowSit()) {
bot.getRoomUnit().setZ(topItem.getZ());
@@ -752,8 +820,9 @@ public class Room implements Comparable, ISerialize, Runnable {
bot.getRoomUnit().setZ(bot.getRoomUnit().getCurrentLocation().getStackHeight());
bot.getRoomUnit().setPreviousLocationZ(bot.getRoomUnit().getCurrentLocation().getStackHeight());
}
+
roomUnits.add(bot.getRoomUnit());
- });
+ }
if (!roomUnits.isEmpty()) {
this.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
@@ -890,7 +959,7 @@ public class Room implements Comparable, ISerialize, Runnable {
botIterator.value().needsUpdate(true);
Emulator.getThreading().run(botIterator.value());
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
}
@@ -898,7 +967,7 @@ public class Room implements Comparable, ISerialize, Runnable {
this.currentBots.clear();
this.currentPets.clear();
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -910,7 +979,7 @@ public class Room implements Comparable, ISerialize, Runnable {
this.preLoaded = true;
this.layout = null;
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -919,8 +988,8 @@ public class Room implements Comparable, ISerialize, Runnable {
@Override
public int compareTo(Room o) {
- if (o.getUserCountWithoutInvisibleHabbos() != this.getUserCountWithoutInvisibleHabbos()) {
- return o.getUserCountWithoutInvisibleHabbos() - this.getUserCountWithoutInvisibleHabbos();
+ if (o.getUserCount() != this.getUserCount()) {
+ return o.getCurrentHabbos().size() - this.getCurrentHabbos().size();
}
return this.id - o.id;
@@ -938,7 +1007,7 @@ public class Room implements Comparable, ISerialize, Runnable {
message.appendString(this.ownerName);
}
message.appendInt(this.state.getState());
- message.appendInt(this.getUserCountWithoutInvisibleHabbos());
+ message.appendInt(this.getUserCount());
message.appendInt(this.usersMax);
message.appendString(this.description);
message.appendInt(0);
@@ -993,13 +1062,15 @@ public class Room implements Comparable, ISerialize, Runnable {
@Override
public void run() {
+ long millis = System.currentTimeMillis();
+
synchronized (this.loadLock) {
if (this.loaded) {
try {
Emulator.getThreading().run(
Room.this::cycle);
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
@@ -1028,7 +1099,7 @@ public class Room implements Comparable, ISerialize, Runnable {
int id = 1;
for (RoomMoodlightData data : this.moodlightData.valueCollection()) {
data.setId(id);
- moodLightData.append(data).append(";");
+ moodLightData.append(data.toString()).append(";");
id++;
}
@@ -1047,7 +1118,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(26, this.kickOption);
statement.setInt(27, this.banOption);
statement.setInt(28, this.pollId);
- statement.setInt(29, this.guildId);
+ statement.setInt(29, this.guild);
statement.setInt(30, this.rollerSpeed);
statement.setString(31, this.overrideModel ? "1" : "0");
statement.setString(32, this.staffPromotedRoom ? "1" : "0");
@@ -1062,7 +1133,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.executeUpdate();
this.needsUpdate = false;
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -1073,7 +1144,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(2, this.id);
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -1090,8 +1161,8 @@ public class Room implements Comparable, ISerialize, Runnable {
this.tileCache.clear();
if (loaded) {
if (!this.scheduledTasks.isEmpty()) {
- ConcurrentHashMap.KeySetView tasks = this.scheduledTasks;
- this.scheduledTasks = ConcurrentHashMap.newKeySet();
+ ConcurrentSet tasks = this.scheduledTasks;
+ this.scheduledTasks = new ConcurrentSet<>();
for (Runnable runnable : tasks) {
Emulator.getThreading().run(runnable);
@@ -1117,11 +1188,9 @@ public class Room implements Comparable, ISerialize, Runnable {
foundRightHolder[0] = habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE;
}
- /* Habbo doesn't remove the handitem anymore, checked on February 25 2023
- if (habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000L)) {
+ if (habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000)) {
this.giveHandItem(habbo, 0);
}
- */
if (habbo.getRoomUnit().getEffectId() > 0 && millis / 1000 > habbo.getRoomUnit().getEffectEndTimestamp()) {
this.giveEffect(habbo, 0, -1);
@@ -1161,7 +1230,9 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
- if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting") && this.ownerId != habbo.getHabboInfo().getId()) {
+ if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) {
+ //Check if the user isn't the owner id
+ if (this.ownerId != habbo.getHabboInfo().getId()) {
//Check if the time already have 1 minute (120 / 2 = 60s)
if (habbo.getRoomUnit().getTimeInRoom() >= 120) {
AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"));
@@ -1170,7 +1241,7 @@ public class Room implements Comparable, ISerialize, Runnable {
habbo.getRoomUnit().increaseTimeInRoom();
}
}
-
+ }
if (habbo.getHabboStats().mutedBubbleTracker && habbo.getHabboStats().allowTalk()) {
habbo.getHabboStats().mutedBubbleTracker = false;
@@ -1220,19 +1291,20 @@ public class Room implements Comparable, ISerialize, Runnable {
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
}
}
- if (!this.currentPets.isEmpty() && this.allowBotsWalk) {
+ if (!this.currentPets.isEmpty()) {
+ if (this.allowBotsWalk) {
TIntObjectIterator petIterator = this.currentPets.iterator();
for (int i = this.currentPets.size(); i-- > 0; ) {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
@@ -1253,6 +1325,7 @@ public class Room implements Comparable, ISerialize, Runnable {
updatedUnit.add(pet.getRoomUnit());
}
}
+ }
}
if (this.rollerSpeed != -1 && this.rollerCycle >= this.rollerSpeed) {
@@ -1283,6 +1356,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
+ // itemsOnRoller.addAll(this.getItemsAt(rollerTile));
itemsOnRoller.remove(roller);
if (!rollerTile.hasUnits() && itemsOnRoller.isEmpty())
@@ -1308,10 +1382,15 @@ public class Room implements Comparable, ISerialize, Runnable {
THashSet itemsNewTile = new THashSet<>();
itemsNewTile.addAll(getItemsAt(tileInFront));
itemsNewTile.removeAll(itemsOnRoller);
-
- itemsOnRoller.removeIf(item -> item.getX() != roller.getX() || item.getY() != roller.getY() || rollerFurniIds.contains(item.getId()));
-
- HabboItem topItem = Room.this.getTopItemAt(tileInFront.x, tileInFront.y);
+
+ List toRemove = new ArrayList<>();
+ for (HabboItem item : itemsOnRoller) {
+ if (item.getX() != roller.getX() || item.getY() != roller.getY() || rollerFurniIds.contains(item.getId())) {
+ toRemove.add(item);
+ }
+ }
+ itemsOnRoller.removeAll(toRemove);
+ HabboItem topItem = Room.this.getTopItemAt(tileInFront.x, tileInFront.y);
boolean allowUsers = true;
boolean allowFurniture = true;
@@ -1363,21 +1442,19 @@ public class Room implements Comparable, ISerialize, Runnable {
if (unit.getRoomUnitType() == RoomUnitType.PET) {
Pet pet = this.getPet(unit);
if (pet instanceof RideablePet && ((RideablePet) pet).getRider() != null) {
- break;
+ unitsOnTile.remove(unit);
}
}
}
+ HabboItem nextTileChair = this.getTallestChair(tileInFront);
+
THashSet usersRolledThisTile = new THashSet<>();
for (RoomUnit unit : unitsOnTile) {
if (rolledUnitIds.contains(unit.getId())) continue;
- if (usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
-
- if (unit.getRoomUnitType() == RoomUnitType.PET) {
- break;
- }
+ if(usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
continue;
@@ -1385,10 +1462,11 @@ public class Room implements Comparable, ISerialize, Runnable {
if (unit.hasStatus(RoomUnitStatus.MOVE))
continue;
- double newZ = unit.getZ() + zOffset;
+ RoomTile tile = tileInFront.copy();
+ tile.setStackHeight(unit.getZ() + zOffset);
if (roomUserRolledEvent != null && unit.getRoomUnitType() == RoomUnitType.USER) {
- roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tileInFront);
+ roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tile);
Emulator.getPluginManager().fireEvent(roomUserRolledEvent);
if (roomUserRolledEvent.isCancelled())
@@ -1403,10 +1481,10 @@ public class Room implements Comparable, ISerialize, Runnable {
RideablePet riding = rollingHabbo.getHabboInfo().getRiding();
if (riding != null) {
RoomUnit ridingUnit = riding.getRoomUnit();
- newZ = ridingUnit.getZ() + zOffset;
+ tile.setStackHeight(ridingUnit.getZ() + zOffset);
rolledUnitIds.add(ridingUnit.getId());
updatedUnit.remove(ridingUnit);
- messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tileInFront, newZ, room));
+ messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight(), room));
isRiding = true;
}
}
@@ -1415,7 +1493,8 @@ public class Room implements Comparable, ISerialize, Runnable {
usersRolledThisTile.add(unit.getId());
rolledUnitIds.add(unit.getId());
updatedUnit.remove(unit);
- messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), room));
+ messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0), room));
+
if (itemsOnRoller.isEmpty()) {
HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y);
@@ -1425,7 +1504,7 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
item.onWalkOn(unit, room, new Object[] { rollerTile, tileInFront });
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}, this.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
@@ -1447,35 +1526,29 @@ public class Room implements Comparable, ISerialize, Runnable {
if (allowFurniture || !stackContainsRoller || InteractionRoller.NO_RULES) {
Event furnitureRolledEvent = null;
- PluginManager pluginManager = Emulator.getPluginManager(); // Store the plugin manager
- if (pluginManager.isRegistered(FurnitureRolledEvent.class, true)) {
+ if (Emulator.getPluginManager().isRegistered(FurnitureRolledEvent.class, true)) {
furnitureRolledEvent = new FurnitureRolledEvent(null, null, null);
}
if (newRoller == null || topItem == newRoller) {
List sortedItems = new ArrayList<>(itemsOnRoller);
- sortedItems.sort((o1, o2) -> Double.compare(o2.getZ(), o1.getZ()));
+ sortedItems.sort((o1, o2) -> o1.getZ() > o2.getZ() ? -1 : 1);
for (HabboItem item : sortedItems) {
- if ((item.getX() == roller.getX() && item.getY() == roller.getY() && zOffset <= 0) && (item != roller)) {
- if (furnitureRolledEvent != null) {
- furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront);
- pluginManager.fireEvent(furnitureRolledEvent);
+ if (item.getX() == roller.getX() && item.getY() == roller.getY() && zOffset <= 0) {
+ if (item != roller) {
+ if (furnitureRolledEvent != null) {
+ furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront);
+ Emulator.getPluginManager().fireEvent(furnitureRolledEvent);
- if (furnitureRolledEvent.isCancelled()) {
- continue;
+ if (furnitureRolledEvent.isCancelled())
+ continue;
}
+
+ messages.add(new FloorItemOnRollerComposer(item, roller, tileInFront, zOffset, room));
+ rollerFurniIds.add(item.getId());
}
-
- final double currentZOffset = zOffset;
- int delay = (getRollerSpeed() == 0) ? 250 : InteractionRoller.DELAY; // Calculate delay once
-
- Emulator.getThreading().run(() -> {
- this.sendComposer(new FloorItemOnRollerComposer(item, roller, tileInFront, currentZOffset, room).compose());
- }, delay);
-
- rollerFurniIds.add(item.getId());
}
}
}
@@ -1492,10 +1565,14 @@ public class Room implements Comparable, ISerialize, Runnable {
return true;
});
+
int currentTime = (int) (this.cycleTimestamp / 1000);
for (HabboItem pyramid : this.roomSpecialTypes.getItemsOfType(InteractionPyramid.class)) {
- if (pyramid instanceof InteractionPyramid interactionPyramid && interactionPyramid.getNextChange() < currentTime) {
- interactionPyramid.change(this);
+ if (pyramid instanceof InteractionPyramid) {
+
+ if (((InteractionPyramid) pyramid).getNextChange() < currentTime) {
+ ((InteractionPyramid) pyramid).change(this);
+ }
}
}
} else {
@@ -1518,12 +1595,19 @@ public class Room implements Comparable, ISerialize, Runnable {
synchronized (this.habboQueue) {
if (!this.habboQueue.isEmpty() && !foundRightHolder[0]) {
- this.habboQueue.forEachEntry((a, b) -> {
- if (b.isOnline() && b.getHabboInfo().getRoomQueueId() == Room.this.getId()) {
- b.getClient().sendResponse(new RoomAccessDeniedComposer(""));
+ this.habboQueue.forEachEntry(new TIntObjectProcedure() {
+ @Override
+ public boolean execute(int a, Habbo b) {
+ if (b.isOnline()) {
+ if (b.getHabboInfo().getRoomQueueId() == Room.this.getId()) {
+ b.getClient().sendResponse(new RoomAccessDeniedComposer(""));
+ }
+ }
+
+ return true;
}
- return true;
});
+
this.habboQueue.clear();
}
}
@@ -1568,7 +1652,7 @@ public class Room implements Comparable, ISerialize, Runnable {
} else if (thisTile.state == RoomTileState.SIT && (!unit.hasStatus(RoomUnitStatus.SIT) || unit.sitUpdate)) {
this.dance(unit, DanceType.NONE);
//int tileHeight = this.layout.getTile(topItem.getX(), topItem.getY()).z;
- unit.setStatus(RoomUnitStatus.SIT, (Item.getCurrentHeight(topItem)) + "");
+ unit.setStatus(RoomUnitStatus.SIT, (Item.getCurrentHeight(topItem) * 1.0D) + "");
unit.setZ(topItem.getZ());
unit.setRotation(RoomUserRotation.values()[topItem.getRotation()]);
unit.sitUpdate = false;
@@ -1587,7 +1671,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
} else {
if (!unit.hasStatus(RoomUnitStatus.LAY)) {
- unit.setStatus(RoomUnitStatus.LAY, Item.getCurrentHeight(topItem) + "");
+ unit.setStatus(RoomUnitStatus.LAY, Item.getCurrentHeight(topItem) * 1.0D + "");
unit.setRotation(RoomUserRotation.values()[topItem.getRotation() % 4]);
if (topItem.getRotation() == 0 || topItem.getRotation() == 4) {
@@ -1641,7 +1725,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
if (this.hasGuild()) {
- Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guildId);
+ Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guild);
if (guild != null) {
guild.setRoomName(name);
@@ -1796,20 +1880,20 @@ public class Room implements Comparable, ISerialize, Runnable {
}
public int getGuildId() {
- return this.guildId;
+ return this.guild;
}
public boolean hasGuild() {
- return this.guildId != 0;
+ return this.guild != 0;
}
- public void setGuildId(int guildId) {
- this.guildId = guildId;
+ public void setGuild(int guild) {
+ this.guild = guild;
}
public String getGuildName() {
if (this.hasGuild()) {
- Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guildId);
+ Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guild);
if (guild != null) {
return guild.getName();
@@ -1943,6 +2027,10 @@ public class Room implements Comparable, ISerialize, Runnable {
this.chatDistance = chatDistance;
}
+ public void removeAllPets() {
+ removeAllPets(-1);
+ }
+
/**
* Removes all pets from the room except if the owner id is excludeUserId
*
@@ -1959,7 +2047,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
}
@@ -2087,7 +2175,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(10, this.promotion.getCategory());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.needsUpdate = true;
@@ -2128,7 +2216,7 @@ public class Room implements Comparable, ISerialize, Runnable {
game = gameType.getDeclaredConstructor(Room.class).newInstance(this);
this.addGame(game);
} catch (Exception e) {
- log.error("Error getting game " + gameType.getName(), e);
+ LOGGER.error("Error getting game " + gameType.getName(), e);
}
}
@@ -2142,18 +2230,6 @@ public class Room implements Comparable, ISerialize, Runnable {
public int getUserCount() {
return this.currentHabbos.size();
}
-
- /**
- * Get all users but without the players that are invisible.
- *
- * @return the amount of visible players.
- */
- public int getUserCountWithoutInvisibleHabbos() {
- return (int) this.currentHabbos.values()
- .stream()
- .filter((habbo -> !habbo.getHabboInfo().isInvisibleInRooms()))
- .count();
- }
public ConcurrentHashMap getCurrentHabbos() {
return this.currentHabbos;
@@ -2205,7 +2281,7 @@ public class Room implements Comparable, ISerialize, Runnable {
return this.habboQueue.remove(habbo.getHabboInfo().getId()) != null;
}
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
return true;
@@ -2278,7 +2354,7 @@ public class Room implements Comparable, ISerialize, Runnable {
if (habbo != null) {
this.furniOwnerNames.put(item.getUserId(), habbo.getUsername());
} else {
- log.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getUserId());
+ LOGGER.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getUserId());
}
}
}
@@ -2297,8 +2373,6 @@ public class Room implements Comparable, ISerialize, Runnable {
this.roomSpecialTypes.addCondition((InteractionWiredCondition) item);
} else if (item instanceof InteractionWiredExtra) {
this.roomSpecialTypes.addExtra((InteractionWiredExtra) item);
- } else if (item instanceof InteractionWiredHighscore) {
- this.roomSpecialTypes.addHighscore((InteractionWiredHighscore) item);
} else if (item instanceof InteractionBattleBanzaiTeleporter) {
this.roomSpecialTypes.addBanzaiTeleporter((InteractionBattleBanzaiTeleporter) item);
} else if (item instanceof InteractionRoller) {
@@ -2345,6 +2419,8 @@ public class Room implements Comparable, ISerialize, Runnable {
this.roomSpecialTypes.addUndefined(item);
} else if (item instanceof InteractionBlackHole) {
this.roomSpecialTypes.addUndefined(item);
+ } else if (item instanceof InteractionWiredHighscore) {
+ this.roomSpecialTypes.addUndefined(item);
} else if (item instanceof InteractionStickyPole) {
this.roomSpecialTypes.addUndefined(item);
} else if (item instanceof WiredBlob) {
@@ -2519,8 +2595,12 @@ public class Room implements Comparable, ISerialize, Runnable {
if (iterator.value().getBaseItem().getType() == FurnitureType.FLOOR)
items.add(iterator.value());
+
}
+
+
return items;
+
}
public THashSet getWallItems() {
@@ -2533,14 +2613,32 @@ public class Room implements Comparable, ISerialize, Runnable {
} catch (Exception e) {
break;
}
+
if (iterator.value().getBaseItem().getType() == FurnitureType.WALL)
items.add(iterator.value());
}
+
return items;
+
}
- public List getPostItNotes() {
- return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getInteractionType().getType() == InteractionPostIt.class).toList();
+ public THashSet getPostItNotes() {
+ THashSet items = new THashSet<>();
+ TIntObjectIterator iterator = this.roomItems.iterator();
+
+ for (int i = this.roomItems.size(); i-- > 0; ) {
+ try {
+ iterator.advance();
+ } catch (Exception e) {
+ break;
+ }
+
+ if (iterator.value().getBaseItem().getInteractionType().getType() == InteractionPostIt.class)
+ items.add(iterator.value());
+ }
+
+ return items;
+
}
public void addHabbo(Habbo habbo) {
@@ -2548,10 +2646,7 @@ public class Room implements Comparable, ISerialize, Runnable {
habbo.getRoomUnit().setId(this.unitCounter);
this.currentHabbos.put(habbo.getHabboInfo().getId(), habbo);
this.unitCounter++;
- // don't update the db if the user is invisible
- if (!habbo.getHabboInfo().isInvisibleInRooms()) {
- this.updateDatabaseUserCount();
- }
+ this.updateDatabaseUserCount();
}
}
@@ -2593,14 +2688,15 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
- if (habbo.getHabboInfo().getCurrentGame() != null && this.getGame(habbo.getHabboInfo().getCurrentGame()) != null) {
- this.getGame(habbo.getHabboInfo().getCurrentGame()).removeHabbo(habbo);
-
+ if (habbo.getHabboInfo().getCurrentGame() != null) {
+ if (this.getGame(habbo.getHabboInfo().getCurrentGame()) != null) {
+ this.getGame(habbo.getHabboInfo().getCurrentGame()).removeHabbo(habbo);
+ }
}
RoomTrade trade = this.getActiveTradeForHabbo(habbo);
@@ -2649,7 +2745,7 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
iterator.advance();
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
@@ -2663,28 +2759,63 @@ public class Room implements Comparable, ISerialize, Runnable {
public Bot getBotByRoomUnitId(int id) {
synchronized (this.currentBots) {
- return currentBots.valueCollection().stream().filter(b -> b.getRoomUnit().getId() == id).findFirst().orElse(null);
+ TIntObjectIterator iterator = this.currentBots.iterator();
+
+ for (int i = this.currentBots.size(); i-- > 0; ) {
+ try {
+ iterator.advance();
+ } catch (NoSuchElementException e) {
+ LOGGER.error("Caught exception", e);
+ break;
+ }
+
+ if (iterator.value().getRoomUnit().getId() == id)
+ return iterator.value();
+ }
}
+
+ return null;
}
public List getBots(String name) {
+ List bots = new ArrayList<>();
+
synchronized (this.currentBots) {
- return currentBots.valueCollection().stream().filter(b -> b.getName().equalsIgnoreCase(name)).toList();
+ TIntObjectIterator iterator = this.currentBots.iterator();
+
+ for (int i = this.currentBots.size(); i-- > 0; ) {
+ try {
+ iterator.advance();
+ } catch (NoSuchElementException e) {
+ LOGGER.error("Caught exception", e);
+ break;
+ }
+
+ if (iterator.value().getName().equalsIgnoreCase(name))
+ bots.add(iterator.value());
+ }
}
+
+ return bots;
}
public boolean hasBotsAt(final int x, final int y) {
final boolean[] result = {false};
synchronized (this.currentBots) {
- this.currentBots.forEachValue(object -> {
- if (object.getRoomUnit().getX() == x && object.getRoomUnit().getY() == y) {
- result[0] = true;
- return false;
+ this.currentBots.forEachValue(new TObjectProcedure() {
+ @Override
+ public boolean execute(Bot object) {
+ if (object.getRoomUnit().getX() == x && object.getRoomUnit().getY() == y) {
+ result[0] = true;
+ return false;
+ }
+
+ return true;
}
- return true;
});
}
+
return result[0];
}
@@ -2693,7 +2824,21 @@ public class Room implements Comparable, ISerialize, Runnable {
}
public Pet getPet(RoomUnit roomUnit) {
- return currentPets.valueCollection().stream().filter(p -> p.getRoomUnit() == roomUnit).findFirst().orElse(null);
+ TIntObjectIterator petIterator = this.currentPets.iterator();
+
+ for (int i = this.currentPets.size(); i-- > 0; ) {
+ try {
+ petIterator.advance();
+ } catch (NoSuchElementException e) {
+ LOGGER.error("Caught exception", e);
+ break;
+ }
+
+ if (petIterator.value().getRoomUnit() == roomUnit)
+ return petIterator.value();
+ }
+
+ return null;
}
public boolean removeBot(Bot bot) {
@@ -2749,7 +2894,11 @@ public class Room implements Comparable, ISerialize, Runnable {
}
public boolean hasHabbosAt(int x, int y) {
- return getHabbos().stream().anyMatch(h -> h.getRoomUnit().getX() == x && h.getRoomUnit().getY() == y);
+ for (Habbo habbo : this.getHabbos()) {
+ if (habbo.getRoomUnit().getX() == x && habbo.getRoomUnit().getY() == y)
+ return true;
+ }
+ return false;
}
public boolean hasPetsAt(int x, int y) {
@@ -2760,7 +2909,7 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
petIterator.advance();
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
@@ -2772,24 +2921,40 @@ public class Room implements Comparable, ISerialize, Runnable {
return false;
}
- public List getBotsAt(RoomTile tile) {
+ public THashSet getBotsAt(RoomTile tile) {
+ THashSet bots = new THashSet<>();
synchronized (this.currentBots) {
- return currentBots.valueCollection().stream().filter(b -> b.getRoomUnit().getCurrentLocation().equals(tile)).toList();
+ TIntObjectIterator botIterator = this.currentBots.iterator();
+
+ for (int i = this.currentBots.size(); i-- > 0; ) {
+ try {
+ botIterator.advance();
+
+ if (botIterator.value().getRoomUnit().getCurrentLocation().equals(tile)) {
+ bots.add(botIterator.value());
+ }
+ } catch (Exception e) {
+ break;
+ }
+ }
}
+
+ return bots;
}
- public List getHabbosAt(short x, short y) {
- if(this.layout == null) {
- return new ArrayList<>();
- }
+ public THashSet getHabbosAt(short x, short y) {
return this.getHabbosAt(this.layout.getTile(x, y));
}
- public List getHabbosAt(RoomTile tile) {
- if(this.layout == null) {
- return new ArrayList<>();
+ public THashSet getHabbosAt(RoomTile tile) {
+ THashSet habbos = new THashSet<>();
+
+ for (Habbo habbo : this.getHabbos()) {
+ if (habbo.getRoomUnit().getCurrentLocation().equals(tile))
+ habbos.add(habbo);
}
- return getHabbos().stream().filter(h -> h.getRoomUnit().getCurrentLocation().equals(tile)).toList();
+
+ return habbos;
}
public THashSet getHabbosAndBotsAt(short x, short y) {
@@ -2799,8 +2964,14 @@ public class Room implements Comparable, ISerialize, Runnable {
public THashSet getHabbosAndBotsAt(RoomTile tile) {
THashSet list = new THashSet<>();
- list.addAll(getBotsAt(tile).stream().map(Bot::getRoomUnit).toList());
- list.addAll(getHabbosAt(tile).stream().map(Habbo::getRoomUnit).toList());
+ for (Bot bot : this.getBotsAt(tile)) {
+ list.add(bot.getRoomUnit());
+ }
+
+ for(Habbo habbo : this.getHabbosAt(tile))
+ {
+ list.add(habbo.getRoomUnit());
+ }
return list;
}
@@ -2912,7 +3083,7 @@ public class Room implements Comparable, ISerialize, Runnable {
try {
doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{});
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
@@ -2932,16 +3103,23 @@ public class Room implements Comparable, ISerialize, Runnable {
if (!habbo.getHabboStats().allowTalk())
return;
+ if (habbo.getRoomUnit().isInvisible() && Emulator.getConfig().getBoolean("invisible.prevent.chat", false)) {
+ if (!CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) {
+ habbo.whisper(Emulator.getTexts().getValue("invisible.prevent.chat.error"));
+ }
+
+ return;
+ }
+
if (habbo.getHabboInfo().getCurrentRoom() != this)
return;
long millis = System.currentTimeMillis();
-
- if (HABBO_CHAT_DELAY && millis - habbo.getHabboStats().lastChat < 750) {
- return;
-
+ if (HABBO_CHAT_DELAY) {
+ if (millis - habbo.getHabboStats().lastChat < 750) {
+ return;
+ }
}
-
habbo.getHabboStats().lastChat = millis;
if (roomChatMessage != null && Emulator.getConfig().getBoolean("easter_eggs.enabled") && roomChatMessage.getMessage().equalsIgnoreCase("i am a pirate")) {
habbo.getHabboStats().chatCounter.addAndGet(1);
@@ -2952,8 +3130,10 @@ public class Room implements Comparable, ISerialize, Runnable {
UserIdleEvent event = new UserIdleEvent(habbo, UserIdleEvent.IdleReason.TALKED, false);
Emulator.getPluginManager().fireEvent(event);
- if (!event.isCancelled() && !event.idle) {
- this.unIdle(habbo);
+ if (!event.isCancelled()) {
+ if (!event.idle) {
+ this.unIdle(habbo);
+ }
}
this.sendComposer(new RoomUserTypingComposer(habbo.getRoomUnit(), false).compose());
@@ -2969,9 +3149,11 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
- if (!this.wordFilterWords.isEmpty() && !habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) {
- for (String string : this.wordFilterWords) {
- roomChatMessage.setMessage(roomChatMessage.getMessage().replaceAll("(?i)" + Pattern.quote(string), "bobba"));
+ if (!this.wordFilterWords.isEmpty()) {
+ if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) {
+ for (String string : this.wordFilterWords) {
+ roomChatMessage.setMessage(roomChatMessage.getMessage().replaceAll("(?i)" + Pattern.quote(string), "bobba"));
+ }
}
}
@@ -2986,32 +3168,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
- if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) {
- final int chatCounter = habbo.getHabboStats().chatCounter.addAndGet(1);
-
- if (chatCounter > 3) {
- final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
- final boolean hasRights = this.hasRights(habbo);
-
- if (floodRights || !hasRights) {
- this.floodMuteHabbo(habbo, muteTime);
- return;
-
- /*if (this.chatProtection == 0) {
- this.floodMuteHabbo(habbo, muteTime);
- return;
- } else if (this.chatProtection == 1 && chatCounter > 4) {
- this.floodMuteHabbo(habbo, muteTime);
- return;
- } else if (this.chatProtection == 2 && chatCounter > 5) {
- this.floodMuteHabbo(habbo, muteTime);
- return;
- }*/
- }
- }
- }
-
- if (chatType != RoomChatType.WHISPER) {
+ if (chatType != RoomChatType.WHISPER) {
if (CommandHandler.handleCommand(habbo.getClient(), roomChatMessage.getUnfilteredMessage())) {
WiredHandler.handle(WiredTriggerType.SAY_COMMAND, habbo.getRoomUnit(), habbo.getHabboInfo().getCurrentRoom(), new Object[]{roomChatMessage.getMessage()});
roomChatMessage.isCommand = true;
@@ -3026,6 +3183,28 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
+ if (!habbo.hasPermission(Permission.ACC_CHAT_NO_FLOOD)) {
+ final int chatCounter = habbo.getHabboStats().chatCounter.addAndGet(1);
+
+ if (chatCounter > 3) {
+ final boolean floodRights = Emulator.getConfig().getBoolean("flood.with.rights");
+ final boolean hasRights = this.hasRights(habbo);
+
+ if (floodRights || !hasRights) {
+ if (this.chatProtection == 0) {
+ this.floodMuteHabbo(habbo, muteTime);
+ return;
+ } else if (this.chatProtection == 1 && chatCounter > 4) {
+ this.floodMuteHabbo(habbo, muteTime);
+ return;
+ } else if (this.chatProtection == 2 && chatCounter > 5) {
+ this.floodMuteHabbo(habbo, muteTime);
+ return;
+ }
+ }
+ }
+ }
+
ServerMessage prefixMessage = null;
if (Emulator.getPluginManager().isRegistered(UsernameTalkEvent.class, true)) {
@@ -3134,7 +3313,7 @@ public class Room implements Comparable, ISerialize, Runnable {
bot.onUserSay(roomChatMessage);
} catch (NoSuchElementException e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
break;
}
}
@@ -3166,7 +3345,7 @@ public class Room implements Comparable, ISerialize, Runnable {
break;
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
}
@@ -3207,7 +3386,14 @@ public class Room implements Comparable, ISerialize, Runnable {
if (item.getBaseItem().getType() != FurnitureType.FLOOR)
continue;
- boolean found = lockedTiles.stream().anyMatch(tile -> tile.x == item.getX() && tile.y == item.getY());
+ boolean found = false;
+ for (RoomTile tile : lockedTiles) {
+ if (tile.x == item.getX() &&
+ tile.y == item.getY()) {
+ found = true;
+ break;
+ }
+ }
if (!found) {
if (item.getRotation() == 0 || item.getRotation() == 4) {
@@ -3239,9 +3425,6 @@ public class Room implements Comparable, ISerialize, Runnable {
@Deprecated
public THashSet getItemsAt(int x, int y) {
- if (this.getLayout() == null) {
- return null;
- }
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
if (tile != null) {
@@ -3394,11 +3577,23 @@ public class Room implements Comparable, ISerialize, Runnable {
public double getTopHeightAt(int x, int y) {
HabboItem item = this.getTopItemAt(x, y);
- if (item != null) {
- return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0));
- } else {
+ if (item != null)
+ return (item.getZ() + Item.getCurrentHeight(item));
+ else
return this.layout.getHeightAtSquare(x, y);
+ }
+
+ @Deprecated
+ public HabboItem getLowestChair(int x, int y) {
+ if (this.layout == null) return null;
+
+ RoomTile tile = this.layout.getTile((short) x, (short) y);
+
+ if (tile != null) {
+ return this.getLowestChair(tile);
}
+
+ return null;
}
public HabboItem getLowestChair(RoomTile tile) {
@@ -3471,6 +3666,12 @@ public class Room implements Comparable, ISerialize, Runnable {
height = item.getZ() + (item.getBaseItem().allowSit() ? 0 : Item.getCurrentHeight(item));
}
+ /*HabboItem lowestChair = this.getLowestChair(x, y);
+ if (lowestChair != null && lowestChair != exclude) {
+ canStack = true;
+ height = lowestChair.getZ();
+ }*/
+
if (calculateHeightmap) {
return (canStack ? height * 256.0D : Short.MAX_VALUE);
}
@@ -3592,7 +3793,7 @@ public class Room implements Comparable, ISerialize, Runnable {
public Habbo getHabbo(String username) {
for (Habbo habbo : this.getHabbos()) {
- if (habbo.getHabboInfo().getUsername().equalsIgnoreCase(username) && !habbo.getHabboInfo().isInvisibleInRooms())
+ if (habbo.getHabboInfo().getUsername().equalsIgnoreCase(username))
return habbo;
}
return null;
@@ -3606,27 +3807,6 @@ public class Room implements Comparable, ISerialize, Runnable {
return null;
}
- public HorsePet getHabboHorse(final RoomUnit roomUnit) {
- final AtomicReference result = new AtomicReference<>();
-
- this.currentPets.forEachEntry((i, pet) -> {
- if (!(pet instanceof HorsePet)) {
- return true;
- }
-
- final HorsePet horsePet = (HorsePet) pet;
-
- if (horsePet.getRider() == null || horsePet.getRider().getRoomUnit() != roomUnit) {
- return true;
- }
-
- result.set((HorsePet) pet);
- return false;
- });
-
- return result.get();
- }
-
public Habbo getHabbo(int userId) {
return this.currentHabbos.get(userId);
}
@@ -3684,7 +3864,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -3703,13 +3883,13 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
public RoomRightLevels getGuildRightLevel(Habbo habbo) {
- if (this.guildId > 0 && habbo.getHabboStats().hasGuild(this.guildId)) {
- Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guildId);
+ if (this.guild > 0 && habbo.getHabboStats().hasGuild(this.guild)) {
+ Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guild);
if (Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(habbo.getHabboInfo().getId()) != null)
return RoomRightLevels.GUILD_ADMIN;
@@ -3754,7 +3934,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -3791,7 +3971,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(2, userId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -3814,7 +3994,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setInt(1, this.id);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.refreshRightsInRoom();
@@ -3874,7 +4054,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -3938,21 +4118,12 @@ public class Room implements Comparable, ISerialize, Runnable {
}
public void giveEffect(Habbo habbo, int effectId, int duration) {
- if (habbo != null && habbo.getRoomUnit() != null && this.currentHabbos.containsKey(habbo.getHabboInfo().getId())) {
- this.giveEffect(habbo.getRoomUnit(), effectId, duration, false);
+ if (this.currentHabbos.containsKey(habbo.getHabboInfo().getId())) {
+ this.giveEffect(habbo.getRoomUnit(), effectId, duration);
}
}
public void giveEffect(RoomUnit roomUnit, int effectId, int duration) {
- this.giveEffect(roomUnit, effectId, duration, false);
- }
-
- public void giveEffect(RoomUnit roomUnit, int effectId, int duration, boolean ignoreChecks) {
- if (roomUnit == null || roomUnit.getRoom() == null) return;
-
- Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
-
- if (roomUnit.getRoomUnitType() == RoomUnitType.USER && (habbo == null || habbo.getHabboInfo().isInGame() && !ignoreChecks)) { return; }
if (duration == -1 || duration == Integer.MAX_VALUE) {
duration = Integer.MAX_VALUE;
} else {
@@ -3975,15 +4146,16 @@ public class Room implements Comparable, ISerialize, Runnable {
}
public void updateItem(HabboItem item) {
- if (!this.isLoaded()) {
- return;
- }
- if (item != null && item.getRoomId() == this.id && item.getBaseItem() != null) {
- if (item.getBaseItem().getType() == FurnitureType.FLOOR) {
- this.sendComposer(new FloorItemUpdateComposer(item).compose());
- this.updateTiles(this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
- } else if (item.getBaseItem().getType() == FurnitureType.WALL) {
- this.sendComposer(new WallItemUpdateComposer(item).compose());
+ if (this.isLoaded()) {
+ if (item != null && item.getRoomId() == this.id) {
+ if (item.getBaseItem() != null) {
+ if (item.getBaseItem().getType() == FurnitureType.FLOOR) {
+ this.sendComposer(new FloorItemUpdateComposer(item).compose());
+ this.updateTiles(this.getLayout().getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
+ } else if (item.getBaseItem().getType() == FurnitureType.WALL) {
+ this.sendComposer(new WallItemUpdateComposer(item).compose());
+ }
+ }
}
}
}
@@ -4136,11 +4308,14 @@ public class Room implements Comparable, ISerialize, Runnable {
public void refreshGuildRightsInRoom() {
for (Habbo habbo : this.getHabbos()) {
- if ((habbo.getHabboInfo().getCurrentRoom() == this && habbo.getHabboInfo().getId() != this.ownerId)
- && (!(habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_MOVEROTATE))))
+ if (habbo.getHabboInfo().getCurrentRoom() == this) {
+ if (habbo.getHabboInfo().getId() != this.ownerId) {
+ if (!(habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_MOVEROTATE)))
this.refreshRightsForHabbo(habbo);
+ }
}
}
+ }
public void idle(Habbo habbo) {
habbo.getRoomUnit().setIdle();
@@ -4189,7 +4364,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setString(2, word);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
return;
}
@@ -4206,7 +4381,7 @@ public class Room implements Comparable, ISerialize, Runnable {
statement.setString(2, word);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -4268,7 +4443,7 @@ public class Room implements Comparable, ISerialize, Runnable {
this.hideWired = hideWired;
if (this.hideWired) {
-
+ ServerMessage response = null;
for (HabboItem item : this.roomSpecialTypes.getTriggers()) {
this.sendComposer(new RemoveFloorItemComposer(item).compose());
}
@@ -4472,7 +4647,7 @@ public class Room implements Comparable, ISerialize, Runnable {
boolean magicTile = item instanceof InteractionStackHelper;
- Optional stackHelper = this.getItemsAt(tile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
+ Optional stackHelper = this.getItemsAt(tile).stream().filter(i -> i instanceof InteractionStackHelper).findAny();
//Check if can be placed at new position
THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
@@ -4480,17 +4655,12 @@ public class Room implements Comparable, ISerialize, Runnable {
HabboItem topItem = this.getTopItemAt(occupiedTiles, null);
- if ((!stackHelper.isPresent() && !pluginHelper) || item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
+ if (!stackHelper.isPresent() && !pluginHelper) {
if (oldLocation != tile) {
for (RoomTile t : occupiedTiles) {
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
- if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) ||
- !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() ||
- (tileTopItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && (item.getBaseItem().getInteractionType().getType() != InteractionWaterItem.class ||
- item.getBaseItem().getInteractionType().getType() == InteractionWater.class))) : this.calculateTileState(t, item).equals(RoomTileState.INVALID)) ||
- stackHelper.isPresent() && item.getBaseItem().getInteractionType().getType() == InteractionWater.class)) {
+ if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
return FurnitureMovementError.CANT_STACK;
- }
if(!Emulator.getConfig().getBoolean("wired.place.under", false) || (Emulator.getConfig().getBoolean("wired.place.under", false) && !item.isWalkable() && !item.getBaseItem().allowSit() && !item.getBaseItem().allowLay())) {
if (checkForUnits) {
@@ -4512,10 +4682,7 @@ public class Room implements Comparable, ISerialize, Runnable {
}
}
- THashSet oldOccupiedTiles = new THashSet<>();
- if(oldLocation != null) {
- oldOccupiedTiles.addAll(this.layout.getTilesAt(oldLocation, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
- }
+ THashSet oldOccupiedTiles = this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
int oldRotation = item.getRotation();
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java
index 8cb79b7..3765175 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java
@@ -1,16 +1,18 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class RoomBan {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomBan.class);
+
public final int roomId;
public final int userId;
public final String username;
@@ -38,7 +40,7 @@ public class RoomBan {
statement.setInt(3, this.endTimestamp);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -49,7 +51,7 @@ public class RoomBan {
statement.setInt(2, this.userId);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
index d90d83a..6fc98bb 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
@@ -8,14 +8,11 @@ import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.Incoming;
import com.eu.habbo.messages.incoming.MessageHandler;
-import lombok.extern.slf4j.Slf4j;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
-
-@Slf4j
public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
private static final String QUERY = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)";
@@ -141,8 +138,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
try {
this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH - 1);
} catch (Exception e) {
- log.error("Caught exception", e);
- }
+ }
}
Emulator.getDatabaseLogger().store(this);
@@ -207,7 +203,6 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
message.appendInt(this.getMessage().length());
} catch (Exception e) {
- log.error("Caught exception", e);
}
}
@@ -230,7 +225,6 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
if (muteTime > 0) {
this.habbo.mute(muteTime, false);
} else {
- log.error("Invalid hotel.wordfilter.automute defined in emulator_settings ({}).", muteTime);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
index befeea8..31b7e90 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
@@ -46,15 +46,7 @@ public enum RoomChatMessageBubbles {
UNKNOWN_42(42, "", true, false),
UNKNOWN_43(43, "", true, false),
UNKNOWN_44(44, "", true, false),
- UNKNOWN_45(45, "", true, false),
- UNKNOWN_46(46, "", true, false),
- UNKNOWN_47(47, "", true, false),
- UNKNOWN_48(48, "", true, false),
- UNKNOWN_49(49, "", true, false),
- UNKNOWN_50(50, "", true, false),
- UNKNOWN_51(51, "", true, false),
- UNKNOWN_52(52, "", true, false),
- UNKNOWN_53(53, "", true, false);
+ UNKNOWN_45(45, "", true, false);
private final int type;
private final String permission;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
index 2c488d1..f70f3d3 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
@@ -2,7 +2,8 @@ package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.awt.*;
import java.sql.ResultSet;
@@ -12,8 +13,8 @@ import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
-@Slf4j
public class RoomLayout {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomLayout.class);
protected static final int BASICMOVEMENTCOST = 10;
protected static final int DIAGONALMOVEMENTCOST = 14;
public static double MAXIMUM_STEP_HEIGHT = 1.1;
@@ -44,7 +45,7 @@ public class RoomLayout {
this.parse();
} catch (Exception e) {
- log.error("Caught exception", e);
+ LOGGER.error("Caught exception", e);
}
}
@@ -274,12 +275,7 @@ public class RoomLayout {
RoomTile doorTile = this.room.getLayout().getDoorTile();
- long startMillis = System.currentTimeMillis();
-
while (!openList.isEmpty()) {
- if (System.currentTimeMillis() - startMillis > Emulator.getConfig().getInt("pathfinder.execution_time.milli", 25) && Emulator.getConfig().getBoolean("pathfinder.max_execution_time.enabled", false)) {
- return null;
- }
RoomTile current = this.lowestFInOpen(openList);
if (current.x == newTile.x && current.y == newTile.y) {
return this.calcPath(this.findTile(openList, oldTile.x, oldTile.y), current);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
index 3947d21..ab50771 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
@@ -48,20 +48,23 @@ import com.eu.habbo.plugin.events.rooms.UserVoteRoomEvent;
import com.eu.habbo.plugin.events.users.HabboAddedToRoomEvent;
import com.eu.habbo.plugin.events.users.UserEnterRoomEvent;
import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
+import com.eu.habbo.plugin.events.users.UsernameTalkEvent;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TIntProcedure;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
-@Slf4j
public class RoomManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomManager.class);
+
private static final int page = 0;
//Configuration. Loaded from database & updated accordingly.
public static int MAXIMUM_ROOMS_USER = 25;
@@ -91,7 +94,7 @@ public class RoomManager {
registerGameType(IceTagGame.class);
registerGameType(RollerskateGame.class);
- log.info("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ LOGGER.info("Room Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public void loadRoomModels() {
@@ -101,7 +104,7 @@ public class RoomManager {
this.mapNames.add(set.getString("name"));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -115,7 +118,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return layout;
@@ -129,7 +132,7 @@ public class RoomManager {
this.roomCategories.put(set.getInt("id"), new RoomCategory(set));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -145,14 +148,14 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
public THashMap> findRooms(NavigatorFilterField filterField, String value, int category, boolean showInvisible) {
THashMap> rooms = new THashMap<>();
String query = filterField.databaseQuery + " AND rooms.state NOT LIKE " + (showInvisible ? "''" : "'invisible'") + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + (page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + "" + ((page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE);
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) {
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) {
statement.setString(1, (filterField.comparator == NavigatorFilterComparator.EQUALS ? value : "%" + value + "%"));
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
@@ -171,7 +174,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -278,7 +281,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -291,10 +294,6 @@ public class RoomManager {
public Room loadRoom(int id, boolean loadData) {
Room room = null;
- if(id == 0) {
- return null;
- }
-
if (this.activeRooms.containsKey(id)) {
room = this.activeRooms.get(id);
@@ -323,7 +322,7 @@ public class RoomManager {
this.activeRooms.put(room.getId(), room);
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return room;
@@ -348,7 +347,7 @@ public class RoomManager {
room = this.loadRoom(set.getInt(1));
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return room;
@@ -373,7 +372,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -415,7 +414,7 @@ public class RoomManager {
public RoomLayout loadLayout(String name, Room room) {
RoomLayout layout = null;
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models WHERE name = ? LIMIT 1")) {
+ try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models WHERE name LIKE ? LIMIT 1")) {
statement.setString(1, name);
try (ResultSet set = statement.executeQuery()) {
if (set.next()) {
@@ -423,7 +422,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return layout;
@@ -457,7 +456,7 @@ public class RoomManager {
statement.setInt(2, room.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -627,7 +626,7 @@ public class RoomManager {
return;
}
- if (room.getUserCountWithoutInvisibleHabbos() >= room.getUsersMax() && !habbo.hasPermission(Permission.ACC_FULLROOMS) && !room.hasRights(habbo)) {
+ if (room.getUserCount() >= room.getUsersMax() && !habbo.hasPermission(Permission.ACC_FULLROOMS) && !room.hasRights(habbo)) {
habbo.getClient().sendResponse(new RoomEnterErrorComposer(RoomEnterErrorComposer.ROOM_ERROR_GUESTROOM_FULL));
return;
}
@@ -716,6 +715,7 @@ public class RoomManager {
habbo.getRoomUnit().setPathFinderRoom(room);
habbo.getRoomUnit().resetIdleTimer();
+ habbo.getRoomUnit().setInvisible(false);
room.addHabbo(habbo);
List habbos = new ArrayList<>();
@@ -730,19 +730,16 @@ public class RoomManager {
visibleHabbos = event.visibleHabbos;
}
- //
- if (!habbo.getHabboInfo().isInvisibleInRooms()) {
- for (Habbo habboToSendEnter : habbosToSendEnter) {
- GameClient client = habboToSendEnter.getClient();
- if (client != null) {
- client.sendResponse(new RoomUsersComposer(habbo).compose());
- client.sendResponse(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
- }
+ for (Habbo habboToSendEnter : habbosToSendEnter) {
+ GameClient client = habboToSendEnter.getClient();
+ if (client != null) {
+ client.sendResponse(new RoomUsersComposer(habbo).compose());
+ client.sendResponse(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
}
}
for (Habbo h : visibleHabbos) {
- if (!h.getHabboInfo().isInvisibleInRooms()) {
+ if (!h.getRoomUnit().isInvisible()) {
habbos.add(h);
}
}
@@ -934,7 +931,7 @@ public class RoomManager {
if (!habbo.getHabboStats().visitedRoom(room.getId()))
habbo.getHabboStats().addVisitRoom(room.getId());
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
@@ -987,7 +984,7 @@ public class RoomManager {
statement.setInt(3, room.getId());
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
}
}
@@ -1023,7 +1020,7 @@ public class RoomManager {
ArrayList rooms = new ArrayList<>();
for (Room room : this.activeRooms.values()) {
- if (room.getUserCountWithoutInvisibleHabbos() > 0) {
+ if (room.getUserCount() > 0) {
if (!room.isPublicRoom() || RoomManager.SHOW_PUBLIC_IN_POPULAR_TAB) rooms.add(room);
}
}
@@ -1059,7 +1056,7 @@ public class RoomManager {
Map> rooms = new HashMap<>();
for (Room room : this.activeRooms.values()) {
- if (!room.isPublicRoom() && room.getUserCount() > 0) { /* Changed do not show rooms that are empty */
+ if (!room.isPublicRoom()) {
if (!rooms.containsKey(room.getCategory())) {
rooms.put(room.getCategory(), new ArrayList<>());
}
@@ -1116,7 +1113,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -1176,7 +1173,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -1242,7 +1239,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
Collections.sort(rooms);
@@ -1288,7 +1285,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
Collections.sort(rooms);
@@ -1311,7 +1308,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -1325,10 +1322,6 @@ public class RoomManager {
if (friend == null || friend.getHabboInfo() == null) continue;
- if (friend.getHabboInfo().isInvisibleInRooms()) {
- continue;
- }
-
Room room = friend.getHabboInfo().getCurrentRoom();
if (room != null && !rooms.contains(room) && room.hasRights(habbo)) rooms.add(room);
@@ -1357,7 +1350,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -1379,7 +1372,7 @@ public class RoomManager {
}
}
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return rooms;
@@ -1483,7 +1476,7 @@ public class RoomManager {
this.activeRooms.clear();
- log.info("Room Manager -> Disposed!");
+ LOGGER.info("Room Manager -> Disposed!");
}
public CustomRoomLayout insertCustomLayout(Room room, String map, int doorX, int doorY, int doorDirection) {
@@ -1500,7 +1493,7 @@ public class RoomManager {
statement.setString(10, map);
statement.execute();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
return this.loadCustomLayout(room);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java
index 992db7f..f24e111 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomPromotion.java
@@ -1,15 +1,16 @@
package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator;
-import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-@Slf4j
public class RoomPromotion {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RoomPromotion.class);
private final Room room;
public boolean needsUpdate;
private String title;
@@ -45,7 +46,7 @@ public class RoomPromotion {
statement.setInt(4, this.room.getId());
statement.executeUpdate();
} catch (SQLException e) {
- log.error("Caught SQL exception", e);
+ LOGGER.error("Caught SQL exception", e);
}
this.needsUpdate = false;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java
index ff9667d..8a1a179 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java
@@ -44,7 +44,6 @@ public class RoomSpecialTypes {
private final THashMap> wiredEffects;
private final THashMap