Merge branch 'main' of https://github.com/duckietm/Arcturus-Morningstar-Extended
This commit is contained in:
commit
f189ce5d9f
2
Emulator/.gitignore → .gitignore
vendored
2
Emulator/.gitignore → .gitignore
vendored
@ -5,10 +5,12 @@ compiled-builds/
|
|||||||
target/**
|
target/**
|
||||||
TODO.txt
|
TODO.txt
|
||||||
packet.pkt
|
packet.pkt
|
||||||
|
plugins/**
|
||||||
src/test/
|
src/test/
|
||||||
target/
|
target/
|
||||||
config.ini
|
config.ini
|
||||||
*.txt
|
*.txt
|
||||||
|
*.jar
|
||||||
*.log
|
*.log
|
||||||
*.zip
|
*.zip
|
||||||
.DS_Store
|
.DS_Store
|
@ -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
|
|
||||||
|
|
3
Emulator/.gitmodules
vendored
3
Emulator/.gitmodules
vendored
@ -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
3
Emulator/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
13
Emulator/.idea/compiler.xml
generated
Normal file
13
Emulator/.idea/compiler.xml
generated
Normal 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
7
Emulator/.idea/encodings.xml
generated
Normal 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
25
Emulator/.idea/jarRepositories.xml
generated
Normal 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
12
Emulator/.idea/misc.xml
generated
Normal 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>
|
@ -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"]
|
|
165
Emulator/LICENSE
165
Emulator/LICENSE
@ -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.
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-
|
|
@ -32,17 +32,17 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.12.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>16</source>
|
<source>1.8</source>
|
||||||
<target>16</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.3.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
@ -67,11 +67,9 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<additionalOptions>
|
<additionalOptions><additionalOption>-Xdoclint:none</additionalOption></additionalOptions>
|
||||||
<additionalOption>-Xdoclint:none</additionalOption>
|
|
||||||
</additionalOptions>
|
|
||||||
<show>public</show>
|
<show>public</show>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
@ -94,28 +92,21 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-all</artifactId>
|
<artifactId>netty-all</artifactId>
|
||||||
<version>4.1.106.Final</version>
|
<version>4.1.49.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- GSON -->
|
<!-- GSON -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.10.1</version>
|
<version>2.8.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MySQL Connector
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mariadb.jdbc</groupId>
|
|
||||||
<artifactId>mariadb-java-client</artifactId>
|
|
||||||
<version>3.1.4</version>
|
|
||||||
</dependency> -->
|
|
||||||
|
|
||||||
<!-- MySQL Connector -->
|
<!-- MySQL Connector -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.3.0</version>
|
<version>8.0.22</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -131,36 +122,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>5.1.0</version>
|
<version>3.4.3</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.14.0</version>
|
<version>3.10</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -174,27 +143,27 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.17.2</version>
|
<version>1.13.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>1.4.7</version>
|
<version>1.2.3</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.fusesource.jansi</groupId>
|
<groupId>org.fusesource.jansi</groupId>
|
||||||
<artifactId>jansi</artifactId>
|
<artifactId>jansi</artifactId>
|
||||||
<version>2.4.1</version>
|
<version>1.18</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>joda-time</groupId>
|
<groupId>joda-time</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>2.12.6</version>
|
<version>2.10.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -17,8 +17,6 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
|
|||||||
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
|
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
|
||||||
import com.eu.habbo.threading.ThreadPooling;
|
import com.eu.habbo.threading.ThreadPooling;
|
||||||
import com.eu.habbo.util.imager.badges.BadgeImager;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -28,16 +26,15 @@ import java.sql.Timestamp;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public final class Emulator {
|
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 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 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 MAJOR = 3;
|
||||||
public final static int MINOR = 6;
|
public final static int MINOR = 6;
|
||||||
public final static int BUILD = 0;
|
public final static int BUILD = 0;
|
||||||
@ -52,11 +49,9 @@ public final class Emulator {
|
|||||||
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
|
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
|
||||||
"██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
|
"██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
|
||||||
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" +
|
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" +
|
||||||
" Extended version";
|
"Still Rocking in 2024.\n";
|
||||||
|
|
||||||
|
|
||||||
public static String build = "";
|
public static String build = "";
|
||||||
public static String debuglevel = "";
|
|
||||||
public static boolean isReady = false;
|
public static boolean isReady = false;
|
||||||
public static boolean isShuttingDown = false;
|
public static boolean isShuttingDown = false;
|
||||||
public static boolean stopped = false;
|
public static boolean stopped = false;
|
||||||
@ -76,7 +71,6 @@ public final class Emulator {
|
|||||||
private static GameEnvironment gameEnvironment;
|
private static GameEnvironment gameEnvironment;
|
||||||
private static PluginManager pluginManager;
|
private static PluginManager pluginManager;
|
||||||
private static BadgeImager badgeImager;
|
private static BadgeImager badgeImager;
|
||||||
public static final AttributeKey<String> WS_IP = AttributeKey.valueOf("WS_IP");
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Thread hook = new Thread(new Runnable() {
|
Thread hook = new Thread(new Runnable() {
|
||||||
@ -88,6 +82,13 @@ public final class Emulator {
|
|||||||
Runtime.getRuntime().addShutdownHook(hook);
|
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 {
|
public static void main(String[] args) throws Exception {
|
||||||
try {
|
try {
|
||||||
// Check if running on Windows and not in IntelliJ.
|
// Check if running on Windows and not in IntelliJ.
|
||||||
@ -109,8 +110,18 @@ public final class Emulator {
|
|||||||
|
|
||||||
System.out.println(logo);
|
System.out.println(logo);
|
||||||
|
|
||||||
log.info("Version: {}", version);
|
// Checks if this is a BETA build before allowing them to continue.
|
||||||
log.info("Build: {}", build);
|
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();
|
||||||
|
}
|
||||||
|
System.out.println("");
|
||||||
|
LOGGER.warn("Arcturus Morningstar 3.x is no longer accepting merge requests. Please target MS4 branches if you wish to contribute.");
|
||||||
|
LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community, ");
|
||||||
|
System.out.println("");
|
||||||
|
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);
|
||||||
|
|
||||||
long startTime = System.nanoTime();
|
long startTime = System.nanoTime();
|
||||||
|
|
||||||
@ -143,22 +154,16 @@ public final class Emulator {
|
|||||||
Emulator.rconServer.connect();
|
Emulator.rconServer.connect();
|
||||||
Emulator.badgeImager = new BadgeImager();
|
Emulator.badgeImager = new BadgeImager();
|
||||||
|
|
||||||
log.info("Arcturus Morningstar has successfully loaded.");
|
LOGGER.info("Arcturus Morningstar has successfully loaded.");
|
||||||
log.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
|
LOGGER.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("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
|
||||||
|
|
||||||
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
|
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) {
|
if (debugging) {
|
||||||
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
||||||
root.setLevel(Level.DEBUG);
|
root.setLevel(Level.DEBUG);
|
||||||
log.debug("Debugging enabled.");
|
LOGGER.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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
|
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
|
||||||
@ -166,7 +171,7 @@ public final class Emulator {
|
|||||||
Emulator.timeStarted = getIntUnixTimestamp();
|
Emulator.timeStarted = getIntUnixTimestamp();
|
||||||
|
|
||||||
if (Emulator.getConfig().getInt("runtime.threads") < (Runtime.getRuntime().availableProcessors() * 2)) {
|
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"),
|
Emulator.getConfig().getInt("runtime.threads"),
|
||||||
Runtime.getRuntime().availableProcessors() * 2);
|
Runtime.getRuntime().availableProcessors() * 2);
|
||||||
}
|
}
|
||||||
@ -189,7 +194,7 @@ public final class Emulator {
|
|||||||
System.out.println("Waiting for command: ");
|
System.out.println("Waiting for command: ");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) {
|
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 +236,7 @@ public final class Emulator {
|
|||||||
Emulator.isShuttingDown = true;
|
Emulator.isShuttingDown = true;
|
||||||
Emulator.isReady = false;
|
Emulator.isReady = false;
|
||||||
|
|
||||||
log.info("Stopping Arcturus Morningstar {}", version);
|
LOGGER.info("Stopping Arcturus Morningstar {}", version);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Emulator.getPluginManager() != null)
|
if (Emulator.getPluginManager() != null)
|
||||||
@ -282,7 +287,7 @@ public final class Emulator {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Stopped Arcturus Morningstar {}", version);
|
LOGGER.info("Stopped Arcturus Morningstar {}", version);
|
||||||
|
|
||||||
if (Emulator.database != null) {
|
if (Emulator.database != null) {
|
||||||
Emulator.getDatabase().dispose();
|
Emulator.getDatabase().dispose();
|
||||||
@ -332,6 +337,9 @@ public final class Emulator {
|
|||||||
return rconServer;
|
return rconServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Logging getLogging() {
|
public static Logging getLogging() {
|
||||||
return logging;
|
return logging;
|
||||||
@ -353,10 +361,6 @@ public final class Emulator {
|
|||||||
return ThreadLocalRandom.current();
|
return ThreadLocalRandom.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SecureRandom getRandomDice() {
|
|
||||||
return secureRandom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BadgeImager getBadgeImager() {
|
public static BadgeImager getBadgeImager() {
|
||||||
return badgeImager;
|
return badgeImager;
|
||||||
}
|
}
|
||||||
@ -456,7 +460,7 @@ public final class Emulator {
|
|||||||
try {
|
try {
|
||||||
res = format.parse(date);
|
res = format.parse(date);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error parsing date", e);
|
LOGGER.error("Error parsing date", e);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -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.incoming.navigator.SearchRoomsEvent;
|
||||||
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
|
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
|
||||||
import com.eu.habbo.threading.runnables.AchievementUpdater;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -15,15 +16,17 @@ import java.sql.SQLException;
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CleanerThread implements Runnable {
|
public class CleanerThread implements Runnable {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class);
|
||||||
|
|
||||||
private static final int DELAY = 10000;
|
private static final int DELAY = 10000;
|
||||||
private static final int RELOAD_HALL_OF_FAME = 1800;
|
private static final int RELOAD_HALL_OF_FAME = 1800;
|
||||||
private static final int RELOAD_NEWS_LIST = 3600;
|
private static final int RELOAD_NEWS_LIST = 3600;
|
||||||
private static final int REMOVE_INACTIVE_ROOMS = 120;
|
private static final int REMOVE_INACTIVE_ROOMS = 120;
|
||||||
private static final int REMOVE_INACTIVE_GUILDS = 60;
|
private static final int REMOVE_INACTIVE_GUILDS = 60;
|
||||||
private static final int REMOVE_INACTIVE_TOURS = 600;
|
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 CLEAR_CACHED_VALUES = 60 * 60;
|
||||||
private static final int CALLBACK_TIME = 60 * 15;
|
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_ROOMS_CLEARED = Emulator.getIntUnixTimestamp();
|
||||||
private static int LAST_INACTIVE_GUILDS_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_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_DAILY_REFILL = Emulator.getIntUnixTimestamp();
|
||||||
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
|
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
|
||||||
private static int LAST_HABBO_CACHE_CLEARED = 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;
|
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) {
|
if (time - LAST_CALLBACK > CALLBACK_TIME) {
|
||||||
// Emulator.getThreading().run(new HTTPPostStatus());
|
// Emulator.getThreading().run(new HTTPPostStatus());
|
||||||
LAST_CALLBACK = time;
|
LAST_CALLBACK = time;
|
||||||
@ -119,10 +128,10 @@ public class CleanerThread implements Runnable {
|
|||||||
statement.execute("DELETE FROM users_effects WHERE total <= 0");
|
statement.execute("DELETE FROM users_effects WHERE total <= 0");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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() {
|
public void refillDailyRespects() {
|
||||||
@ -131,7 +140,7 @@ public class CleanerThread implements Runnable {
|
|||||||
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
|
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.isReady) {
|
if (Emulator.isReady) {
|
||||||
@ -153,7 +162,7 @@ public class CleanerThread implements Runnable {
|
|||||||
habbo.clearCaches();
|
habbo.clearCaches();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ public class CommandLog implements DatabaseLoggable {
|
|||||||
private final int timestamp = Emulator.getIntUnixTimestamp();
|
private final int timestamp = Emulator.getIntUnixTimestamp();
|
||||||
private final Command command;
|
private final Command command;
|
||||||
private final String params;
|
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.userId = userId;
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.success = success;
|
this.succes = succes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,7 +34,7 @@ public class CommandLog implements DatabaseLoggable {
|
|||||||
statement.setInt(2, this.timestamp);
|
statement.setInt(2, this.timestamp);
|
||||||
statement.setString(3, this.command.getClass().getSimpleName());
|
statement.setString(3, this.command.getClass().getSimpleName());
|
||||||
statement.setString(4, this.params);
|
statement.setString(4, this.params);
|
||||||
statement.setString(5, this.success ? "yes" : "no");
|
statement.setString(5, this.succes ? "yes" : "no");
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ package com.eu.habbo.core;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
|
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -13,9 +14,10 @@ import java.sql.*;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ConfigurationManager {
|
public class ConfigurationManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationManager.class);
|
||||||
|
|
||||||
private final Properties properties;
|
private final Properties properties;
|
||||||
private final String configurationPath;
|
private final String configurationPath;
|
||||||
public boolean loaded = false;
|
public boolean loaded = false;
|
||||||
@ -49,7 +51,7 @@ public class ConfigurationManager {
|
|||||||
this.properties.load(input);
|
this.properties.load(input);
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
log.error("Failed to load config file.", ex);
|
LOGGER.error("Failed to load config file.", ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
@ -90,7 +92,7 @@ public class ConfigurationManager {
|
|||||||
String envValue = System.getenv(entry.getValue());
|
String envValue = System.getenv(entry.getValue());
|
||||||
|
|
||||||
if (envValue == null || envValue.length() == 0) {
|
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 {
|
} else {
|
||||||
this.properties.setProperty(entry.getKey(), envValue);
|
this.properties.setProperty(entry.getKey(), envValue);
|
||||||
}
|
}
|
||||||
@ -102,7 +104,7 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
log.info("Configuration Manager -> Loaded!");
|
LOGGER.info("Configuration Manager -> Loaded!");
|
||||||
|
|
||||||
if (Emulator.getPluginManager() != null) {
|
if (Emulator.getPluginManager() != null) {
|
||||||
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
|
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
|
||||||
@ -110,7 +112,7 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadFromDatabase() {
|
public void loadFromDatabase() {
|
||||||
log.info("Loading configuration from database...");
|
LOGGER.info("Loading configuration from database...");
|
||||||
|
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
|
||||||
@ -122,10 +124,10 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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() {
|
public void saveToDatabase() {
|
||||||
@ -136,7 +138,7 @@ public class ConfigurationManager {
|
|||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +153,7 @@ public class ConfigurationManager {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
||||||
if (!this.properties.containsKey(key)) {
|
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);
|
return this.properties.getProperty(key, defaultValue);
|
||||||
}
|
}
|
||||||
@ -167,7 +169,7 @@ public class ConfigurationManager {
|
|||||||
try {
|
try {
|
||||||
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
|
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
|
||||||
} catch (Exception e) {
|
} 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;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -183,7 +185,7 @@ public class ConfigurationManager {
|
|||||||
try {
|
try {
|
||||||
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
|
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
|
||||||
} catch (Exception e) {
|
} 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;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -199,7 +201,7 @@ public class ConfigurationManager {
|
|||||||
try {
|
try {
|
||||||
return Double.parseDouble(this.getValue(key, defaultValue.toString()));
|
return Double.parseDouble(this.getValue(key, defaultValue.toString()));
|
||||||
} catch (Exception e) {
|
} 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;
|
return defaultValue;
|
||||||
@ -218,7 +220,7 @@ public class ConfigurationManager {
|
|||||||
statement.setString(2, value);
|
statement.setString(2, value);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update(key, value);
|
this.update(key, value);
|
||||||
|
@ -2,11 +2,15 @@ package com.eu.habbo.core;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CreditsScheduler extends Scheduler {
|
public class CreditsScheduler extends Scheduler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class);
|
||||||
|
|
||||||
public static boolean IGNORE_HOTEL_VIEW;
|
public static boolean IGNORE_HOTEL_VIEW;
|
||||||
public static boolean IGNORE_IDLED;
|
public static boolean IGNORE_IDLED;
|
||||||
public static double HC_MODIFIER;
|
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)));
|
habbo.giveCredits((int)(habbo.getHabboInfo().getRank().getCreditsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,46 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class DatabaseLogger {
|
public class DatabaseLogger {
|
||||||
|
|
||||||
public void store(final DatabaseLoggable loggable) {
|
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class);
|
||||||
Emulator.getThreading().run(() -> {
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
|
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())) {
|
try (PreparedStatement statement = connection.prepareStatement(loggable.getQuery())) {
|
||||||
loggable.log(statement);
|
loggable.log(statement);
|
||||||
statement.executeBatch();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ErrorLog implements DatabaseLoggable {
|
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 (?, ?, ?, ?, ?)";
|
private static final String QUERY = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
public final String version;
|
public final String version;
|
||||||
public final String buildHash;
|
public final String buildHash;
|
||||||
|
|
||||||
public final int timeStamp;
|
public final int timeStamp;
|
||||||
public final String type;
|
public final String type;
|
||||||
public final String stackTrace;
|
public final String stackTrace;
|
||||||
@ -33,7 +38,7 @@ public class ErrorLog implements DatabaseLoggable {
|
|||||||
pw.close();
|
pw.close();
|
||||||
sw.close();
|
sw.close();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
log.error("Exception caught", e1);
|
LOGGER.error("Exception caught", e1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,15 @@ package com.eu.habbo.core;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class GotwPointsScheduler extends Scheduler {
|
public class GotwPointsScheduler extends Scheduler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class);
|
||||||
|
|
||||||
public static boolean IGNORE_HOTEL_VIEW;
|
public static boolean IGNORE_HOTEL_VIEW;
|
||||||
public static boolean IGNORE_IDLED;
|
public static boolean IGNORE_IDLED;
|
||||||
public static String GOTW_POINTS_NAME;
|
public static String GOTW_POINTS_NAME;
|
||||||
@ -64,7 +68,7 @@ public class GotwPointsScheduler extends Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,63 +1,97 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Logging {
|
public class Logging {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void logStart(Object line) {
|
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
|
@Deprecated
|
||||||
public void logShutdownLine(Object line) {
|
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
|
@Deprecated
|
||||||
public void logUserLine(Object line) {
|
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
|
@Deprecated
|
||||||
public void logDebugLine(Object line) {
|
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
|
@Deprecated
|
||||||
public void logPacketLine(Object line) {
|
public void logPacketLine(Object line) {
|
||||||
if (Emulator.getConfig().getBoolean("debug.show.packets")) {
|
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
|
@Deprecated
|
||||||
public void logUndefinedPacketLine(Object line) {
|
public void logUndefinedPacketLine(Object line) {
|
||||||
if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) {
|
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
|
@Deprecated
|
||||||
public void logErrorLine(Object line) {
|
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
|
@Deprecated
|
||||||
public void logSQLException(SQLException e) {
|
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
|
@Deprecated
|
||||||
public void logPacketError(Object e) {
|
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
|
@Deprecated
|
||||||
public void handleException(Exception e) {
|
public void handleException(Exception e) {
|
||||||
log.error("[ERROR] Exception", e);
|
LOGGER.error("[ERROR] Exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,15 @@ package com.eu.habbo.core;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class PixelScheduler extends Scheduler {
|
public class PixelScheduler extends Scheduler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(PixelScheduler.class);
|
||||||
|
|
||||||
public static boolean IGNORE_HOTEL_VIEW;
|
public static boolean IGNORE_HOTEL_VIEW;
|
||||||
public static boolean IGNORE_IDLED;
|
public static boolean IGNORE_IDLED;
|
||||||
public static double HC_MODIFIER;
|
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)));
|
habbo.givePixels((int)(habbo.getHabboInfo().getRank().getPixelsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,15 @@ package com.eu.habbo.core;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class PointsScheduler extends Scheduler {
|
public class PointsScheduler extends Scheduler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(PointsScheduler.class);
|
||||||
|
|
||||||
public static boolean IGNORE_HOTEL_VIEW;
|
public static boolean IGNORE_HOTEL_VIEW;
|
||||||
public static boolean IGNORE_IDLED;
|
public static boolean IGNORE_IDLED;
|
||||||
public static double HC_MODIFIER;
|
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)));
|
habbo.givePoints((int)(habbo.getHabboInfo().getRank().getDiamondsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class TextsManager {
|
public class TextsManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(TextsManager.class);
|
||||||
|
|
||||||
private final Properties texts;
|
private final Properties texts;
|
||||||
|
|
||||||
public TextsManager() {
|
public TextsManager() {
|
||||||
@ -19,7 +21,7 @@ public class TextsManager {
|
|||||||
try {
|
try {
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
||||||
log.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -35,7 +37,7 @@ public class TextsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
public String getValue(String key, String defaultValue) {
|
||||||
if (!this.texts.containsKey(key)) {
|
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);
|
return this.texts.getProperty(key, defaultValue);
|
||||||
}
|
}
|
||||||
@ -58,7 +60,7 @@ public class TextsManager {
|
|||||||
try {
|
try {
|
||||||
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
|
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -71,7 +73,7 @@ public class TextsManager {
|
|||||||
try {
|
try {
|
||||||
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
|
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -89,7 +91,7 @@ public class TextsManager {
|
|||||||
statement.setString(2, value);
|
statement.setString(2, value);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update(key, value);
|
this.update(key, value);
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public abstract class ConsoleCommand {
|
public abstract class ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class);
|
||||||
private static final THashMap<String, ConsoleCommand> commands = new THashMap<>();
|
private static final THashMap<String, ConsoleCommand> commands = new THashMap<>();
|
||||||
|
|
||||||
public final String key;
|
public final String key;
|
||||||
@ -44,19 +45,21 @@ public abstract class ConsoleCommand {
|
|||||||
command.handle(message);
|
command.handle(message);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.info("Unknown Console Command " + message[0]);
|
LOGGER.info("Unknown Console Command " + message[0]);
|
||||||
log.info("Commands Available (" + commands.size() + "): ");
|
LOGGER.info("Commands Available (" + commands.size() + "): ");
|
||||||
|
|
||||||
for (ConsoleCommand c : commands.values()) {
|
for (ConsoleCommand c : commands.values()) {
|
||||||
log.info(c.key + " - " + c.usage);
|
LOGGER.info(c.key + " - " + c.usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void handle(String[] args) throws Exception;
|
public abstract void handle(String[] args) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
@ -2,12 +2,14 @@ package com.eu.habbo.core.consolecommands;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.catalog.CatalogManager;
|
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;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ConsoleInfoCommand extends ConsoleCommand {
|
public class ConsoleInfoCommand extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class);
|
||||||
|
|
||||||
public ConsoleInfoCommand() {
|
public ConsoleInfoCommand() {
|
||||||
super("info", "Show current statistics.");
|
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 minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
||||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
||||||
|
|
||||||
log.info("Emulator version: " + Emulator.version);
|
LOGGER.info("Emulator version: " + Emulator.version);
|
||||||
log.info("Emulator build: " + Emulator.build);
|
LOGGER.info("Emulator build: " + Emulator.build);
|
||||||
|
|
||||||
log.info("");
|
LOGGER.info("");
|
||||||
|
|
||||||
log.info("Hotel Statistics");
|
LOGGER.info("Hotel Statistics");
|
||||||
log.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
|
LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
|
||||||
log.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
|
LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
|
||||||
log.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
|
LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
|
||||||
log.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
|
LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
|
||||||
log.info("");
|
LOGGER.info("");
|
||||||
log.info("Server Statistics");
|
LOGGER.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!"));
|
LOGGER.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");
|
LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
|
||||||
log.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
|
LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
|
||||||
log.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
|
LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,17 +1,19 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import com.eu.habbo.networking.camera.CameraClient;
|
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 {
|
public class ConsoleReconnectCameraCommand extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class);
|
||||||
|
|
||||||
public ConsoleReconnectCameraCommand() {
|
public ConsoleReconnectCameraCommand() {
|
||||||
super("camera", "Attempt to reconnect to the camera server.");
|
super("camera", "Attempt to reconnect to the camera server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
log.info("Connecting to the camera...");
|
LOGGER.info("Connecting to the camera...");
|
||||||
CameraClient.attemptReconnect = true;
|
CameraClient.attemptReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,14 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
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 {
|
public class ConsoleTestCommand extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class);
|
||||||
|
|
||||||
public ConsoleTestCommand() {
|
public ConsoleTestCommand() {
|
||||||
super("test", "This is just a test.");
|
super("test", "This is just a test.");
|
||||||
}
|
}
|
||||||
@ -13,7 +16,9 @@ public class ConsoleTestCommand extends ConsoleCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
if (Emulator.debugging) {
|
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);
|
//AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30);
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(1);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(1);
|
||||||
habbo.getHabboInfo().getMachineID();
|
habbo.getHabboInfo().getMachineID();
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ShowInteractionsCommand extends ConsoleCommand {
|
public class ShowInteractionsCommand extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class);
|
||||||
|
|
||||||
public ShowInteractionsCommand() {
|
public ShowInteractionsCommand() {
|
||||||
super("interactions", "Show a list of available furniture interactions.");
|
super("interactions", "Show a list of available furniture interactions.");
|
||||||
}
|
}
|
||||||
@ -13,7 +14,7 @@ public class ShowInteractionsCommand extends ConsoleCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) {
|
for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) {
|
||||||
log.info(interaction);
|
LOGGER.info(interaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,11 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ShowRCONCommands extends ConsoleCommand {
|
public class ShowRCONCommands extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class);
|
||||||
|
|
||||||
public ShowRCONCommands() {
|
public ShowRCONCommands() {
|
||||||
super("rconcommands", "Show a list of all RCON commands");
|
super("rconcommands", "Show a list of all RCON commands");
|
||||||
@ -13,7 +14,7 @@ public class ShowRCONCommands extends ConsoleCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
for (String command : Emulator.getRconServer().getCommands()) {
|
for (String command : Emulator.getRconServer().getCommands()) {
|
||||||
log.info(command);
|
LOGGER.info(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
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 {
|
public class ThankyouArcturusCommand extends ConsoleCommand {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ThankyouArcturusCommand.class);
|
||||||
|
|
||||||
public ThankyouArcturusCommand() {
|
public ThankyouArcturusCommand() {
|
||||||
super("thankyou", "A thankyou message.");
|
super("thankyou", "A thankyou message.");
|
||||||
@ -12,31 +13,31 @@ public class ThankyouArcturusCommand extends ConsoleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
log.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
|
LOGGER.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:");
|
LOGGER.info("Thankyou to the following people who have helped with it's development:");
|
||||||
log.info("TheGeneral - For Creating Arcturus.");
|
LOGGER.info("TheGeneral - For Creating Arcturus.");
|
||||||
log.info("Capheus - Decompilation");
|
LOGGER.info("Capheus - Decompilation");
|
||||||
log.info("Beny - Lead Developer");
|
LOGGER.info("Beny - Lead Developer");
|
||||||
log.info("Alejandro - Lead Developer");
|
LOGGER.info("Alejandro - Lead Developer");
|
||||||
log.info("Harmonic - Developer");
|
LOGGER.info("Harmonic - Developer");
|
||||||
log.info("ArpyAge - Developer");
|
LOGGER.info("ArpyAge - Developer");
|
||||||
log.info("Mike - Developer");
|
LOGGER.info("Mike - Developer");
|
||||||
log.info("Skeletor - Developer");
|
LOGGER.info("Skeletor - Developer");
|
||||||
log.info("zGrav - Developer");
|
LOGGER.info("zGrav - Developer");
|
||||||
log.info("Swirny - Developer");
|
LOGGER.info("Swirny - Developer");
|
||||||
log.info("Quadral - Developer");
|
LOGGER.info("Quadral - Developer");
|
||||||
log.info("Dome - Developer");
|
LOGGER.info("Dome - Developer");
|
||||||
log.info("Necmi - Developer");
|
LOGGER.info("Necmi - Developer");
|
||||||
log.info("Oliver - Support");
|
LOGGER.info("Oliver - Support");
|
||||||
log.info("Rasmus - Support");
|
LOGGER.info("Rasmus - Support");
|
||||||
log.info("Layne - Support");
|
LOGGER.info("Layne - Support");
|
||||||
log.info("Bill - Support");
|
LOGGER.info("Bill - Support");
|
||||||
log.info("Harmony - Support");
|
LOGGER.info("Harmony - Support");
|
||||||
log.info("Ridge - Catalogue");
|
LOGGER.info("Ridge - Catalogue");
|
||||||
log.info("Tenshie - Catalogue");
|
LOGGER.info("Tenshie - Catalogue");
|
||||||
log.info("Wulles - Catalogue");
|
LOGGER.info("Wulles - Catalogue");
|
||||||
log.info("Gizmo - Catalogue");
|
LOGGER.info("Gizmo - Catalogue");
|
||||||
log.info("TheJava - Motivation");
|
LOGGER.info("TheJava - Motivation");
|
||||||
log.info("The Entire Krews.org Community.");
|
LOGGER.info("The Entire Krews.org Community.");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,9 @@ import com.eu.habbo.core.ConfigurationManager;
|
|||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -13,8 +15,10 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Database {
|
public class Database {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Database.class);
|
||||||
|
|
||||||
private HikariDataSource dataSource;
|
private HikariDataSource dataSource;
|
||||||
private DatabasePool databasePool;
|
private DatabasePool databasePool;
|
||||||
|
|
||||||
@ -26,21 +30,21 @@ public class Database {
|
|||||||
try {
|
try {
|
||||||
this.databasePool = new DatabasePool();
|
this.databasePool = new DatabasePool();
|
||||||
if (!this.databasePool.getStoragePooling(config)) {
|
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;
|
SQLException = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dataSource = this.databasePool.getDatabase();
|
this.dataSource = this.databasePool.getDatabase();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SQLException = true;
|
SQLException = true;
|
||||||
log.error("Failed to connect to your database.", e);
|
LOGGER.error("Failed to connect to your database.", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (SQLException) {
|
if (SQLException) {
|
||||||
Emulator.prepareShutdown();
|
Emulator.prepareShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -3,10 +3,11 @@ package com.eu.habbo.database;
|
|||||||
import com.eu.habbo.core.ConfigurationManager;
|
import com.eu.habbo.core.ConfigurationManager;
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
class DatabasePool {
|
class DatabasePool {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(DatabasePool.class);
|
||||||
private static final String DB_POOL_MAX_SIZE = "db.pool.maxsize";
|
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_POOL_MIN_SIZE = "db.pool.minsize";
|
||||||
private static final String DB_HOSTNAME_KEY = "db.hostname";
|
private static final String DB_HOSTNAME_KEY = "db.hostname";
|
||||||
|
@ -23,10 +23,13 @@ import com.eu.habbo.habbohotel.rooms.RoomManager;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionManager;
|
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionManager;
|
||||||
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionScheduler;
|
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 {
|
public class GameEnvironment {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class);
|
||||||
|
|
||||||
public CreditsScheduler creditsScheduler;
|
public CreditsScheduler creditsScheduler;
|
||||||
public PixelScheduler pixelScheduler;
|
public PixelScheduler pixelScheduler;
|
||||||
public PointsScheduler pointsScheduler;
|
public PointsScheduler pointsScheduler;
|
||||||
@ -55,7 +58,7 @@ public class GameEnvironment {
|
|||||||
private CalendarManager calendarManager;
|
private CalendarManager calendarManager;
|
||||||
|
|
||||||
public void load() throws Exception {
|
public void load() throws Exception {
|
||||||
log.info("GameEnvironment -> Loading...");
|
LOGGER.info("GameEnvironment -> Loading...");
|
||||||
|
|
||||||
this.permissionsManager = new PermissionsManager();
|
this.permissionsManager = new PermissionsManager();
|
||||||
this.habboManager = new HabboManager();
|
this.habboManager = new HabboManager();
|
||||||
@ -97,7 +100,7 @@ public class GameEnvironment {
|
|||||||
this.subscriptionScheduler = new SubscriptionScheduler();
|
this.subscriptionScheduler = new SubscriptionScheduler();
|
||||||
Emulator.getThreading().run(this.subscriptionScheduler);
|
Emulator.getThreading().run(this.subscriptionScheduler);
|
||||||
|
|
||||||
log.info("GameEnvironment -> Loaded!");
|
LOGGER.info("GameEnvironment -> Loaded!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -115,7 +118,7 @@ public class GameEnvironment {
|
|||||||
this.hotelViewManager.dispose();
|
this.hotelViewManager.dispose();
|
||||||
this.subscriptionManager.dispose();
|
this.subscriptionManager.dispose();
|
||||||
this.calendarManager.dispose();
|
this.calendarManager.dispose();
|
||||||
log.info("GameEnvironment -> Disposed!");
|
LOGGER.info("GameEnvironment -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public HabboManager getHabboManager() {
|
public HabboManager getHabboManager() {
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -18,14 +18,16 @@ import com.eu.habbo.plugin.events.users.achievements.UserAchievementLeveledEvent
|
|||||||
import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent;
|
import com.eu.habbo.plugin.events.users.achievements.UserAchievementProgressEvent;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.procedure.TObjectIntProcedure;
|
import gnu.trove.procedure.TObjectIntProcedure;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class AchievementManager {
|
public class AchievementManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(AchievementManager.class);
|
||||||
|
|
||||||
public static boolean TALENTTRACK_ENABLED = false;
|
public static boolean TALENTTRACK_ENABLED = false;
|
||||||
|
|
||||||
private final THashMap<String, Achievement> achievements;
|
private final THashMap<String, Achievement> achievements;
|
||||||
@ -57,7 +59,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(4, amount);
|
statement.setInt(4, amount);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +141,7 @@ public class AchievementManager {
|
|||||||
try {
|
try {
|
||||||
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
|
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +209,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(3, 1);
|
statement.setInt(3, 1);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +223,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -258,9 +260,9 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
log.error("Achievement Manager -> Failed to load!");
|
LOGGER.error("Achievement Manager -> Failed to load!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Achievement getAchievement(String name) {
|
public Achievement getAchievement(String name) {
|
||||||
|
@ -5,13 +5,14 @@ import com.eu.habbo.habbohotel.items.Item;
|
|||||||
import gnu.trove.map.TObjectIntMap;
|
import gnu.trove.map.TObjectIntMap;
|
||||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class TalentTrackLevel {
|
public class TalentTrackLevel {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(TalentTrackLevel.class);
|
||||||
|
|
||||||
public TalentTrackType type;
|
public TalentTrackType type;
|
||||||
public int level;
|
public int level;
|
||||||
@ -38,7 +39,7 @@ public class TalentTrackLevel {
|
|||||||
if (achievement != null) {
|
if (achievement != null) {
|
||||||
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
|
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
|
||||||
} else {
|
} 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) {
|
if (item != null) {
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
} else {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.BotTalkEvent;
|
||||||
import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
|
import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
|
||||||
import com.eu.habbo.threading.runnables.BotFollowHabbo;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -21,8 +22,9 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Bot implements Runnable {
|
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 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(";");
|
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();
|
statement.execute();
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} 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.item_count", "%item_count%"), this.room.itemCount() + "")
|
||||||
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), this.name)
|
.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.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 })) {
|
if(!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), room, new Object[]{ message })) {
|
||||||
this.talk(message);
|
this.talk(message);
|
||||||
|
@ -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.BotPickUpEvent;
|
||||||
import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
|
import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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.lang.reflect.Method;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
|
|
||||||
public class BotManager {
|
public class BotManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class);
|
||||||
|
|
||||||
final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<>();
|
final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<>();
|
||||||
public static int MINIMUM_CHAT_SPEED = 7;
|
public static int MINIMUM_CHAT_SPEED = 7;
|
||||||
public static int MAXIMUM_CHAT_SPEED = 604800;
|
public static int MAXIMUM_CHAT_SPEED = 604800;
|
||||||
@ -41,7 +45,7 @@ public class BotManager {
|
|||||||
|
|
||||||
this.reload();
|
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 {
|
public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception {
|
||||||
@ -56,10 +60,10 @@ public class BotManager {
|
|||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(null);
|
m.invoke(null);
|
||||||
} catch (NoSuchMethodException e) {
|
} 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;
|
return false;
|
||||||
} catch (Exception e) {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,12 +90,12 @@ public class BotManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bot;
|
return bot;
|
||||||
@ -147,7 +151,7 @@ public class BotManager {
|
|||||||
try {
|
try {
|
||||||
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,11 +209,11 @@ public class BotManager {
|
|||||||
if (botClazz != null)
|
if (botClazz != null)
|
||||||
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
|
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
|
||||||
else
|
else
|
||||||
log.error("Unknown Bot Type: " + type);
|
LOGGER.error("Unknown Bot Type: " + type);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -220,7 +224,7 @@ public class BotManager {
|
|||||||
statement.setInt(1, bot.getId());
|
statement.setInt(1, bot.getId());
|
||||||
return statement.execute();
|
return statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -233,9 +237,9 @@ public class BotManager {
|
|||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(null);
|
m.invoke(null);
|
||||||
} catch (NoSuchMethodException e) {
|
} 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) {
|
} 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
|
|||||||
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
|
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -21,8 +22,8 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ButlerBot extends Bot {
|
public class ButlerBot extends Bot {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ButlerBot.class);
|
||||||
public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<>();
|
public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<>();
|
||||||
|
|
||||||
public ButlerBot(ResultSet set) throws SQLException {
|
public ButlerBot(ResultSet set) throws SQLException {
|
||||||
@ -47,7 +48,7 @@ public class ButlerBot extends Bot {
|
|||||||
serveItems.put(ks, set.getInt("item"));
|
serveItems.put(ks, set.getInt("item"));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarProductComposer;
|
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarProductComposer;
|
||||||
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
|
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -13,15 +14,17 @@ import java.util.Date;
|
|||||||
|
|
||||||
import static java.time.temporal.ChronoUnit.DAYS;
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CalendarManager {
|
public class CalendarManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarCampaign.class);
|
||||||
|
|
||||||
final private static Map<Integer, CalendarCampaign> calendarCampaigns = new THashMap<>();
|
final private static Map<Integer, CalendarCampaign> calendarCampaigns = new THashMap<>();
|
||||||
public static double HC_MODIFIER;
|
public static double HC_MODIFIER;
|
||||||
|
|
||||||
public CalendarManager() {
|
public CalendarManager() {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
this.reload();
|
this.reload();
|
||||||
log.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
|
LOGGER.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose(){
|
public void dispose(){
|
||||||
@ -37,7 +40,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +85,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarCampaigns.put(campaign.getId(), campaign);
|
calendarCampaigns.put(campaign.getId(), campaign);
|
||||||
@ -95,7 +98,7 @@ public class CalendarManager {
|
|||||||
statement.setInt(1, campaign.getId());
|
statement.setInt(1, campaign.getId());
|
||||||
return statement.execute();
|
return statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -141,7 +144,7 @@ public class CalendarManager {
|
|||||||
statement.setInt(5, Emulator.getIntUnixTimestamp());
|
statement.setInt(5, Emulator.getIntUnixTimestamp());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@ import com.eu.habbo.habbohotel.users.HabboBadge;
|
|||||||
import com.eu.habbo.messages.ISerialize;
|
import com.eu.habbo.messages.ISerialize;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -15,8 +16,8 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem> {
|
public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem> {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogItem.class);
|
||||||
int id;
|
int id;
|
||||||
int limitedStack;
|
int limitedStack;
|
||||||
private int pageId;
|
private int pageId;
|
||||||
@ -28,12 +29,26 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
private int amount;
|
private int amount;
|
||||||
private boolean allowGift = false;
|
private boolean allowGift = false;
|
||||||
private int limitedSells;
|
private int limitedSells;
|
||||||
|
|
||||||
|
|
||||||
private String extradata;
|
private String extradata;
|
||||||
|
|
||||||
|
|
||||||
private boolean clubOnly;
|
private boolean clubOnly;
|
||||||
|
|
||||||
|
|
||||||
private boolean haveOffer;
|
private boolean haveOffer;
|
||||||
|
|
||||||
|
|
||||||
private int offerId;
|
private int offerId;
|
||||||
|
|
||||||
|
|
||||||
private boolean needsUpdate;
|
private boolean needsUpdate;
|
||||||
|
|
||||||
|
|
||||||
private int orderNumber;
|
private int orderNumber;
|
||||||
|
|
||||||
|
|
||||||
private HashMap<Integer, Integer> bundle;
|
private HashMap<Integer, Integer> bundle;
|
||||||
|
|
||||||
public CatalogItem(ResultSet set) throws SQLException {
|
public CatalogItem(ResultSet set) throws SQLException {
|
||||||
@ -203,7 +218,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
|
|
||||||
identifier = Integer.parseInt(itemId);
|
identifier = Integer.parseInt(itemId);
|
||||||
} catch (Exception e) {
|
} 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;
|
continue;
|
||||||
}
|
}
|
||||||
if (identifier > 0) {
|
if (identifier > 0) {
|
||||||
@ -250,8 +265,8 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.debug("Failed to load " + this.itemId);
|
LOGGER.debug("Failed to load " + this.itemId);
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -335,7 +350,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
statement.setInt(3, this.getId());
|
statement.setInt(3, this.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
|
@ -3,7 +3,8 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -11,8 +12,9 @@ import java.sql.SQLException;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CatalogLimitedConfiguration implements Runnable {
|
public class CatalogLimitedConfiguration implements Runnable {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogLimitedConfiguration.class);
|
||||||
|
|
||||||
private final int itemId;
|
private final int itemId;
|
||||||
private final LinkedList<Integer> limitedNumbers;
|
private final LinkedList<Integer> limitedNumbers;
|
||||||
private int totalSet;
|
private int totalSet;
|
||||||
@ -49,7 +51,7 @@ public class CatalogLimitedConfiguration implements Runnable {
|
|||||||
statement.setInt(5, item.getLimitedSells());
|
statement.setInt(5, item.getLimitedSells());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.totalSet += amount;
|
this.totalSet += amount;
|
||||||
@ -100,7 +102,7 @@ public class CatalogLimitedConfiguration implements Runnable {
|
|||||||
statement.setInt(3, this.itemId);
|
statement.setInt(3, this.itemId);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -41,15 +41,17 @@ import gnu.trove.map.hash.TIntIntHashMap;
|
|||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
import gnu.trove.procedure.TObjectProcedure;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CatalogManager {
|
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) {
|
public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>(CatalogPageLayouts.values().length) {
|
||||||
{
|
{
|
||||||
for (CatalogPageLayouts layout : CatalogPageLayouts.values()) {
|
for (CatalogPageLayouts layout : CatalogPageLayouts.values()) {
|
||||||
@ -219,7 +221,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
|
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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<Integer, LinkedList<Integer>> set : limiteds.entrySet()) {
|
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"));
|
Class<? extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout"));
|
||||||
|
|
||||||
if (pageClazz == null) {
|
if (pageClazz == null) {
|
||||||
log.info("Unknown Page Layout: " + set.getString("page_layout"));
|
LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,12 +288,12 @@ public class CatalogManager {
|
|||||||
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
|
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
|
||||||
pages.put(page.getId(), page);
|
pages.put(page.getId(), page);
|
||||||
} catch (Exception e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
pages.forEachValue((object) -> {
|
pages.forEachValue((object) -> {
|
||||||
@ -303,7 +305,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (object.parentId != -2) {
|
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;
|
return true;
|
||||||
@ -311,7 +313,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
this.catalogPages.putAll(pages);
|
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) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CatalogPage page : this.catalogPages.valueCollection()) {
|
for (CatalogPage page : this.catalogPages.valueCollection()) {
|
||||||
@ -401,7 +403,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} 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));
|
this.vouchers.add(new Voucher(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
this.prizes.get(set.getInt("rarity")).add(item);
|
||||||
} else {
|
} 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) {
|
} 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) {
|
} 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));
|
this.clothing.put(set.getInt("id"), new ClothItem(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return statement.executeUpdate() >= 1;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -701,7 +703,7 @@ public class CatalogManager {
|
|||||||
if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) {
|
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())];
|
return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())];
|
||||||
} else {
|
} else {
|
||||||
log.error("No rewards specified for rarity level {}", level);
|
LOGGER.error("No rewards specified for rarity level {}", level);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -733,10 +735,10 @@ public class CatalogManager {
|
|||||||
try {
|
try {
|
||||||
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
|
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("Unknown page layout: {}", page.getString("page_layout"));
|
LOGGER.error("Unknown page layout: {}", page.getString("page_layout"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,7 +746,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (catalogPage != null) {
|
if (catalogPage != null) {
|
||||||
@ -803,7 +805,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Catalog Manager -> Disposed!");
|
LOGGER.info("Catalog Manager -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -872,7 +874,7 @@ public class CatalogManager {
|
|||||||
if (amount > 1 && !CatalogItem.haveOffer(item)) {
|
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());
|
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);
|
ScripterManager.scripterDetected(habbo.getClient(), message);
|
||||||
log.info(message);
|
LOGGER.info(message);
|
||||||
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
|
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -959,7 +961,7 @@ public class CatalogManager {
|
|||||||
try {
|
try {
|
||||||
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
|
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,7 +1020,7 @@ public class CatalogManager {
|
|||||||
try {
|
try {
|
||||||
guildId = Integer.parseInt(extradata);
|
guildId = Integer.parseInt(extradata);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1141,7 +1143,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception caught", e);
|
LOGGER.error("Exception caught", e);
|
||||||
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -7,14 +7,15 @@ import gnu.trove.list.array.TIntArrayList;
|
|||||||
import gnu.trove.map.TIntObjectMap;
|
import gnu.trove.map.TIntObjectMap;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize {
|
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 TIntArrayList offerIds = new TIntArrayList();
|
||||||
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
|
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
|
||||||
@ -72,8 +73,8 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
|
|||||||
try {
|
try {
|
||||||
this.included.add(Integer.valueOf(id));
|
this.included.add(Integer.valueOf(id));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
log.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
|
LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.eu.habbo.habbohotel.catalog;
|
package com.eu.habbo.habbohotel.catalog;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -11,8 +11,8 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Voucher {
|
public class Voucher {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Voucher.class);
|
||||||
|
|
||||||
public final int id;
|
public final int id;
|
||||||
public final String code;
|
public final String code;
|
||||||
@ -46,7 +46,7 @@ public class Voucher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class Voucher {
|
|||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,14 @@ import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
|
|||||||
import gnu.trove.map.TIntObjectMap;
|
import gnu.trove.map.TIntObjectMap;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
import gnu.trove.procedure.TObjectProcedure;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class RoomBundleLayout extends SingleBundle {
|
public class RoomBundleLayout extends SingleBundle {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleLayout.class);
|
||||||
|
|
||||||
public int roomId;
|
public int roomId;
|
||||||
public Room room;
|
public Room room;
|
||||||
@ -47,7 +48,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
if (this.room != null)
|
if (this.room != null)
|
||||||
this.room.preventUnloading = true;
|
this.room.preventUnloading = true;
|
||||||
} else {
|
} 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.setInt(3, this.room.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);
|
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);
|
||||||
|
@ -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.MarketPlaceItemOfferedEvent;
|
||||||
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
|
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -25,8 +27,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class MarketPlace {
|
public class MarketPlace {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class);
|
||||||
|
|
||||||
//Configuration. Loaded from database & updated accordingly.
|
//Configuration. Loaded from database & updated accordingly.
|
||||||
public static boolean MARKETPLACE_ENABLED = true;
|
public static boolean MARKETPLACE_ENABLED = true;
|
||||||
|
|
||||||
@ -44,7 +47,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return offers;
|
return offers;
|
||||||
@ -102,7 +105,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false));
|
habbo.getClient().sendResponse(new MarketplaceCancelSaleComposer(offer, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +169,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return offers;
|
return offers;
|
||||||
@ -196,7 +199,7 @@ public class MarketPlace {
|
|||||||
message.appendInt(1);
|
message.appendInt(1);
|
||||||
message.appendInt(itemId);
|
message.appendInt(itemId);
|
||||||
} catch (SQLException e) {
|
} 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");
|
number = set.getInt("number");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return number;
|
return number;
|
||||||
@ -229,7 +232,7 @@ public class MarketPlace {
|
|||||||
avg = set.getInt("avg");
|
avg = set.getInt("avg");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return calculateCommision(avg);
|
return calculateCommision(avg);
|
||||||
@ -296,7 +299,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} 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.setInt(2, offer.getOfferId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,14 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class MarketPlaceOffer implements Runnable {
|
public class MarketPlaceOffer implements Runnable {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlaceOffer.class);
|
||||||
|
|
||||||
public int avarage;
|
public int avarage;
|
||||||
public int count;
|
public int count;
|
||||||
private int offerId;
|
private int offerId;
|
||||||
@ -67,7 +70,7 @@ public class MarketPlaceOffer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} 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.setInt(3, this.offerId);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,15 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.YoutubeManager;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class AddYoutubePlaylistCommand extends Command {
|
public class AddYoutubePlaylistCommand extends Command {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(AddYoutubePlaylistCommand.class);
|
||||||
|
|
||||||
public AddYoutubePlaylistCommand() {
|
public AddYoutubePlaylistCommand() {
|
||||||
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";"));
|
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";"));
|
||||||
@ -44,7 +45,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(itemId, playlist);
|
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().addPlaylistToItem(Integer.parseInt(params[1]), playlist);
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO `youtube_playlists` (`item_id`, `playlist_id`) VALUES (?, ?)")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO `youtube_playlists` (`item_id`, `playlist_id`) VALUES (?, ?)")) {
|
||||||
statement.setInt(1, itemId);
|
statement.setInt(1, itemId);
|
||||||
@ -52,7 +53,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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"));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist"));
|
||||||
|
@ -6,15 +6,16 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class BadgeCommand extends Command {
|
public class BadgeCommand extends Command {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(BadgeCommand.class);
|
||||||
|
|
||||||
public BadgeCommand() {
|
public BadgeCommand() {
|
||||||
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
|
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
|
||||||
@ -75,7 +76,7 @@ public class BadgeCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,18 @@ import com.eu.habbo.plugin.events.users.UserCommandEvent;
|
|||||||
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
|
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
|
||||||
import gnu.trove.iterator.TIntObjectIterator;
|
import gnu.trove.iterator.TIntObjectIterator;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CommandHandler {
|
public class CommandHandler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class);
|
||||||
|
|
||||||
private final static THashMap<String, Command> commands = new THashMap<>(5);
|
private final static THashMap<String, Command> commands = new THashMap<>(5);
|
||||||
private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() {
|
private static final Comparator<Command> ALPHABETICAL_ORDER = new Comparator<Command>() {
|
||||||
public int compare(Command c1, Command c2) {
|
public int compare(Command c1, Command c2) {
|
||||||
@ -37,7 +39,7 @@ public class CommandHandler {
|
|||||||
public CommandHandler() {
|
public CommandHandler() {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
this.reloadCommands();
|
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) {
|
public static void addCommand(Command command) {
|
||||||
@ -46,6 +48,19 @@ public class CommandHandler {
|
|||||||
|
|
||||||
commands.put(command.getClass().getName(), command);
|
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) {
|
public static boolean handleCommand(GameClient gameClient, String commandLine) {
|
||||||
if (gameClient != null && commandLine != null) {
|
if (gameClient != null && commandLine != null) {
|
||||||
if (commandLine.startsWith(":")) {
|
if (commandLine.startsWith(":")) {
|
||||||
@ -75,7 +90,7 @@ public class CommandHandler {
|
|||||||
|
|
||||||
succes = event.succes;
|
succes = event.succes;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
|
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
|
||||||
@ -279,7 +294,6 @@ public class CommandHandler {
|
|||||||
addCommand(new AddYoutubePlaylistCommand());
|
addCommand(new AddYoutubePlaylistCommand());
|
||||||
addCommand(new SoftKickCommand());
|
addCommand(new SoftKickCommand());
|
||||||
addCommand(new SubscriptionCommand());
|
addCommand(new SubscriptionCommand());
|
||||||
addCommand(new PingCommand());
|
|
||||||
|
|
||||||
addCommand(new TestCommand());
|
addCommand(new TestCommand());
|
||||||
}
|
}
|
||||||
@ -306,6 +320,6 @@ public class CommandHandler {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
commands.clear();
|
commands.clear();
|
||||||
log.info("Command Handler -> Disposed!");
|
LOGGER.info("Command Handler -> Disposed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,11 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
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 {
|
public class EnableCommand extends Command {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(EnableCommand.class);
|
||||||
|
|
||||||
public EnableCommand() {
|
public EnableCommand() {
|
||||||
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";"));
|
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";"));
|
||||||
@ -42,7 +43,7 @@ public class EnableCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,16 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.modtool.WordFilter;
|
import com.eu.habbo.habbohotel.modtool.WordFilter;
|
||||||
import com.eu.habbo.habbohotel.modtool.WordFilterWord;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class FilterWordCommand extends Command {
|
public class FilterWordCommand extends Command {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(FilterWordCommand.class);
|
||||||
|
|
||||||
public FilterWordCommand() {
|
public FilterWordCommand() {
|
||||||
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";"));
|
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.setString(2, replacement);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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"));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class HotelAlertCommand extends Command {
|
|||||||
message.append(params[i]).append(" ");
|
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()) {
|
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||||
Habbo habbo = set.getValue();
|
Habbo habbo = set.getValue();
|
||||||
|
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
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.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
|
||||||
@ -19,16 +18,14 @@ public class InvisibleCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
HabboInfo habboInfo = gameClient.getHabbo().getHabboInfo();
|
|
||||||
RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit();
|
RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit();
|
||||||
|
|
||||||
habboInfo.toggleInvisibility();
|
if (roomUnit.isInvisible()) {
|
||||||
|
|
||||||
if (!habboInfo.isInvisibleInRooms() && !roomUnit.isInRoom()) {
|
|
||||||
RoomLayout roomLayout = roomUnit.getRoom().getLayout();
|
RoomLayout roomLayout = roomUnit.getRoom().getLayout();
|
||||||
|
|
||||||
new RoomUnitTeleport(roomUnit, roomUnit.getRoom(), roomLayout.getDoorTile().x, roomLayout.getDoorTile().y, roomLayout.getDoorTile().z, 0).run();
|
new RoomUnitTeleport(roomUnit, roomUnit.getRoom(), roomLayout.getDoorTile().x, roomLayout.getDoorTile().y, roomLayout.getDoorTile().z, 0).run();
|
||||||
|
|
||||||
|
roomUnit.setInvisible(false);
|
||||||
roomUnit.setInRoom(true);
|
roomUnit.setInRoom(true);
|
||||||
|
|
||||||
roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose());
|
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);
|
WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null);
|
||||||
roomUnit.getRoom().habboEntered(gameClient.getHabbo());
|
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;
|
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());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRemoveComposer(roomUnit).compose());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -32,6 +32,9 @@ public class MimicCommand extends Command {
|
|||||||
} else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) {
|
} 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);
|
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;
|
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 {
|
} 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().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());
|
gameClient.getHabbo().getHabboInfo().setGender(habbo.getHabboInfo().getGender());
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,12 +7,13 @@ import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts;
|
|||||||
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
|
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class RoomBundleCommand extends Command {
|
public class RoomBundleCommand extends Command {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleCommand.class);
|
||||||
|
|
||||||
public RoomBundleCommand() {
|
public RoomBundleCommand() {
|
||||||
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";"));
|
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";"));
|
||||||
@ -65,7 +66,7 @@ public class RoomBundleCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class StaffAlertCommand extends Command {
|
|||||||
message.append(params[i]).append(" ");
|
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);
|
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new FriendChatMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message.toString())).compose(), "acc_staff_chat", gameClient);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffalert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffalert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
|
@ -24,11 +24,6 @@ public class StalkCommand extends Command {
|
|||||||
return true;
|
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) {
|
if (habbo.getHabboInfo().getCurrentRoom() == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -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(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");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
List<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
|
List<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
|
||||||
|
@ -4,14 +4,17 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CraftingManager {
|
public class CraftingManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CraftingManager.class);
|
||||||
|
|
||||||
private final THashMap<Item, CraftingAltar> altars;
|
private final THashMap<Item, CraftingAltar> altars;
|
||||||
|
|
||||||
public CraftingManager() {
|
public CraftingManager() {
|
||||||
@ -53,14 +56,14 @@ public class CraftingManager {
|
|||||||
recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount"));
|
recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount"));
|
||||||
altar.addIngredient(ingredientItem);
|
altar.addIngredient(ingredientItem);
|
||||||
} else {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +117,7 @@ public class CraftingManager {
|
|||||||
}
|
}
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.altars.clear();
|
this.altars.clear();
|
||||||
|
@ -2,36 +2,31 @@ package com.eu.habbo.habbohotel.gameclients;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.crypto.HabboEncryption;
|
import com.eu.habbo.crypto.HabboEncryption;
|
||||||
import com.eu.habbo.habbohotel.LatencyTracker;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import io.netty.channel.Channel;
|
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.ArrayList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class GameClient {
|
public class GameClient {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class);
|
||||||
|
|
||||||
private final Channel channel;
|
private final Channel channel;
|
||||||
private final HabboEncryption encryption;
|
private final HabboEncryption encryption;
|
||||||
private final LatencyTracker latencyTracker;
|
|
||||||
|
|
||||||
private Habbo habbo;
|
private Habbo habbo;
|
||||||
private boolean handshakeFinished;
|
private boolean handshakeFinished;
|
||||||
private String machineId = "";
|
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<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
|
||||||
public final ConcurrentHashMap<Class<? extends MessageHandler>, Long> messageTimestamps = new ConcurrentHashMap<>();
|
public final ConcurrentHashMap<Class<? extends MessageHandler>, Long> messageTimestamps = new ConcurrentHashMap<>();
|
||||||
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
|
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
|
||||||
@ -44,7 +39,6 @@ public class GameClient {
|
|||||||
Emulator.getCrypto().getModulus(),
|
Emulator.getCrypto().getModulus(),
|
||||||
Emulator.getCrypto().getPrivateExponent())
|
Emulator.getCrypto().getPrivateExponent())
|
||||||
: null;
|
: null;
|
||||||
this.latencyTracker = new LatencyTracker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel getChannel() {
|
public Channel getChannel() {
|
||||||
@ -55,10 +49,6 @@ public class GameClient {
|
|||||||
return encryption;
|
return encryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatencyTracker getLatencyTracker() {
|
|
||||||
return latencyTracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Habbo getHabbo() {
|
public Habbo getHabbo() {
|
||||||
return this.habbo;
|
return this.habbo;
|
||||||
}
|
}
|
||||||
@ -129,7 +119,7 @@ public class GameClient {
|
|||||||
this.habbo = null;
|
this.habbo = null;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,11 +20,14 @@ import com.eu.habbo.plugin.events.games.GameStartedEvent;
|
|||||||
import com.eu.habbo.plugin.events.games.GameStoppedEvent;
|
import com.eu.habbo.plugin.events.games.GameStoppedEvent;
|
||||||
import com.eu.habbo.threading.runnables.SaveScoreForTeam;
|
import com.eu.habbo.threading.runnables.SaveScoreForTeam;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@Slf4j
|
|
||||||
public abstract class Game implements Runnable {
|
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 THashMap<GameTeamColors, GameTeam> teams = new THashMap<>();
|
||||||
protected final Room room;
|
protected final Room room;
|
||||||
private final Class<? extends GameTeam> gameTeamClazz;
|
private final Class<? extends GameTeam> gameTeamClazz;
|
||||||
@ -72,7 +75,7 @@ public abstract class Game implements Runnable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -17,18 +17,26 @@ import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
|
|||||||
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
|
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.*;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class BattleBanzaiGame extends Game {
|
public class BattleBanzaiGame extends Game {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(BattleBanzaiGame.class);
|
||||||
|
|
||||||
|
|
||||||
public static final int effectId = 32;
|
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_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_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);
|
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));
|
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) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,17 @@ import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.procedure.TObjectProcedure;
|
import gnu.trove.procedure.TObjectProcedure;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class FreezeGame extends Game {
|
public class FreezeGame extends Game {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(FreezeGame.class);
|
||||||
|
|
||||||
public static final int effectId = 39;
|
public static final int effectId = 39;
|
||||||
|
|
||||||
public static int POWER_UP_POINTS;
|
public static int POWER_UP_POINTS;
|
||||||
public static int POWER_UP_CHANCE;
|
public static int POWER_UP_CHANCE;
|
||||||
public static int POWER_UP_PROTECT_TIME;
|
public static int POWER_UP_PROTECT_TIME;
|
||||||
@ -261,7 +265,7 @@ public class FreezeGame extends Game {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
package com.eu.habbo.habbohotel.guilds;
|
package com.eu.habbo.habbohotel.guilds;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Guild implements Runnable {
|
public class Guild implements Runnable {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Guild.class);
|
||||||
public boolean needsUpdate;
|
public boolean needsUpdate;
|
||||||
public int lastRequested = Emulator.getIntUnixTimestamp();
|
public int lastRequested = Emulator.getIntUnixTimestamp();
|
||||||
private int id;
|
private int id;
|
||||||
@ -92,7 +94,7 @@ public class Guild implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,21 @@ import gnu.trove.map.TIntObjectMap;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class GuildManager {
|
public class GuildManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class);
|
||||||
|
|
||||||
private final THashMap<GuildPartType, THashMap<Integer, GuildPart>> guildParts;
|
private final THashMap<GuildPartType, THashMap<Integer, GuildPart>> guildParts;
|
||||||
|
|
||||||
private final TIntObjectMap<Guild> guilds;
|
private final TIntObjectMap<Guild> guilds;
|
||||||
|
|
||||||
private final THashSet<ForumView> views = new THashSet<>();
|
private final THashSet<ForumView> views = new THashSet<>();
|
||||||
|
|
||||||
public GuildManager() {
|
public GuildManager() {
|
||||||
@ -32,7 +38,7 @@ public class GuildManager {
|
|||||||
this.loadGuildParts();
|
this.loadGuildParts();
|
||||||
this.loadGuildViews();
|
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));
|
this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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));
|
this.views.add(new ForumView(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
habbo.getHabboStats().addGuild(guild.getId());
|
habbo.getHabboStats().addGuild(guild.getId());
|
||||||
@ -150,10 +156,10 @@ public class GuildManager {
|
|||||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
room.setGuildId(0);
|
room.setGuild(0);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} 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.setInt(3, guild.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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.setInt(3, guild.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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.setInt(2, guild.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return member;
|
return member;
|
||||||
@ -373,7 +379,7 @@ public class GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return guildMembers;
|
return guildMembers;
|
||||||
@ -395,7 +401,7 @@ public class GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return guildMembers;
|
return guildMembers;
|
||||||
@ -414,7 +420,7 @@ public class GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -432,7 +438,7 @@ public class GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return guildAdmins;
|
return guildAdmins;
|
||||||
@ -464,7 +470,7 @@ public class GuildManager {
|
|||||||
if (g != null)
|
if (g != null)
|
||||||
g.loadMemberCount();
|
g.loadMemberCount();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return guilds;
|
return guilds;
|
||||||
@ -512,7 +518,7 @@ public class GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return guilds;
|
return guilds;
|
||||||
@ -591,7 +597,7 @@ public class GuildManager {
|
|||||||
statement.setInt(2, furni.getId());
|
statement.setInt(2, furni.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,7 +612,7 @@ public class GuildManager {
|
|||||||
|
|
||||||
guildIterator.remove();
|
guildIterator.remove();
|
||||||
}
|
}
|
||||||
log.info("Guild Manager -> Disposed!");
|
LOGGER.info("Guild Manager -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasViewedForum(int userId, int guildId) {
|
public boolean hasViewedForum(int userId, int guildId) {
|
||||||
@ -626,7 +632,7 @@ public class GuildManager {
|
|||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,16 @@ import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadBeforeCreated;
|
|||||||
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated;
|
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ForumThread implements Runnable, ISerialize {
|
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, THashSet<ForumThread>> guildThreadsCache = new THashMap<>();
|
||||||
private final static THashMap<Integer, ForumThread> forumThreadsCache = new THashMap<>();
|
private final static THashMap<Integer, ForumThread> forumThreadsCache = new THashMap<>();
|
||||||
private final int threadId;
|
private final int threadId;
|
||||||
@ -70,7 +74,7 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
try {
|
try {
|
||||||
this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id"));
|
this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id"));
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("ForumThread last_comment_id exception", e);
|
LOGGER.error("ForumThread last_comment_id exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.comments = new THashMap<>();
|
this.comments = new THashMap<>();
|
||||||
@ -109,7 +113,7 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
|
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createdThread;
|
return createdThread;
|
||||||
@ -157,7 +161,7 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return threads;
|
return threads;
|
||||||
@ -196,7 +200,7 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundThread;
|
return foundThread;
|
||||||
@ -338,7 +342,7 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
addComment(comment);
|
addComment(comment);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.GuildForumThreadCommentBeforeCreated;
|
||||||
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated;
|
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ForumThreadComment implements Runnable, ISerialize {
|
public class ForumThreadComment implements Runnable, ISerialize {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class);
|
||||||
|
|
||||||
private static THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>();
|
private static THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>();
|
||||||
private final int commentId;
|
private final int commentId;
|
||||||
private final int threadId;
|
private final int threadId;
|
||||||
@ -64,7 +67,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundComment;
|
return foundComment;
|
||||||
@ -103,7 +106,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
|
|||||||
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
|
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createdComment;
|
return createdComment;
|
||||||
@ -200,7 +203,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
|
|||||||
|
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,29 @@ package com.eu.habbo.habbohotel.hotelview;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class HallOfFame {
|
public class HallOfFame {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(HallOfFame.class);
|
||||||
|
|
||||||
private final THashMap<Integer, HallOfFameWinner> winners = new THashMap<>();
|
private final THashMap<Integer, HallOfFameWinner> winners = new THashMap<>();
|
||||||
|
|
||||||
|
|
||||||
private String competitionName;
|
private String competitionName;
|
||||||
|
|
||||||
public HallOfFame() {
|
public HallOfFame() {
|
||||||
this.setCompetitionName("xmasRoomComp");
|
this.setCompetitionName("xmasRoomComp");
|
||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
this.winners.clear();
|
this.winners.clear();
|
||||||
|
|
||||||
@ -28,7 +35,7 @@ public class HallOfFame {
|
|||||||
this.winners.put(winner.getId(), winner);
|
this.winners.put(winner.getId(), winner);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class HallOfFameWinner implements Comparable<HallOfFameWinner> {
|
|||||||
this.id = set.getInt("id");
|
this.id = set.getInt("id");
|
||||||
this.username = set.getString("username");
|
this.username = set.getString("username");
|
||||||
this.look = set.getString("look");
|
this.look = set.getString("look");
|
||||||
this.points = set.getInt("achievement_score");
|
this.points = set.getInt("hof_points");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.eu.habbo.habbohotel.hotelview;
|
package com.eu.habbo.habbohotel.hotelview;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class HotelViewManager {
|
public class HotelViewManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class);
|
||||||
|
|
||||||
private final HallOfFame hallOfFame;
|
private final HallOfFame hallOfFame;
|
||||||
private final NewsList newsList;
|
private final NewsList newsList;
|
||||||
|
|
||||||
@ -12,7 +15,7 @@ public class HotelViewManager {
|
|||||||
this.hallOfFame = new HallOfFame();
|
this.hallOfFame = new HallOfFame();
|
||||||
this.newsList = new NewsList();
|
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() {
|
public HallOfFame getHallOfFame() {
|
||||||
@ -24,7 +27,7 @@ public class HotelViewManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
log.info("HotelView Manager -> Disposed!");
|
LOGGER.info("HotelView Manager -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package com.eu.habbo.habbohotel.hotelview;
|
package com.eu.habbo.habbohotel.hotelview;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class NewsList {
|
public class NewsList {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(NewsList.class);
|
||||||
|
|
||||||
private final ArrayList<NewsWidget> newsWidgets;
|
private final ArrayList<NewsWidget> newsWidgets;
|
||||||
|
|
||||||
public NewsList() {
|
public NewsList() {
|
||||||
@ -26,7 +29,7 @@ public class NewsList {
|
|||||||
this.newsWidgets.add(new NewsWidget(set));
|
this.newsWidgets.add(new NewsWidget(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
package com.eu.habbo.habbohotel.items;
|
package com.eu.habbo.habbohotel.items;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class CrackableReward {
|
public class CrackableReward {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CrackableReward.class);
|
||||||
|
|
||||||
public final int itemId;
|
public final int itemId;
|
||||||
public final int count;
|
public final int count;
|
||||||
@ -46,7 +48,7 @@ public class CrackableReward {
|
|||||||
itemId = Integer.valueOf(prize.split(":")[0]);
|
itemId = Integer.valueOf(prize.split(":")[0]);
|
||||||
chance = Integer.valueOf(prize.split(":")[1]);
|
chance = Integer.valueOf(prize.split(":")[1]);
|
||||||
} else if (prize.contains(":")) {
|
} 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 {
|
} else {
|
||||||
itemId = Integer.valueOf(prize.replace(":", ""));
|
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.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));
|
||||||
this.totalChance += chance;
|
this.totalChance += chance;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,17 @@ import gnu.trove.map.TIntObjectMap;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.lang.reflect.Constructor;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ItemManager {
|
public class ItemManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class);
|
||||||
|
|
||||||
//Configuration. Loaded from database & updated accordingly.
|
//Configuration. Loaded from database & updated accordingly.
|
||||||
public static boolean RECYCLER_ENABLED = true;
|
public static boolean RECYCLER_ENABLED = true;
|
||||||
|
|
||||||
@ -101,7 +105,7 @@ public class ItemManager {
|
|||||||
this.highscoreManager.load();
|
this.highscoreManager.load();
|
||||||
this.loadNewUserGifts();
|
this.loadNewUserGifts();
|
||||||
|
|
||||||
log.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadItemInteractions() {
|
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_has_handitem", WiredConditionHabboHasHandItem.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_cnd_date_rng_active", WiredConditionDateRangeActive.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_random", WiredExtraRandom.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_xtra_unseen", WiredExtraUnseen.class));
|
this.interactionsList.add(new ItemInteraction("wf_xtra_unseen", WiredExtraUnseen.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_blob", WiredBlob.class));
|
this.interactionsList.add(new ItemInteraction("wf_blob", WiredBlob.class));
|
||||||
@ -357,7 +362,7 @@ public class ItemManager {
|
|||||||
return interaction;
|
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);
|
return this.getItemInteraction(InteractionDefault.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,12 +392,12 @@ public class ItemManager {
|
|||||||
else
|
else
|
||||||
this.items.get(id).update(set);
|
this.items.get(id).update(set);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Failed to load Item ({})", set.getInt("id"));
|
LOGGER.error("Failed to load Item ({})", set.getInt("id"));
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,16 +410,16 @@ public class ItemManager {
|
|||||||
try {
|
try {
|
||||||
reward = new CrackableReward(set);
|
reward = new CrackableReward(set);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
|
LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.crackableRewards.put(set.getInt("item_id"), reward);
|
this.crackableRewards.put(set.getInt("item_id"), reward);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (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));
|
this.soundTracks.put(set.getString("code"), new SoundTrack(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,16 +486,16 @@ public class ItemManager {
|
|||||||
try {
|
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);
|
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) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
|
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -505,7 +510,7 @@ public class ItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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.setInt(1, item.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@ -597,9 +602,9 @@ public class ItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@ -611,7 +616,7 @@ public class ItemManager {
|
|||||||
statement.setInt(2, itemTwoId);
|
statement.setInt(2, itemTwoId);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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.setInt(2, hopper.getBaseItem().getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} 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) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
@ -652,9 +657,9 @@ public class ItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@ -675,7 +680,7 @@ public class ItemManager {
|
|||||||
|
|
||||||
return (HabboItem) c.newInstance(set, baseItem);
|
return (HabboItem) c.newInstance(set, baseItem);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,7 +704,7 @@ public class ItemManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +720,7 @@ public class ItemManager {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (extraData.length() > 1000) {
|
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);
|
extraData = extraData.substring(0, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,8 +775,9 @@ public class ItemManager {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
|
this.highscoreManager.dispose();
|
||||||
|
|
||||||
log.info("Item Manager -> Disposed!");
|
LOGGER.info("Item Manager -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getInteractionList() {
|
public List<String> getInteractionList() {
|
||||||
|
@ -13,25 +13,7 @@ public enum PostItColor {
|
|||||||
PINK("FF9CFF"),
|
PINK("FF9CFF"),
|
||||||
|
|
||||||
|
|
||||||
YELLOW("FFFF33"),
|
YELLOW("FFFF33");
|
||||||
|
|
||||||
|
|
||||||
RED("FF9C9D"),
|
|
||||||
|
|
||||||
|
|
||||||
ORANGE("FFCD9C"),
|
|
||||||
|
|
||||||
|
|
||||||
PURPLE("C3B1E1"),
|
|
||||||
|
|
||||||
|
|
||||||
LIGHTBLUE("DBDEFB"),
|
|
||||||
|
|
||||||
|
|
||||||
WHITE("FFFFFF"),
|
|
||||||
|
|
||||||
|
|
||||||
BLACK("282828");
|
|
||||||
|
|
||||||
public final String hexColor;
|
public final String hexColor;
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.eu.habbo.habbohotel.items;
|
package com.eu.habbo.habbohotel.items;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class RandomStateParams {
|
public class RandomStateParams {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(RandomStateParams.class);
|
||||||
|
|
||||||
private int states = -1;
|
private int states = -1;
|
||||||
private int delay = -1;
|
private int delay = -1;
|
||||||
|
|
||||||
@ -22,7 +25,7 @@ public class RandomStateParams {
|
|||||||
this.delay = Integer.parseInt(keyValue[1]);
|
this.delay = Integer.parseInt(keyValue[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.warn("RandomStateParams: unknown key: " + keyValue[0]);
|
LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,9 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import gnu.trove.map.hash.THashMap;
|
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 javax.net.ssl.HttpsURLConnection;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,8 +22,8 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class YoutubeManager {
|
public class YoutubeManager {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
|
||||||
|
|
||||||
public static class YoutubeVideo {
|
public static class YoutubeVideo {
|
||||||
private final String id;
|
private final String id;
|
||||||
@ -84,7 +86,7 @@ public class YoutubeManager {
|
|||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
|
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 (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
@ -92,7 +94,6 @@ public class YoutubeManager {
|
|||||||
final int itemId = set.getInt("item_id");
|
final int itemId = set.getInt("item_id");
|
||||||
final String playlistId = set.getString("playlist_id");
|
final String playlistId = set.getString("playlist_id");
|
||||||
|
|
||||||
|
|
||||||
youtubeDataLoaderPool.submit(() -> {
|
youtubeDataLoaderPool.submit(() -> {
|
||||||
YoutubePlaylist playlist;
|
YoutubePlaylist playlist;
|
||||||
try {
|
try {
|
||||||
@ -101,13 +102,13 @@ public class YoutubeManager {
|
|||||||
this.addPlaylistToItem(itemId, playlist);
|
this.addPlaylistToItem(itemId, playlist);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
|
LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
youtubeDataLoaderPool.shutdown();
|
youtubeDataLoaderPool.shutdown();
|
||||||
@ -116,7 +117,8 @@ public class YoutubeManager {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
log.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
|
||||||
|
LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ public class YoutubeManager {
|
|||||||
BufferedReader playlistBR = new BufferedReader(playlistISR);
|
BufferedReader playlistBR = new BufferedReader(playlistISR);
|
||||||
JsonObject errorObj = JsonParser.parseReader(playlistBR).getAsJsonObject();
|
JsonObject errorObj = JsonParser.parseReader(playlistBR).getAsJsonObject();
|
||||||
String message = errorObj.get("error").getAsJsonObject().get("message").getAsString();
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
InputStream playlistInputStream = playlistCon.getInputStream();
|
InputStream playlistInputStream = playlistCon.getInputStream();
|
||||||
@ -144,7 +146,7 @@ public class YoutubeManager {
|
|||||||
|
|
||||||
JsonArray playlists = playlistData.get("items").getAsJsonArray();
|
JsonArray playlists = playlistData.get("items").getAsJsonArray();
|
||||||
if (playlists.size() == 0) {
|
if (playlists.size() == 0) {
|
||||||
log.error("Playlist {} not found!", playlistId);
|
LOGGER.error("Playlist {} not found!", playlistId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JsonObject playlistItem = playlists.get(0).getAsJsonObject().get("snippet").getAsJsonObject();
|
JsonObject playlistItem = playlists.get(0).getAsJsonObject().get("snippet").getAsJsonObject();
|
||||||
@ -207,13 +209,12 @@ public class YoutubeManager {
|
|||||||
} while (nextPageToken != null);
|
} while (nextPageToken != null);
|
||||||
|
|
||||||
if (videos.isEmpty()) {
|
if (videos.isEmpty()) {
|
||||||
log.warn("Playlist {} has no videos!", playlistId);
|
LOGGER.warn("Playlist {} has no videos!", playlistId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
playlist = new YoutubePlaylist(playlistId, name, description, videos);
|
playlist = new YoutubePlaylist(playlistId, name, description, videos);
|
||||||
|
|
||||||
this.playlistCache.put(playlistId, playlist);
|
this.playlistCache.put(playlistId, playlist);
|
||||||
log.info("Loaded youtube playList into cache:" + playlistId);
|
|
||||||
|
|
||||||
return playlist;
|
return playlist;
|
||||||
|
|
||||||
@ -225,6 +226,5 @@ public class YoutubeManager {
|
|||||||
|
|
||||||
public void addPlaylistToItem(int itemId, YoutubePlaylist playlist) {
|
public void addPlaylistToItem(int itemId, YoutubePlaylist playlist) {
|
||||||
this.playlists.computeIfAbsent(itemId, k -> new ArrayList<>()).add(playlist);
|
this.playlists.computeIfAbsent(itemId, k -> new ArrayList<>()).add(playlist);
|
||||||
log.info("Loaded youtube playList into FurniID:" + itemId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,12 +3,15 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionColorPlate extends InteractionDefault {
|
public class InteractionColorPlate extends InteractionDefault {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionColorPlate.class);
|
||||||
|
|
||||||
public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException {
|
public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
}
|
}
|
||||||
@ -41,7 +44,7 @@ public class InteractionColorPlate extends InteractionDefault {
|
|||||||
try {
|
try {
|
||||||
state = Integer.valueOf(this.getExtradata());
|
state = Integer.valueOf(this.getExtradata());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
state += amount;
|
state += amount;
|
||||||
|
@ -9,12 +9,15 @@ import com.eu.habbo.habbohotel.users.HabboGender;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionDefault extends HabboItem {
|
public class InteractionDefault extends HabboItem {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionDefault.class);
|
||||||
|
|
||||||
public InteractionDefault(ResultSet set, Item baseItem) throws SQLException {
|
public InteractionDefault(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
}
|
}
|
||||||
@ -76,7 +79,7 @@ public class InteractionDefault extends HabboItem {
|
|||||||
try {
|
try {
|
||||||
currentState = Integer.valueOf(this.getExtradata());
|
currentState = Integer.valueOf(this.getExtradata());
|
||||||
} catch (NumberFormatException e) {
|
} 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());
|
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
|
||||||
@ -96,36 +99,33 @@ public class InteractionDefault extends HabboItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
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);
|
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()) {
|
if (roomUnit != null) {
|
||||||
room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
|
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||||
log.error("newHabbos Effect Female");
|
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 (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
|
||||||
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) {
|
room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
|
||||||
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM(), -1);
|
}
|
||||||
return;
|
}
|
||||||
}
|
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
||||||
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) {
|
Bot bot = room.getBot(roomUnit);
|
||||||
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF(), -1);
|
|
||||||
}
|
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
|
@Override
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
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) {
|
if (roomUnit != null) {
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
|
||||||
if (roomUnit != null) {
|
if (objects != null && objects.length == 2) {
|
||||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
|
||||||
int nextEffectM = 0;
|
RoomTile goalTile = (RoomTile) objects[0];
|
||||||
int nextEffectF = 0;
|
HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y, (objects[0] != objects[1]) ? this : null);
|
||||||
|
|
||||||
if (objects != null && objects.length == 2) {
|
if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
|
||||||
if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
|
return;
|
||||||
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())) {
|
if(topItem != null) {
|
||||||
return;
|
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)) {
|
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
||||||
room.giveEffect(habbo, nextEffectM, -1);
|
room.giveEffect(habbo, nextEffectM, -1);
|
||||||
return;
|
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 != null) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
||||||
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
room.giveEffect(habbo, nextEffectF, -1);
|
||||||
room.giveEffect(roomUnit, nextEffectM, -1);
|
}
|
||||||
return;
|
}
|
||||||
}
|
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
||||||
|
Bot bot = room.getBot(roomUnit);
|
||||||
|
|
||||||
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
if (bot != null) {
|
||||||
room.giveEffect(roomUnit, nextEffectF, -1);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,18 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionFireworks extends InteractionDefault {
|
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_EMPTY = "0"; // Not used since the removal of pixels
|
||||||
private static final String STATE_CHARGED = "1";
|
private static final String STATE_CHARGED = "1";
|
||||||
private static final String STATE_EXPLOSION = "2";
|
private static final String STATE_EXPLOSION = "2";
|
||||||
@ -125,7 +129,7 @@ public class InteractionFireworks extends InteractionDefault {
|
|||||||
try {
|
try {
|
||||||
explodeDuration = Integer.parseInt(this.getBaseItem().getCustomParams());
|
explodeDuration = Integer.parseInt(this.getBaseItem().getCustomParams());
|
||||||
} catch (NumberFormatException e) {
|
} 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() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,15 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import gnu.trove.set.hash.THashSet;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionGift extends HabboItem {
|
public class InteractionGift extends HabboItem {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGift.class);
|
||||||
|
|
||||||
public boolean explode = false;
|
public boolean explode = false;
|
||||||
private int[] itemId;
|
private int[] itemId;
|
||||||
private int colorId = 0;
|
private int colorId = 0;
|
||||||
@ -29,7 +32,7 @@ public class InteractionGift extends HabboItem {
|
|||||||
try {
|
try {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
} catch (Exception e) {
|
} 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 {
|
try {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Incorrect extradata for gift with ID " + this.getId());
|
LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,17 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionMusicDisc extends HabboItem {
|
public class InteractionMusicDisc extends HabboItem {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionMusicDisc.class);
|
||||||
|
|
||||||
private int songId;
|
private int songId;
|
||||||
|
|
||||||
public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException {
|
public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
|
|
||||||
@ -21,7 +25,7 @@ public class InteractionMusicDisc extends HabboItem {
|
|||||||
try {
|
try {
|
||||||
this.songId = Integer.valueOf(stuff[6]);
|
this.songId = Integer.valueOf(stuff[6]);
|
||||||
} catch (Exception e) {
|
} 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 {
|
try {
|
||||||
this.songId = Integer.valueOf(stuff[6]);
|
this.songId = Integer.valueOf(stuff[6]);
|
||||||
} catch (Exception e) {
|
} 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!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,34 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
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.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
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.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
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 {
|
public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
|
this.middleTiles = new THashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteractionObstacle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
public InteractionObstacle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
|
this.middleTiles = new THashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -51,79 +56,59 @@ public class InteractionObstacle extends HabboItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
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) {
|
if (pet instanceof HorsePet && ((HorsePet) pet).getRider() != null) {
|
||||||
return;
|
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)) {
|
if (state == 4)
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Random state.
|
this.setExtradata(state + "");
|
||||||
int state = 0;
|
pet.getRoomUnit().setStatus(RoomUnitStatus.JUMP, "0");
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
state = Emulator.getRandom().nextInt(4) + 1;
|
|
||||||
|
|
||||||
if (state == 4)
|
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseConsecutiveJumpsCount"));
|
||||||
break;
|
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseJumping"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setExtradata(state + "");
|
room.updateItemState(this);
|
||||||
|
}
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
super.onWalkOn(roomUnit, room, objects);
|
||||||
|
|
||||||
final HorsePet horse = room.getHabboHorse(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
|
||||||
if (horse == null) {
|
if (habbo == null) {
|
||||||
return;
|
Pet pet = room.getPet(roomUnit);
|
||||||
}
|
|
||||||
|
|
||||||
if (roomUnit.getBodyRotation().getValue() % 2 != 0) {
|
if (pet instanceof HorsePet && ((HorsePet) pet).getRider() != null) {
|
||||||
return;
|
if (roomUnit.getBodyRotation().getValue() % 2 == 0) {
|
||||||
}
|
if (this.getRotation() == 2) {
|
||||||
|
if (roomUnit.getBodyRotation().equals(RoomUserRotation.WEST)) {
|
||||||
if (this.getRotation() == 2) {
|
((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() - 3), roomUnit.getY()));
|
||||||
if (roomUnit.getBodyRotation() == RoomUserRotation.WEST) {
|
} else if (roomUnit.getBodyRotation().equals(RoomUserRotation.EAST)) {
|
||||||
roomUnit.setGoalLocation(room.getLayout().getTile((short) (roomUnit.getX() - 3), roomUnit.getY()));
|
((HorsePet) pet).getRider().getRoomUnit().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().equals(RoomUserRotation.NORTH)) {
|
||||||
} else if (this.getRotation() == 4) {
|
((HorsePet) pet).getRider().getRoomUnit().setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() - 3)));
|
||||||
if (roomUnit.getBodyRotation() == RoomUserRotation.NORTH) {
|
} else if (roomUnit.getBodyRotation().equals(RoomUserRotation.SOUTH)) {
|
||||||
roomUnit.setGoalLocation(room.getLayout().getTile(roomUnit.getX(), (short) (roomUnit.getY() - 3)));
|
((HorsePet) pet).getRider().getRoomUnit().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)));
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,12 +117,80 @@ public class InteractionObstacle extends HabboItem {
|
|||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
super.onWalkOff(roomUnit, room, objects);
|
||||||
|
|
||||||
final HorsePet horse = room.getHabboHorse(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
|
||||||
if (horse == null) {
|
if (habbo == null) {
|
||||||
return;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,15 +12,18 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceInfoComposer;
|
||||||
import com.eu.habbo.threading.runnables.ClearRentedSpace;
|
import com.eu.habbo.threading.runnables.ClearRentedSpace;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionRentableSpace extends HabboItem {
|
public class InteractionRentableSpace extends HabboItem {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionRentableSpace.class);
|
||||||
|
|
||||||
private int renterId;
|
private int renterId;
|
||||||
private String renterName;
|
private String renterName;
|
||||||
private int endTimestamp;
|
private int endTimestamp;
|
||||||
@ -51,7 +54,7 @@ public class InteractionRentableSpace extends HabboItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -181,7 +184,7 @@ public class InteractionRentableSpace extends HabboItem {
|
|||||||
statement.setInt(1, zero);
|
statement.setInt(1, zero);
|
||||||
statement.setInt(2, zero);
|
statement.setInt(2, zero);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class InteractionRoller extends HabboItem {
|
public class InteractionRoller extends HabboItem {
|
||||||
public static boolean NO_RULES = false;
|
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 {
|
public InteractionRoller(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
@ -52,7 +52,7 @@ public class InteractionRoller extends HabboItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) {
|
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,6 @@ public class InteractionTrap extends InteractionDefault {
|
|||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
if (!this.getExtradata().equals("0")) {
|
if (!this.getExtradata().equals("0")) {
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
if(habbo == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
|
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
|
||||||
roomUnit.stopWalking();
|
roomUnit.stopWalking();
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
super.onWalkOn(roomUnit, room, objects);
|
||||||
|
@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
||||||
import gnu.trove.map.hash.TLongLongHashMap;
|
import gnu.trove.map.hash.TLongLongHashMap;
|
||||||
@ -75,7 +77,7 @@ public abstract class InteractionWired extends InteractionDefault {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
|
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
|
||||||
if (!room.isHideWired()) {
|
if(!room.isHideWired()) {
|
||||||
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
|
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
|
||||||
room.sendComposer(new ItemStateComposer(this).compose());
|
room.sendComposer(new ItemStateComposer(this).compose());
|
||||||
}
|
}
|
||||||
@ -129,4 +131,35 @@ public abstract class InteractionWired extends InteractionDefault {
|
|||||||
public void addUserExecutionCache(int roomUnitId, long timestamp) {
|
public void addUserExecutionCache(int roomUnitId, long timestamp) {
|
||||||
this.userExecutionCache.put((long)roomUnitId, 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
|
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
|
||||||
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
|
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
|
|||||||
|
|
||||||
public abstract WiredConditionType getType();
|
public abstract WiredConditionType getType();
|
||||||
|
|
||||||
public abstract boolean saveData(ClientMessage packet);
|
public abstract boolean saveData(WiredSettings settings);
|
||||||
|
|
||||||
public WiredConditionOperator operator() {
|
public WiredConditionOperator operator() {
|
||||||
return WiredConditionOperator.AND;
|
return WiredConditionOperator.AND;
|
||||||
|
@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
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.incoming.wired.WiredSaveException;
|
||||||
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer;
|
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() {
|
public int getDelay() {
|
||||||
return this.delay;
|
return this.delay;
|
||||||
|
@ -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.WiredHighscoreRow;
|
||||||
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType;
|
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionWiredHighscore extends HabboItem {
|
public class InteractionWiredHighscore extends HabboItem {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWiredHighscore.class);
|
||||||
|
|
||||||
public WiredHighscoreScoreType scoreType;
|
public WiredHighscoreScoreType scoreType;
|
||||||
public WiredHighscoreClearType clearType;
|
public WiredHighscoreClearType clearType;
|
||||||
|
|
||||||
private List<WiredHighscoreRow> data;
|
private List<WiredHighscoreRow> data;
|
||||||
|
|
||||||
public InteractionWiredHighscore(ResultSet set, Item baseItem) throws SQLException {
|
public InteractionWiredHighscore(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
|
|
||||||
@ -35,7 +40,7 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
this.scoreType = WiredHighscoreScoreType.valueOf(name);
|
this.scoreType = WiredHighscoreScoreType.valueOf(name);
|
||||||
this.clearType = WiredHighscoreClearType.values()[ctype];
|
this.clearType = WiredHighscoreClearType.values()[ctype];
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
@ -53,7 +58,7 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
this.scoreType = WiredHighscoreScoreType.valueOf(name);
|
this.scoreType = WiredHighscoreScoreType.valueOf(name);
|
||||||
this.clearType = WiredHighscoreClearType.values()[ctype];
|
this.clearType = WiredHighscoreClearType.values()[ctype];
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
@ -88,7 +93,7 @@ public class InteractionWiredHighscore extends HabboItem {
|
|||||||
this.setExtradata(Math.abs(state - 1) + "");
|
this.setExtradata(Math.abs(state - 1) + "");
|
||||||
room.updateItem(this);
|
room.updateItem(this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client != null && !(objects.length >= 2 && objects[1] instanceof WiredEffectType)) {
|
if(client != null && !(objects.length >= 2 && objects[1] instanceof WiredEffectType)) {
|
||||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
@ -44,7 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
|
|||||||
|
|
||||||
public abstract WiredTriggerType getType();
|
public abstract WiredTriggerType getType();
|
||||||
|
|
||||||
public abstract boolean saveData(ClientMessage packet);
|
public abstract boolean saveData(WiredSettings settings);
|
||||||
|
|
||||||
protected int getDelay() {
|
protected int getDelay() {
|
||||||
return this.delay;
|
return this.delay;
|
||||||
|
@ -15,14 +15,18 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
|
|||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.threading.runnables.games.GameTimer;
|
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.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class InteractionGameTimer extends HabboItem implements Runnable {
|
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[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
|
||||||
|
|
||||||
private int baseTime = 0;
|
private int baseTime = 0;
|
||||||
private int timeNow = 0;
|
private int timeNow = 0;
|
||||||
private boolean isRunning = false;
|
private boolean isRunning = false;
|
||||||
@ -91,7 +95,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
|
|||||||
}
|
}
|
||||||
}).toArray();
|
}).toArray();
|
||||||
} catch (Exception e) {
|
} 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);
|
room.addGame(game);
|
||||||
game.initialise();
|
game.initialise();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
LOGGER.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,12 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -50,10 +51,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveData(ClientMessage packet) {
|
public boolean saveData(WiredSettings settings) {
|
||||||
packet.readInt();
|
if(settings.getIntParams().length < 2) return false;
|
||||||
this.startDate = packet.readInt();
|
this.startDate = settings.getIntParams()[0];
|
||||||
this.endDate = packet.readInt();
|
this.endDate = settings.getIntParams()[1];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
@ -136,15 +137,12 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveData(ClientMessage packet) {
|
public boolean saveData(WiredSettings settings) {
|
||||||
int count;
|
if(settings.getIntParams().length < 1) return false;
|
||||||
packet.readInt();
|
|
||||||
|
|
||||||
this.all = packet.readInt() == 1;
|
this.all = settings.getIntParams()[0] == 1;
|
||||||
|
|
||||||
packet.readString();
|
int count = settings.getFurniIds().length;
|
||||||
|
|
||||||
count = packet.readInt();
|
|
||||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||||
|
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
@ -153,7 +151,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
HabboItem item = room.getHabboItem(packet.readInt());
|
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.bots.Bot;
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
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.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
@ -24,8 +25,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||||
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
|
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
|
||||||
|
|
||||||
protected boolean all;
|
|
||||||
protected THashSet<HabboItem> items;
|
protected THashSet<HabboItem> items;
|
||||||
|
|
||||||
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
||||||
@ -41,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
@Override
|
@Override
|
||||||
public void onPickUp() {
|
public void onPickUp() {
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
this.all = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
this.all,
|
|
||||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -79,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (wiredData.startsWith("{")) {
|
if (wiredData.startsWith("{")) {
|
||||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
this.all = data.all;
|
|
||||||
|
|
||||||
for(int id : data.itemIds) {
|
for(int id : data.itemIds) {
|
||||||
HabboItem item = room.getHabboItem(id);
|
HabboItem item = room.getHabboItem(id);
|
||||||
@ -92,17 +88,14 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
String[] data = wiredData.split(":");
|
String[] data = wiredData.split(":");
|
||||||
|
|
||||||
if (data.length >= 1) {
|
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) {
|
for (String s : items) {
|
||||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
message.appendInt(this.getBaseItem().getSpriteId());
|
message.appendInt(this.getBaseItem().getSpriteId());
|
||||||
message.appendInt(this.getId());
|
message.appendInt(this.getId());
|
||||||
message.appendString("");
|
message.appendString("");
|
||||||
message.appendInt(1);
|
message.appendInt(0);
|
||||||
message.appendInt(this.all ? 1 : 0);
|
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
message.appendInt(this.getType().code);
|
message.appendInt(this.getType().code);
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
@ -136,13 +128,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveData(ClientMessage packet) {
|
public boolean saveData(WiredSettings settings) {
|
||||||
int count;
|
int count = settings.getFurniIds().length;
|
||||||
packet.readInt();
|
|
||||||
|
|
||||||
packet.readString();
|
|
||||||
|
|
||||||
count = packet.readInt();
|
|
||||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||||
|
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
@ -151,7 +139,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
HabboItem item = room.getHabboItem(packet.readInt());
|
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
@ -182,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class JsonData {
|
static class JsonData {
|
||||||
boolean all;
|
|
||||||
List<Integer> itemIds;
|
List<Integer> itemIds;
|
||||||
|
|
||||||
public JsonData(boolean all, List<Integer> itemIds) {
|
public JsonData(List<Integer> itemIds) {
|
||||||
this.all = all;
|
|
||||||
this.itemIds = itemIds;
|
this.itemIds = itemIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -117,11 +118,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveData(ClientMessage packet) {
|
public boolean saveData(WiredSettings settings) {
|
||||||
packet.readInt();
|
int count = settings.getFurniIds().length;
|
||||||
packet.readString();
|
|
||||||
|
|
||||||
int count = packet.readInt();
|
|
||||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||||
|
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
@ -130,7 +128,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
for (int i = 0; i < count; i++) {
|
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
Loading…
x
Reference in New Issue
Block a user