Fix some wired

This commit is contained in:
DuckieTM 2024-04-05 23:43:25 +02:00
parent 2b5c57b1bc
commit ffd3f33917
327 changed files with 3251 additions and 3347 deletions

15
Emulator/.gitignore vendored
View File

@ -1,15 +0,0 @@
logging/
compiled-builds/
*.iml
.idea/
target/**
TODO.txt
packet.pkt
src/test/
target/
config.ini
*.txt
*.log
*.zip
.DS_Store

View File

@ -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

View File

@ -1,3 +0,0 @@
[submodule "morningstar-default-database"]
path = morningstar-default-database
url = https://git.krews.org/morningstar/morningstar-default-database

3
Emulator/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
Emulator/.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Habbo" />
</profile>
</annotationProcessing>
</component>
</project>

7
Emulator/.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

25
Emulator/.idea/jarRepositories.xml generated Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="central" />
<option name="url" value="https://repo1.maven.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="mvnrepo" />
<option name="name" value="mvnrepo" />
<option name="url" value="https://mvnrepository.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

12
Emulator/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK" />
</project>

View File

@ -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"]

View File

@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
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.

View File

@ -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
-

View File

@ -32,17 +32,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
@ -67,11 +67,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.2.0</version>
<configuration>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<additionalOptions><additionalOption>-Xdoclint:none</additionalOption></additionalOptions>
<show>public</show>
</configuration>
</plugin>
@ -94,28 +92,21 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.106.Final</version>
<version>4.1.49.Final</version>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.8.6</version>
</dependency>
<!-- MySQL Connector
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.1.4</version>
</dependency> -->
<!-- MySQL Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
<scope>runtime</scope>
</dependency>
@ -131,36 +122,14 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
<version>3.4.3</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>2.0.11</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<version>3.10</version>
<scope>compile</scope>
</dependency>
@ -174,27 +143,27 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
<version>1.13.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.7</version>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>2.4.1</version>
<version>1.18</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.12.6</version>
<version>2.10.6</version>
</dependency>
</dependencies>
</project>

View File

@ -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<String> 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;
}

View File

@ -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);
}
}
}

View File

@ -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();
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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<DatabaseLoggable> 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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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<String, ConsoleCommand> 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;
}

View File

@ -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");
}
}

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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.");
}
}

View File

@ -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() {

View File

@ -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;
}
}

View File

@ -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() {

View File

@ -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);
}
}

View File

@ -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<String, Achievement> 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) {

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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<String, Class<? extends Bot>> 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());
}
}
}

View File

@ -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<THashSet<String>, 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);
}
}

View File

@ -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<Integer, CalendarCampaign> 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);
}
}
}

View File

@ -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<CatalogItem> {
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<CatalogItem
private int amount;
private boolean allowGift = false;
private int limitedSells;
private String extradata;
private boolean clubOnly;
private boolean haveOffer;
private int offerId;
private boolean needsUpdate;
private int orderNumber;
private HashMap<Integer, Integer> bundle;
public CatalogItem(ResultSet set) throws SQLException {
@ -168,10 +183,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
return this.orderNumber;
}
public void setNeedsUpdate(boolean needsUpdate) {
this.needsUpdate = needsUpdate;
}
public synchronized void sellRare() {
this.limitedSells++;
@ -203,7 +214,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
identifier = Integer.parseInt(itemId);
} catch (Exception e) {
log.info("Invalid value (" + itemId + ") for items_base column for catalog_item id (" + this.id + "). Value must be integer or of the format of integer:amount;integer:amount");
LOGGER.info("Invalid value (" + itemId + ") for items_base column for catalog_item id (" + this.id + "). Value must be integer or of the format of integer:amount;integer:amount");
continue;
}
if (identifier > 0) {
@ -250,8 +261,8 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
}
} catch (Exception e) {
log.debug("Failed to load " + this.itemId);
log.error("Caught exception", e);
LOGGER.debug("Failed to load " + this.itemId);
LOGGER.error("Caught exception", e);
}
} else {
try {
@ -335,7 +346,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
statement.setInt(3, this.getId());
statement.execute();
} catch (SQLException e) {
log.error("Caught SQL exception", e);
LOGGER.error("Caught SQL exception", e);
}
this.needsUpdate = false;

View File

@ -3,7 +3,8 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
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.Connection;
import java.sql.PreparedStatement;
@ -11,8 +12,9 @@ import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedList;
@Slf4j
public class CatalogLimitedConfiguration implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogLimitedConfiguration.class);
private final int itemId;
private final LinkedList<Integer> 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);
}
}
}

View File

@ -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<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>(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<Integer, LinkedList<Integer>> 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 {

View File

@ -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<CatalogPage>, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPage.class);
protected final TIntArrayList offerIds = new TIntArrayList();
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
@ -72,8 +73,8 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, 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 + ")");
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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"));

View File

@ -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);
}
}
}

View File

@ -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<String, Command> commands = new THashMap<>(5);
private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() {
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!");
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}

View File

@ -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<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue();

View File

@ -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;

View File

@ -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());

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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);

View File

@ -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;

View File

@ -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 ? "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "</b>\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 ? "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "</b>\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<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);

View File

@ -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<Item, CraftingAltar> 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();

View File

@ -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<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
public final ConcurrentHashMap<Class<? extends MessageHandler>, 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);
}
}
}

View File

@ -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<GameTeamColors, GameTeam> 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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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<GuildPartType, THashMap<Integer, GuildPart>> guildParts;
private final TIntObjectMap<Guild> guilds;
private final THashSet<ForumView> 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);
}
}

View File

@ -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<Integer, THashSet<ForumThread>> guildThreadsCache = new THashMap<>();
private final static THashMap<Integer, ForumThread> 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);
}
}
}

View File

@ -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<Integer, ForumThreadComment> 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);
}
}
}

View File

@ -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<Integer, HallOfFameWinner> 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);
}
}
}

View File

@ -20,7 +20,7 @@ public class HallOfFameWinner implements Comparable<HallOfFameWinner> {
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");
}

View File

@ -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!");
}
}

View File

@ -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<NewsWidget> 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<NewsWidget> getNewsWidgets() {
return this.newsWidgets;
}
}
}

View File

@ -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);
}
}
}

View File

@ -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<String> getInteractionList() {

View File

@ -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;

View File

@ -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;
}
});

View File

@ -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<YoutubePlaylist> 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);
}
}

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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() + ")");
}
}

View File

@ -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());
}
}

View File

@ -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!");
}
}
}

View File

@ -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<RoomTile> 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);
}
}
}
}
}
}
}
}

View File

@ -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);
}
}

View File

@ -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 {
}

View File

@ -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);

View File

@ -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<Long,Long> 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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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<WiredHighscoreRow> 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)) {

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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<InteractionWiredHighscore> wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
final List<Integer> 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<InteractionWiredHighscore> wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
final List<Integer> 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<InteractionWiredHighscore> wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
final List<Integer> 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<InteractionWiredHighscore> wiredHighscores = room.getRoomSpecialTypes().getWiredHighscores();
final List<Integer> 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;
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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<HabboItem> 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<Integer> itemIds;
public JsonData(boolean all, List<Integer> itemIds) {
this.all = all;
public JsonData(List<Integer> itemIds) {
this.itemIds = itemIds;
}
}

View File

@ -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]));
}
}

Some files were not shown because too many files have changed in this diff Show More