mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
Use Lombok, use math functions, encapsulate fields, use some java18 features,...
This commit is contained in:
parent
284069b509
commit
bd400bdcf0
@ -16,7 +16,7 @@ Arcturus Morningstar is as a fork of Arcturus Emulator by TheGeneral. Arcturus M
|
|||||||
[![image](https://img.shields.io/discord/557240155040251905?style=for-the-badge&logo=discord&color=7289DA&label=KREWS&logoColor=fff)](https://discord.gg/BzfFsTp)
|
[![image](https://img.shields.io/discord/557240155040251905?style=for-the-badge&logo=discord&color=7289DA&label=KREWS&logoColor=fff)](https://discord.gg/BzfFsTp)
|
||||||
|
|
||||||
## Download ##
|
## Download ##
|
||||||
[![image](https://img.shields.io/badge/STABLE%20RELEASES-3.0.0-success.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/releases)
|
[![image](https://img.shields.io/badge/STABLE%20RELEASES-3.5.1-success.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/releases)
|
||||||
|
|
||||||
[![image](https://img.shields.io/badge/DEVELOPER%20PREVIEW-4.0.0-red.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/jobs) *
|
[![image](https://img.shields.io/badge/DEVELOPER%20PREVIEW-4.0.0-red.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/jobs) *
|
||||||
|
|
||||||
|
21
pom.xml
21
pom.xml
@ -34,8 +34,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>18</source>
|
||||||
<target>1.8</target>
|
<target>18</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@ -92,21 +92,21 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-all</artifactId>
|
<artifactId>netty-all</artifactId>
|
||||||
<version>4.1.49.Final</version>
|
<version>4.1.86.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.8.6</version>
|
<version>2.8.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MySQL Connector -->
|
<!-- MySQL Connector -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.0.22</version>
|
<version>8.0.28</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -143,14 +143,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.13.1</version>
|
<version>1.15.3</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.2.3</version>
|
<version>1.2.9</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -165,5 +165,12 @@
|
|||||||
<artifactId>joda-time</artifactId>
|
<artifactId>joda-time</artifactId>
|
||||||
<version>2.10.6</version>
|
<version>2.10.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.24</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
2
sqlupdates/Update 3_5_0 to 3_5_2.sql
Normal file
2
sqlupdates/Update 3_5_0 to 3_5_2.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-- Trade Currency Setting
|
||||||
|
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('redeem.currency.trade', '1');
|
@ -17,6 +17,7 @@ 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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
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 {
|
||||||
|
|
||||||
public static final int MAJOR = 4;
|
public static final int MAJOR = 4;
|
||||||
@ -45,14 +47,17 @@ public final class Emulator {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
|
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 String logo =
|
private static final String logo =
|
||||||
"\n" +
|
"""
|
||||||
"███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
|
|
||||||
"████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗\n" +
|
███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗\s
|
||||||
"██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
|
████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗
|
||||||
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
|
██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝
|
||||||
"██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
|
██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗
|
||||||
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n";
|
██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║
|
||||||
|
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝
|
||||||
|
""";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +69,6 @@ public final class Emulator {
|
|||||||
private static GameServer gameServer;
|
private static GameServer gameServer;
|
||||||
private static RCONServer rconServer;
|
private static RCONServer rconServer;
|
||||||
private static CameraClient cameraClient;
|
private static CameraClient cameraClient;
|
||||||
private static Logging logging;
|
|
||||||
private static Database database;
|
private static Database database;
|
||||||
private static DatabaseLogger databaseLogger;
|
private static DatabaseLogger databaseLogger;
|
||||||
private static ThreadPooling threading;
|
private static ThreadPooling threading;
|
||||||
@ -90,7 +94,7 @@ public final class Emulator {
|
|||||||
scanner.nextLine();
|
scanner.nextLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
// Check if running on Windows and not in IntelliJ.
|
// Check if running on Windows and not in IntelliJ.
|
||||||
// If so, we need to reconfigure the console appender and enable Jansi for colors.
|
// If so, we need to reconfigure the console appender and enable Jansi for colors.
|
||||||
@ -107,7 +111,6 @@ public final class Emulator {
|
|||||||
setBuild();
|
setBuild();
|
||||||
Emulator.stopped = false;
|
Emulator.stopped = false;
|
||||||
ConsoleCommand.load();
|
ConsoleCommand.load();
|
||||||
Emulator.logging = new Logging();
|
|
||||||
|
|
||||||
System.out.println(logo);
|
System.out.println(logo);
|
||||||
|
|
||||||
@ -116,11 +119,11 @@ public final class Emulator {
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
promptEnterKey();
|
promptEnterKey();
|
||||||
}
|
}
|
||||||
LOGGER.info("eek. Has it really been a year?");
|
log.info("eek. Has it really been a year?");
|
||||||
LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
log.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
||||||
LOGGER.info("Version: {}", version);
|
log.info("Version: {}", version);
|
||||||
LOGGER.info("Build: {}", build);
|
log.info("Build: {}", build);
|
||||||
LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
|
log.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
|
||||||
|
|
||||||
long startTime = System.nanoTime();
|
long startTime = System.nanoTime();
|
||||||
|
|
||||||
@ -153,16 +156,16 @@ public final class Emulator {
|
|||||||
Emulator.rconServer.connect();
|
Emulator.rconServer.connect();
|
||||||
Emulator.badgeImager = new BadgeImager();
|
Emulator.badgeImager = new BadgeImager();
|
||||||
|
|
||||||
LOGGER.info("Arcturus Morningstar has successfully loaded.");
|
log.info("Arcturus Morningstar has successfully loaded.");
|
||||||
LOGGER.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
|
log.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
|
||||||
LOGGER.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
|
log.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");
|
||||||
|
|
||||||
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);
|
||||||
LOGGER.debug("Debugging enabled.");
|
log.debug("Debugging enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
|
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
|
||||||
@ -170,7 +173,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)) {
|
||||||
LOGGER.warn("Emulator settings runtime.threads ({}) can be increased to ({}) to possibly increase performance.",
|
log.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);
|
||||||
}
|
}
|
||||||
@ -193,7 +196,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"))) {
|
||||||
LOGGER.error("Error while reading command", e);
|
log.error("Error while reading command", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +237,7 @@ public final class Emulator {
|
|||||||
Emulator.isShuttingDown = true;
|
Emulator.isShuttingDown = true;
|
||||||
Emulator.isReady = false;
|
Emulator.isReady = false;
|
||||||
|
|
||||||
LOGGER.info("Stopping Arcturus Morningstar {}", version);
|
log.info("Stopping Arcturus Morningstar {}", version);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Emulator.getPluginManager() != null)
|
if (Emulator.getPluginManager() != null)
|
||||||
@ -285,7 +288,7 @@ public final class Emulator {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Stopped Arcturus Morningstar {}", version);
|
log.info("Stopped Arcturus Morningstar {}", version);
|
||||||
|
|
||||||
if (Emulator.database != null) {
|
if (Emulator.database != null) {
|
||||||
Emulator.getDatabase().dispose();
|
Emulator.getDatabase().dispose();
|
||||||
@ -332,13 +335,6 @@ public final class Emulator {
|
|||||||
return rconServer;
|
return rconServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Logging getLogging() {
|
|
||||||
return logging;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ThreadPooling getThreading() {
|
public static ThreadPooling getThreading() {
|
||||||
return threading;
|
return threading;
|
||||||
@ -384,7 +380,7 @@ public final class Emulator {
|
|||||||
int totalSeconds = 0;
|
int totalSeconds = 0;
|
||||||
|
|
||||||
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
||||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
Map<String,Integer> map = new HashMap<>();
|
||||||
map.put("second", 1);
|
map.put("second", 1);
|
||||||
map.put("minute", 60);
|
map.put("minute", 60);
|
||||||
map.put("hour", 3600);
|
map.put("hour", 3600);
|
||||||
@ -406,13 +402,12 @@ public final class Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Date modifyDate(Date date, String timeString) {
|
public static Date modifyDate(Date date, String timeString) {
|
||||||
int totalSeconds = 0;
|
|
||||||
|
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
c.setTime(date);
|
c.setTime(date);
|
||||||
|
|
||||||
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
|
||||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
Map<String, Integer> map = new HashMap<>();
|
||||||
map.put("second", Calendar.SECOND);
|
map.put("second", Calendar.SECOND);
|
||||||
map.put("minute", Calendar.MINUTE);
|
map.put("minute", Calendar.MINUTE);
|
||||||
map.put("hour", Calendar.HOUR);
|
map.put("hour", Calendar.HOUR);
|
||||||
@ -451,7 +446,7 @@ public final class Emulator {
|
|||||||
try {
|
try {
|
||||||
res = format.parse(date);
|
res = format.parse(date);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error parsing date", e);
|
log.error("Error parsing date", e);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@ import com.eu.habbo.messages.incoming.friends.HabboSearchEvent;
|
|||||||
import com.eu.habbo.messages.incoming.navigator.RoomTextSearchEvent;
|
import com.eu.habbo.messages.incoming.navigator.RoomTextSearchEvent;
|
||||||
import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
|
import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
|
||||||
import com.eu.habbo.threading.runnables.AchievementUpdater;
|
import com.eu.habbo.threading.runnables.AchievementUpdater;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -16,10 +15,9 @@ 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;
|
||||||
@ -128,10 +126,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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Database -> Cleaned!");
|
log.info("Database -> Cleaned!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refillDailyRespects() {
|
public void refillDailyRespects() {
|
||||||
@ -140,13 +138,13 @@ 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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.isReady) {
|
if (Emulator.isReady) {
|
||||||
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||||
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
|
habbo.getHabboStats().setRespectPointsToGive(Emulator.getConfig().getInt("hotel.daily.respect"));
|
||||||
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
|
habbo.getHabboStats().setPetRespectPointsToGive(Emulator.getConfig().getInt("hotel.daily.respect.pets"));
|
||||||
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +160,7 @@ public class CleanerThread implements Runnable {
|
|||||||
habbo.clearCaches();
|
habbo.clearCaches();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ package com.eu.habbo.core;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.commands.Command;
|
import com.eu.habbo.habbohotel.commands.Command;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class CommandLog implements DatabaseLoggable {
|
public class CommandLog implements DatabaseLoggable {
|
||||||
|
|
||||||
private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
|
private static final String INSERT_QUERY = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
|
||||||
@ -16,13 +18,6 @@ public class CommandLog implements DatabaseLoggable {
|
|||||||
private final String params;
|
private final String params;
|
||||||
private final boolean succes;
|
private final boolean succes;
|
||||||
|
|
||||||
public CommandLog(int userId, Command command, String params, boolean succes) {
|
|
||||||
this.userId = userId;
|
|
||||||
this.command = command;
|
|
||||||
this.params = params;
|
|
||||||
this.succes = succes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getQuery() {
|
public String getQuery() {
|
||||||
return CommandLog.INSERT_QUERY;
|
return CommandLog.INSERT_QUERY;
|
||||||
|
@ -3,21 +3,18 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.sql.*;
|
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;
|
||||||
@ -47,11 +44,11 @@ public class ConfigurationManager {
|
|||||||
if (!useEnvVarsForDbConnection) {
|
if (!useEnvVarsForDbConnection) {
|
||||||
try {
|
try {
|
||||||
File f = new File(this.configurationPath);
|
File f = new File(this.configurationPath);
|
||||||
input = new FileInputStream(f);
|
input = Files.newInputStream(f.toPath());
|
||||||
this.properties.load(input);
|
this.properties.load(input);
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LOGGER.error("Failed to load config file.", ex);
|
log.error("Failed to load config file.", ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
@ -92,7 +89,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) {
|
||||||
LOGGER.info("Cannot find environment-value for variable `" + entry.getValue() + "`");
|
log.info("Cannot find environment-value for variable `" + entry.getValue() + "`");
|
||||||
} else {
|
} else {
|
||||||
this.properties.setProperty(entry.getKey(), envValue);
|
this.properties.setProperty(entry.getKey(), envValue);
|
||||||
}
|
}
|
||||||
@ -104,7 +101,7 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
LOGGER.info("Configuration Manager -> Loaded!");
|
log.info("Configuration Manager -> Loaded!");
|
||||||
|
|
||||||
if (Emulator.getPluginManager() != null) {
|
if (Emulator.getPluginManager() != null) {
|
||||||
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
|
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
|
||||||
@ -112,7 +109,7 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadFromDatabase() {
|
public void loadFromDatabase() {
|
||||||
LOGGER.info("Loading configuration from database...");
|
log.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()) {
|
||||||
@ -124,10 +121,10 @@ public class ConfigurationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveToDatabase() {
|
public void saveToDatabase() {
|
||||||
@ -138,7 +135,7 @@ public class ConfigurationManager {
|
|||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +150,7 @@ public class ConfigurationManager {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
||||||
if (!this.properties.containsKey(key)) {
|
if (!this.properties.containsKey(key)) {
|
||||||
LOGGER.error("Config key not found {}", key);
|
log.error("Config key not found {}", key);
|
||||||
}
|
}
|
||||||
return this.properties.getProperty(key, defaultValue);
|
return this.properties.getProperty(key, defaultValue);
|
||||||
}
|
}
|
||||||
@ -169,7 +166,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) {
|
||||||
LOGGER.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key));
|
log.error("Failed to parse key {} with value '{}' to type boolean.", key, this.getValue(key));
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -185,15 +182,11 @@ 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) {
|
||||||
LOGGER.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key));
|
log.error("Failed to parse key {} with value '{}' to type integer.", key, this.getValue(key));
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDouble(String key) {
|
|
||||||
return this.getDouble(key, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble(String key, Double defaultValue) {
|
public double getDouble(String key, Double defaultValue) {
|
||||||
if (this.isLoading)
|
if (this.isLoading)
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -201,7 +194,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) {
|
||||||
LOGGER.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key));
|
log.error("Failed to parse key {} with value '{}' to type double.", key, this.getValue(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -220,7 +213,7 @@ public class ConfigurationManager {
|
|||||||
statement.setString(2, value);
|
statement.setString(2, value);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update(key, value);
|
this.update(key, value);
|
||||||
|
@ -2,14 +2,13 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -52,10 +51,10 @@ public class CreditsScheduler extends Scheduler {
|
|||||||
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
|
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CryptoConfig {
|
public class CryptoConfig {
|
||||||
|
|
||||||
private final boolean enabled;
|
private final boolean enabled;
|
||||||
@ -7,27 +12,4 @@ public class CryptoConfig {
|
|||||||
private final String modulus;
|
private final String modulus;
|
||||||
private final String privateExponent;
|
private final String privateExponent;
|
||||||
|
|
||||||
public CryptoConfig(boolean enabled, String exponent, String modulus, String privateExponent) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
this.exponent = exponent;
|
|
||||||
this.modulus = modulus;
|
|
||||||
this.privateExponent = privateExponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExponent() {
|
|
||||||
return exponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getModulus() {
|
|
||||||
return modulus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrivateExponent() {
|
|
||||||
return privateExponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class DatabaseLogger {
|
public class DatabaseLogger {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class);
|
|
||||||
|
|
||||||
private final ConcurrentLinkedQueue<DatabaseLoggable> loggables = new ConcurrentLinkedQueue<>();
|
private final ConcurrentLinkedQueue<DatabaseLoggable> loggables = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
public void store(DatabaseLoggable loggable) {
|
public void store(DatabaseLoggable loggable) {
|
||||||
@ -39,7 +36,7 @@ public class DatabaseLogger {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Exception caught while saving loggables to database.", e);
|
log.error("Exception caught while saving loggables to database.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@ -10,9 +9,9 @@ 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;
|
||||||
@ -38,7 +37,7 @@ public class ErrorLog implements DatabaseLoggable {
|
|||||||
pw.close();
|
pw.close();
|
||||||
sw.close();
|
sw.close();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
LOGGER.error("Exception caught", e1);
|
log.error("Exception caught", e1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,15 +2,12 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -68,7 +65,7 @@ public class GotwPointsScheduler extends Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
package com.eu.habbo.core;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class Logging {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger("LegacyLogger");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logStart(Object line) {
|
|
||||||
LOGGER.info("[LOADING] {}", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logShutdownLine(Object line) {
|
|
||||||
LOGGER.info("[SHUTDOWN] {}", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logUserLine(Object line) {
|
|
||||||
LOGGER.info("[USER] {}", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logDebugLine(Object line) {
|
|
||||||
LOGGER.debug("[DEBUG] {}", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logPacketLine(Object line) {
|
|
||||||
if (Emulator.getConfig().getBoolean("debug.show.packets")) {
|
|
||||||
LOGGER.debug("[PACKET] {}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logUndefinedPacketLine(Object line) {
|
|
||||||
if (Emulator.getConfig().getBoolean("debug.show.packets.undefined")) {
|
|
||||||
LOGGER.debug("[PACKET] [UNDEFINED] {}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logErrorLine(Object line) {
|
|
||||||
LOGGER.error("[ERROR] {}", line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logSQLException(SQLException e) {
|
|
||||||
LOGGER.error("[ERROR] SQLException", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void logPacketError(Object e) {
|
|
||||||
LOGGER.error("[ERROR] PacketError {}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void handleException(Exception e) {
|
|
||||||
LOGGER.error("[ERROR] Exception", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -2,15 +2,12 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -52,7 +49,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,13 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -55,7 +54,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,15 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class RoomUserPetComposer extends MessageComposer {
|
public class RoomUserPetComposer extends MessageComposer {
|
||||||
private final int petType;
|
private final int petType;
|
||||||
private final int race;
|
private final int race;
|
||||||
private final String color;
|
private final String color;
|
||||||
private final Habbo habbo;
|
private final Habbo habbo;
|
||||||
|
|
||||||
public RoomUserPetComposer(int petType, int race, String color, Habbo habbo) {
|
|
||||||
this.petType = petType;
|
|
||||||
this.race = race;
|
|
||||||
this.color = color;
|
|
||||||
this.habbo = habbo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ServerMessage composeInternal() {
|
protected ServerMessage composeInternal() {
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
package com.eu.habbo.core;
|
package com.eu.habbo.core;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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() {
|
||||||
@ -21,9 +18,9 @@ public class TextsManager {
|
|||||||
try {
|
try {
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
||||||
LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +34,7 @@ public class TextsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +44,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)) {
|
||||||
LOGGER.error("Text key not found: {}", key);
|
log.error("Text key not found: {}", key);
|
||||||
}
|
}
|
||||||
return this.texts.getProperty(key, defaultValue);
|
return this.texts.getProperty(key, defaultValue);
|
||||||
}
|
}
|
||||||
@ -60,7 +57,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -73,7 +70,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -91,7 +88,7 @@ public class TextsManager {
|
|||||||
statement.setString(2, value);
|
statement.setString(2, value);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update(key, value);
|
this.update(key, value);
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -45,14 +44,14 @@ public abstract class ConsoleCommand {
|
|||||||
command.handle(message);
|
command.handle(message);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Unknown Console Command " + message[0]);
|
log.info("Unknown Console Command " + message[0]);
|
||||||
LOGGER.info("Commands Available (" + commands.size() + "): ");
|
log.info("Commands Available (" + commands.size() + "): ");
|
||||||
|
|
||||||
for (ConsoleCommand c : commands.values()) {
|
for (ConsoleCommand c : commands.values()) {
|
||||||
LOGGER.info(c.key + " - " + c.usage);
|
log.info(c.key + " - " + c.usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,12 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.");
|
||||||
@ -22,21 +21,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);
|
||||||
|
|
||||||
LOGGER.info("Emulator version: " + Emulator.version);
|
log.info("Emulator version: " + Emulator.version);
|
||||||
LOGGER.info("Emulator build: " + Emulator.build);
|
log.info("Emulator build: " + Emulator.build);
|
||||||
|
|
||||||
LOGGER.info("");
|
log.info("");
|
||||||
|
|
||||||
LOGGER.info("Hotel Statistics");
|
log.info("Hotel Statistics");
|
||||||
LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
|
log.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
|
||||||
LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
|
log.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
|
||||||
LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
|
log.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
|
||||||
LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
|
log.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
|
||||||
LOGGER.info("");
|
log.info("");
|
||||||
LOGGER.info("Server Statistics");
|
log.info("Server Statistics");
|
||||||
LOGGER.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
|
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("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
|
log.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
|
||||||
LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
|
log.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
|
||||||
LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
|
log.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,10 @@
|
|||||||
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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.");
|
||||||
@ -13,7 +12,7 @@ public class ConsoleReconnectCameraCommand extends ConsoleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
LOGGER.info("Connecting to the camera...");
|
log.info("Connecting to the camera...");
|
||||||
CameraClient.attemptReconnect = true;
|
CameraClient.attemptReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,11 +3,10 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.");
|
||||||
@ -16,7 +15,7 @@ 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) {
|
||||||
LOGGER.info("This is a test command for live debugging.");
|
log.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);
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.");
|
||||||
@ -14,7 +13,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()) {
|
||||||
LOGGER.info(interaction);
|
log.info(interaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,10 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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");
|
||||||
@ -14,7 +13,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()) {
|
||||||
LOGGER.info(command);
|
log.info(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.eu.habbo.core.consolecommands;
|
package com.eu.habbo.core.consolecommands;
|
||||||
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.");
|
||||||
@ -13,31 +12,31 @@ public class ThankyouArcturusCommand extends ConsoleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String[] args) throws Exception {
|
public void handle(String[] args) throws Exception {
|
||||||
LOGGER.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
|
log.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
|
||||||
LOGGER.info("Thankyou to the following people who have helped with it's development:");
|
log.info("Thankyou to the following people who have helped with it's development:");
|
||||||
LOGGER.info("TheGeneral - For Creating Arcturus.");
|
log.info("TheGeneral - For Creating Arcturus.");
|
||||||
LOGGER.info("Capheus - Decompilation");
|
log.info("Capheus - Decompilation");
|
||||||
LOGGER.info("Beny - Lead Developer");
|
log.info("Beny - Lead Developer");
|
||||||
LOGGER.info("Alejandro - Lead Developer");
|
log.info("Alejandro - Lead Developer");
|
||||||
LOGGER.info("Harmonic - Developer");
|
log.info("Harmonic - Developer");
|
||||||
LOGGER.info("ArpyAge - Developer");
|
log.info("ArpyAge - Developer");
|
||||||
LOGGER.info("Mike - Developer");
|
log.info("Mike - Developer");
|
||||||
LOGGER.info("Skeletor - Developer");
|
log.info("Skeletor - Developer");
|
||||||
LOGGER.info("zGrav - Developer");
|
log.info("zGrav - Developer");
|
||||||
LOGGER.info("Swirny - Developer");
|
log.info("Swirny - Developer");
|
||||||
LOGGER.info("Quadral - Developer");
|
log.info("Quadral - Developer");
|
||||||
LOGGER.info("Dome - Developer");
|
log.info("Dome - Developer");
|
||||||
LOGGER.info("Necmi - Developer");
|
log.info("Necmi - Developer");
|
||||||
LOGGER.info("Oliver - Support");
|
log.info("Oliver - Support");
|
||||||
LOGGER.info("Rasmus - Support");
|
log.info("Rasmus - Support");
|
||||||
LOGGER.info("Layne - Support");
|
log.info("Layne - Support");
|
||||||
LOGGER.info("Bill - Support");
|
log.info("Bill - Support");
|
||||||
LOGGER.info("Harmony - Support");
|
log.info("Harmony - Support");
|
||||||
LOGGER.info("Ridge - Catalogue");
|
log.info("Ridge - Catalogue");
|
||||||
LOGGER.info("Tenshie - Catalogue");
|
log.info("Tenshie - Catalogue");
|
||||||
LOGGER.info("Wulles - Catalogue");
|
log.info("Wulles - Catalogue");
|
||||||
LOGGER.info("Gizmo - Catalogue");
|
log.info("Gizmo - Catalogue");
|
||||||
LOGGER.info("TheJava - Motivation");
|
log.info("TheJava - Motivation");
|
||||||
LOGGER.info("The Entire Krews.org Community.");
|
log.info("The Entire Krews.org Community.");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -83,7 +83,7 @@ public class HabboDiffieHellman {
|
|||||||
this.DHPrime = decryptBigInteger(signedPrime);
|
this.DHPrime = decryptBigInteger(signedPrime);
|
||||||
this.DHGenerator = decryptBigInteger(signedGenerator);
|
this.DHGenerator = decryptBigInteger(signedGenerator);
|
||||||
|
|
||||||
if (this.DHPrime == null || this.DHGenerator == null) {
|
if (this.DHPrime == null) {
|
||||||
throw new HabboCryptoException("DHPrime or DHGenerator was null.");
|
throw new HabboCryptoException("DHPrime or DHGenerator was null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -15,10 +14,8 @@ 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;
|
||||||
|
|
||||||
@ -30,21 +27,21 @@ public class Database {
|
|||||||
try {
|
try {
|
||||||
this.databasePool = new DatabasePool();
|
this.databasePool = new DatabasePool();
|
||||||
if (!this.databasePool.getStoragePooling(config)) {
|
if (!this.databasePool.getStoragePooling(config)) {
|
||||||
LOGGER.info("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down...");
|
log.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;
|
||||||
LOGGER.error("Failed to connect to your database.", e);
|
log.error("Failed to connect to your database.", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (SQLException) {
|
if (SQLException) {
|
||||||
Emulator.prepareShutdown();
|
Emulator.prepareShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -64,7 +61,7 @@ public class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static PreparedStatement preparedStatementWithParams(Connection connection, String query, THashMap<String, Object> queryParams) throws SQLException {
|
public static PreparedStatement preparedStatementWithParams(Connection connection, String query, THashMap<String, Object> queryParams) throws SQLException {
|
||||||
THashMap<Integer, Object> params = new THashMap<Integer, Object>();
|
THashMap<Integer, Object> params = new THashMap<>();
|
||||||
THashSet<String> quotedParams = new THashSet<>();
|
THashSet<String> quotedParams = new THashSet<>();
|
||||||
|
|
||||||
for(String key : queryParams.keySet()) {
|
for(String key : queryParams.keySet()) {
|
||||||
|
@ -3,11 +3,8 @@ 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 org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
class DatabasePool {
|
class DatabasePool {
|
||||||
private final Logger log = LoggerFactory.getLogger(DatabasePool.class);
|
|
||||||
private HikariDataSource database;
|
private HikariDataSource database;
|
||||||
|
|
||||||
public boolean getStoragePooling(ConfigurationManager config) {
|
public boolean getStoragePooling(ConfigurationManager config) {
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.eu.habbo.habbohotel;
|
package com.eu.habbo.habbohotel;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.core.*;
|
import com.eu.habbo.core.CreditsScheduler;
|
||||||
|
import com.eu.habbo.core.GotwPointsScheduler;
|
||||||
|
import com.eu.habbo.core.PixelScheduler;
|
||||||
|
import com.eu.habbo.core.PointsScheduler;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.bots.BotManager;
|
import com.eu.habbo.habbohotel.bots.BotManager;
|
||||||
import com.eu.habbo.habbohotel.campaign.CalendarManager;
|
import com.eu.habbo.habbohotel.campaign.CalendarManager;
|
||||||
@ -23,18 +26,17 @@ 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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Getter
|
||||||
public class GameEnvironment {
|
public class GameEnvironment {
|
||||||
|
private CreditsScheduler creditsScheduler;
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class);
|
private PixelScheduler pixelScheduler;
|
||||||
|
private PointsScheduler pointsScheduler;
|
||||||
public CreditsScheduler creditsScheduler;
|
private GotwPointsScheduler gotwPointsScheduler;
|
||||||
public PixelScheduler pixelScheduler;
|
private SubscriptionScheduler subscriptionScheduler;
|
||||||
public PointsScheduler pointsScheduler;
|
|
||||||
public GotwPointsScheduler gotwPointsScheduler;
|
|
||||||
public SubscriptionScheduler subscriptionScheduler;
|
|
||||||
|
|
||||||
private HabboManager habboManager;
|
private HabboManager habboManager;
|
||||||
private NavigatorManager navigatorManager;
|
private NavigatorManager navigatorManager;
|
||||||
@ -58,7 +60,7 @@ public class GameEnvironment {
|
|||||||
private CalendarManager calendarManager;
|
private CalendarManager calendarManager;
|
||||||
|
|
||||||
public void load() throws Exception {
|
public void load() throws Exception {
|
||||||
LOGGER.info("GameEnvironment -> Loading...");
|
log.info("GameEnvironment -> Loading...");
|
||||||
|
|
||||||
this.permissionsManager = new PermissionsManager();
|
this.permissionsManager = new PermissionsManager();
|
||||||
this.habboManager = new HabboManager();
|
this.habboManager = new HabboManager();
|
||||||
@ -100,7 +102,7 @@ public class GameEnvironment {
|
|||||||
this.subscriptionScheduler = new SubscriptionScheduler();
|
this.subscriptionScheduler = new SubscriptionScheduler();
|
||||||
Emulator.getThreading().run(this.subscriptionScheduler);
|
Emulator.getThreading().run(this.subscriptionScheduler);
|
||||||
|
|
||||||
LOGGER.info("GameEnvironment -> Loaded!");
|
log.info("GameEnvironment -> Loaded!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -118,98 +120,7 @@ public class GameEnvironment {
|
|||||||
this.hotelViewManager.dispose();
|
this.hotelViewManager.dispose();
|
||||||
this.subscriptionManager.dispose();
|
this.subscriptionManager.dispose();
|
||||||
this.calendarManager.dispose();
|
this.calendarManager.dispose();
|
||||||
LOGGER.info("GameEnvironment -> Disposed!");
|
log.info("GameEnvironment -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public HabboManager getHabboManager() {
|
|
||||||
return this.habboManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NavigatorManager getNavigatorManager() {
|
|
||||||
return this.navigatorManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuildManager getGuildManager() {
|
|
||||||
return this.guildManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemManager getItemManager() {
|
|
||||||
return this.itemManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CatalogManager getCatalogManager() {
|
|
||||||
return this.catalogManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HotelViewManager getHotelViewManager() {
|
|
||||||
return this.hotelViewManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoomManager getRoomManager() {
|
|
||||||
return this.roomManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandHandler getCommandHandler() {
|
|
||||||
return this.commandHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PermissionsManager getPermissionsManager() {
|
|
||||||
return this.permissionsManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BotManager getBotManager() {
|
|
||||||
return this.botManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModToolManager getModToolManager() {
|
|
||||||
return this.modToolManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModToolSanctions getModToolSanctions() {
|
|
||||||
return this.modToolSanctions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PetManager getPetManager() {
|
|
||||||
return this.petManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AchievementManager getAchievementManager() {
|
|
||||||
return this.achievementManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuideManager getGuideManager() {
|
|
||||||
return this.guideManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WordFilter getWordFilter() {
|
|
||||||
return this.wordFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CraftingManager getCraftingManager() {
|
|
||||||
return this.craftingManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PollManager getPollManager() {
|
|
||||||
return this.pollManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreditsScheduler getCreditsScheduler() {
|
|
||||||
return this.creditsScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PixelScheduler getPixelScheduler() {
|
|
||||||
return this.pixelScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PointsScheduler getPointsScheduler() { return this.pointsScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GotwPointsScheduler getGotwPointsScheduler() { return this.gotwPointsScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SubscriptionManager getSubscriptionManager() {
|
|
||||||
return this.subscriptionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CalendarManager getCalendarManager() { return this.calendarManager; }
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class Achievement {
|
|||||||
|
|
||||||
public void addLevel(AchievementLevel level) {
|
public void addLevel(AchievementLevel level) {
|
||||||
synchronized (this.levels) {
|
synchronized (this.levels) {
|
||||||
this.levels.put(level.level, level);
|
this.levels.put(level.getLevel(), level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ public class Achievement {
|
|||||||
AchievementLevel l = null;
|
AchievementLevel l = null;
|
||||||
if (progress > 0) {
|
if (progress > 0) {
|
||||||
for (AchievementLevel level : this.levels.values()) {
|
for (AchievementLevel level : this.levels.values()) {
|
||||||
if (progress >= level.progress) {
|
if (progress >= level.getProgress()) {
|
||||||
if (l != null) {
|
if (l != null) {
|
||||||
if (l.level > level.level) {
|
if (l.getLevel() > level.getLevel()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ public class Achievement {
|
|||||||
AchievementLevel l = null;
|
AchievementLevel l = null;
|
||||||
|
|
||||||
for (AchievementLevel level : this.levels.values()) {
|
for (AchievementLevel level : this.levels.values()) {
|
||||||
if (level.level == (currentLevel + 1))
|
if (level.getLevel() == (currentLevel + 1))
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package com.eu.habbo.habbohotel.achievements;
|
package com.eu.habbo.habbohotel.achievements;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class AchievementLevel {
|
public class AchievementLevel {
|
||||||
|
|
||||||
public final int level;
|
private final int level;
|
||||||
|
private final int rewardAmount;
|
||||||
|
private final int rewardType;
|
||||||
|
|
||||||
|
private final int points;
|
||||||
|
|
||||||
public final int rewardAmount;
|
private final int progress;
|
||||||
|
|
||||||
|
|
||||||
public final int rewardType;
|
|
||||||
|
|
||||||
|
|
||||||
public final int points;
|
|
||||||
|
|
||||||
|
|
||||||
public final int progress;
|
|
||||||
|
|
||||||
public AchievementLevel(ResultSet set) throws SQLException {
|
public AchievementLevel(ResultSet set) throws SQLException {
|
||||||
this.level = set.getInt("level");
|
this.level = set.getInt("level");
|
||||||
|
@ -8,8 +8,8 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
|||||||
import com.eu.habbo.messages.outgoing.achievements.AchievementComposer;
|
import com.eu.habbo.messages.outgoing.achievements.AchievementComposer;
|
||||||
import com.eu.habbo.messages.outgoing.achievements.AchievementUnlockedComposer;
|
import com.eu.habbo.messages.outgoing.achievements.AchievementUnlockedComposer;
|
||||||
import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentLevelUpComposer;
|
import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentLevelUpComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
||||||
@ -18,16 +18,14 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -59,7 +57,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(4, amount);
|
statement.setInt(4, amount);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +95,7 @@ public class AchievementManager {
|
|||||||
|
|
||||||
AchievementLevel oldLevel = achievement.getLevelForProgress(currentProgress);
|
AchievementLevel oldLevel = achievement.getLevelForProgress(currentProgress);
|
||||||
|
|
||||||
if (oldLevel != null && (oldLevel.level == achievement.levels.size() && currentProgress >= oldLevel.progress)) //Maximum achievement gotten.
|
if (oldLevel != null && (oldLevel.getLevel() == achievement.levels.size() && currentProgress >= oldLevel.getProgress())) //Maximum achievement gotten.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
habbo.getHabboStats().setProgress(achievement, currentProgress + amount);
|
habbo.getHabboStats().setProgress(achievement, currentProgress + amount);
|
||||||
@ -109,7 +107,7 @@ public class AchievementManager {
|
|||||||
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type)) {
|
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type)) {
|
||||||
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet()) {
|
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet()) {
|
||||||
if (entry.getValue().achievements.containsKey(achievement)) {
|
if (entry.getValue().achievements.containsKey(achievement)) {
|
||||||
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
|
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +116,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newLevel == null ||
|
if (newLevel == null ||
|
||||||
(oldLevel != null && (oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size()))) {
|
(oldLevel != null && (oldLevel.getLevel() == newLevel.getLevel() && newLevel.getLevel() < achievement.levels.size()))) {
|
||||||
habbo.getClient().sendResponse(new AchievementComposer(habbo, achievement));
|
habbo.getClient().sendResponse(new AchievementComposer(habbo, achievement));
|
||||||
} else {
|
} else {
|
||||||
if (Emulator.getPluginManager().isRegistered(UserAchievementLeveledEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(UserAchievementLeveledEvent.class, true)) {
|
||||||
@ -139,14 +137,14 @@ public class AchievementManager {
|
|||||||
|
|
||||||
if (oldLevel != null) {
|
if (oldLevel != null) {
|
||||||
try {
|
try {
|
||||||
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase());
|
badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.getLevel()).toLowerCase());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String newBadgCode = "ACH_" + achievement.name + newLevel.level;
|
String newBadgCode = "ACH_" + achievement.name + newLevel.getLevel();
|
||||||
|
|
||||||
if (badge != null) {
|
if (badge != null) {
|
||||||
badge.setCode(newBadgCode);
|
badge.setCode(newBadgCode);
|
||||||
@ -173,10 +171,10 @@ public class AchievementManager {
|
|||||||
|
|
||||||
habbo.getClient().sendResponse(new UnseenItemsComposer(badge.getId(), UnseenItemsComposer.AddHabboItemCategory.BADGE));
|
habbo.getClient().sendResponse(new UnseenItemsComposer(badge.getId(), UnseenItemsComposer.AddHabboItemCategory.BADGE));
|
||||||
|
|
||||||
habbo.getHabboStats().addAchievementScore(newLevel.points);
|
habbo.getHabboStats().addAchievementScore(newLevel.getPoints());
|
||||||
|
|
||||||
if (newLevel.rewardAmount > 0) {
|
if (newLevel.getRewardAmount() > 0) {
|
||||||
habbo.givePoints(newLevel.rewardType, newLevel.rewardAmount);
|
habbo.givePoints(newLevel.getRewardType(), newLevel.getRewardAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() != null) {
|
if (habbo.getHabboInfo().getCurrentRoom() != null) {
|
||||||
@ -197,9 +195,9 @@ public class AchievementManager {
|
|||||||
if (level == null)
|
if (level == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AchievementLevel nextLevel = achievement.levels.get(level.level + 1);
|
AchievementLevel nextLevel = achievement.levels.get(level.getLevel() + 1);
|
||||||
|
|
||||||
return nextLevel == null && currentProgress >= level.progress;
|
return nextLevel == null && currentProgress >= level.getProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createUserEntry(Habbo habbo, Achievement achievement) {
|
public static void createUserEntry(Habbo habbo, Achievement achievement) {
|
||||||
@ -209,7 +207,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(3, 1);
|
statement.setInt(3, 1);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +221,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +235,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -260,9 +258,9 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,13 +280,13 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
LOGGER.error("Achievement Manager -> Failed to load!");
|
log.error("Achievement Manager -> Failed to load!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Achievement getAchievement(String name) {
|
public Achievement getAchievement(String name) {
|
||||||
@ -343,7 +341,7 @@ public class AchievementManager {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleTalentTrackAchievement(Habbo habbo, TalentTrackType type, Achievement achievement) {
|
public void handleTalentTrackAchievement(Habbo habbo, TalentTrackType type) {
|
||||||
TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type);
|
TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type);
|
||||||
|
|
||||||
if (currentLevel != null) {
|
if (currentLevel != null) {
|
||||||
@ -375,7 +373,8 @@ public class AchievementManager {
|
|||||||
if (level.perks != null && level.perks.length > 0) {
|
if (level.perks != null && level.perks.length > 0) {
|
||||||
for (String perk : level.perks) {
|
for (String perk : level.perks) {
|
||||||
if (perk.equalsIgnoreCase("TRADE")) {
|
if (perk.equalsIgnoreCase("TRADE")) {
|
||||||
habbo.getHabboStats().perkTrade = true;
|
habbo.getHabboStats().setPerkTrade(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,13 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
public TObjectIntMap<Achievement> achievements;
|
public TObjectIntMap<Achievement> achievements;
|
||||||
@ -34,23 +32,23 @@ public class TalentTrackLevel {
|
|||||||
if (achievements[i].isEmpty() || achievementLevels[i].isEmpty())
|
if (achievements[i].isEmpty() || achievementLevels[i].isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Achievement achievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement(Integer.valueOf(achievements[i]));
|
Achievement achievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement(Integer.parseInt(achievements[i]));
|
||||||
|
|
||||||
if (achievement != null) {
|
if (achievement != null) {
|
||||||
this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
|
this.achievements.put(achievement, Integer.parseInt(achievementLevels[i]));
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
|
log.error("Could not find achievement with ID " + achievements[i] + " for talenttrack level " + this.level + " of type " + this.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String s : set.getString("reward_furni").split(",")) {
|
for (String s : set.getString("reward_furni").split(",")) {
|
||||||
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(s));
|
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
|
log.error("Incorrect reward furni (ID: " + s + ") for talent track level " + this.level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -22,9 +21,8 @@ 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(";");
|
||||||
|
|
||||||
@ -164,7 +162,7 @@ public class Bot implements Runnable {
|
|||||||
statement.execute();
|
statement.execute();
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,26 +7,22 @@ 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.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.BotAddedToInventoryComposer;
|
import com.eu.habbo.messages.outgoing.inventory.BotAddedToInventoryComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.BotRemovedFromInventoryComposer;
|
import com.eu.habbo.messages.outgoing.inventory.BotRemovedFromInventoryComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
||||||
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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@ -44,7 +40,7 @@ public class BotManager {
|
|||||||
|
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|
||||||
LOGGER.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.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 {
|
||||||
@ -59,10 +55,10 @@ public class BotManager {
|
|||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(null);
|
m.invoke(null);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. No Such Method!");
|
log.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) {
|
||||||
LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
|
log.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,12 +85,12 @@ public class BotManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bot;
|
return bot;
|
||||||
@ -114,10 +110,10 @@ public class BotManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY))
|
if (room.hasHabbosAt(location.getX(), location.getY()) || (!location.isWalkable() && location.getState() != RoomTileState.SIT && location.getState() != RoomTileState.LAY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (room.hasBotsAt(location.x, location.y)) {
|
if (room.hasBotsAt(location.getX(), location.getY())) {
|
||||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE));
|
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -144,19 +140,19 @@ public class BotManager {
|
|||||||
habbo.getClient().sendResponse(new BotRemovedFromInventoryComposer(bot));
|
habbo.getClient().sendResponse(new BotRemovedFromInventoryComposer(bot));
|
||||||
bot.onPlace(habbo, room);
|
bot.onPlace(habbo, room);
|
||||||
|
|
||||||
HabboItem topItem = room.getTopItemAt(location.x, location.y);
|
HabboItem topItem = room.getTopItemAt(location.getX(), location.getY());
|
||||||
|
|
||||||
if (topItem != null) {
|
if (topItem != null) {
|
||||||
try {
|
try {
|
||||||
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.cycle(false);
|
bot.cycle(false);
|
||||||
} else {
|
} else {
|
||||||
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode));
|
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,25 +204,23 @@ 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
|
||||||
LOGGER.error("Unknown Bot Type: " + type);
|
log.error("Unknown Bot Type: " + type);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteBot(Bot bot) {
|
public void deleteBot(Bot bot) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM bots WHERE id = ? LIMIT 1")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM bots WHERE id = ? LIMIT 1")) {
|
||||||
statement.setInt(1, bot.getId());
|
statement.setInt(1, bot.getId());
|
||||||
return statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -236,9 +230,9 @@ public class BotManager {
|
|||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(null);
|
m.invoke(null);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
|
log.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. No Such Method!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
|
log.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -22,8 +21,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 {
|
||||||
@ -48,7 +47,7 @@ public class ButlerBot extends Bot {
|
|||||||
serveItems.put(ks, set.getInt("item"));
|
serveItems.put(ks, set.getInt("item"));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +93,13 @@ public class ButlerBot extends Bot {
|
|||||||
tasks.add(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), 0));
|
tasks.add(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), 0));
|
||||||
|
|
||||||
tasks.add(() -> {
|
tasks.add(() -> {
|
||||||
if(this.getRoom() != null) {
|
if (this.getRoom() != null) {
|
||||||
String botMessage = Emulator.getTexts()
|
String botMessage = Emulator.getTexts()
|
||||||
.getValue("bots.butler.given")
|
.getValue("bots.butler.given")
|
||||||
.replace("%key%", key)
|
.replace("%key%", key)
|
||||||
.replace("%username%", serveEvent.habbo.getHabboInfo().getUsername());
|
.replace("%username%", serveEvent.habbo.getHabboInfo().getUsername());
|
||||||
|
|
||||||
if (!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), this.getRoom(), new Object[]{ botMessage })) {
|
if (!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), this.getRoom(), new Object[]{botMessage})) {
|
||||||
bot.talk(botMessage);
|
bot.talk(botMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +123,7 @@ public class ButlerBot extends Bot {
|
|||||||
Emulator.getThreading().run(failedReached.get(0), 1000);
|
Emulator.getThreading().run(failedReached.get(0), 1000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(this.getRoom() != null) {
|
if (this.getRoom() != null) {
|
||||||
this.getRoom().giveHandItem(serveEvent.habbo, serveEvent.itemId);
|
this.getRoom().giveHandItem(serveEvent.habbo, serveEvent.itemId);
|
||||||
|
|
||||||
String msg = Emulator.getTexts().getValue("bots.butler.given").replace("%key%", keyword).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername());
|
String msg = Emulator.getTexts().getValue("bots.butler.given").replace("%key%", keyword).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername());
|
||||||
|
@ -39,9 +39,9 @@ public class VisitorBot extends Bot {
|
|||||||
StringBuilder list = new StringBuilder();
|
StringBuilder list = new StringBuilder();
|
||||||
for (ModToolRoomVisit visit : this.visits) {
|
for (ModToolRoomVisit visit : this.visits) {
|
||||||
list.append("\r");
|
list.append("\r");
|
||||||
list.append(visit.roomName).append(" ");
|
list.append(visit.getRoomName()).append(" ");
|
||||||
list.append(Emulator.getTexts().getValue("generic.time.at")).append(" ");
|
list.append(Emulator.getTexts().getValue("generic.time.at")).append(" ");
|
||||||
list.append(DATE_FORMAT.format(new Date((visit.timestamp * 1000L))));
|
list.append(DATE_FORMAT.format(new Date((visit.getTimestamp() * 1000L))));
|
||||||
}
|
}
|
||||||
|
|
||||||
visitMessage = visitMessage.replace("%list%", list.toString());
|
visitMessage = visitMessage.replace("%list%", list.toString());
|
||||||
|
@ -5,8 +5,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDoorOpenedMessageComposer;
|
import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDoorOpenedMessageComposer;
|
||||||
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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@ -14,8 +13,9 @@ import java.util.Date;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class CalendarManager {
|
public class CalendarManager {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarManager.class);
|
|
||||||
|
|
||||||
private static final Map<Integer, CalendarCampaign> calendarCampaigns = new THashMap<>();
|
private static final Map<Integer, CalendarCampaign> calendarCampaigns = new THashMap<>();
|
||||||
public static double HC_MODIFIER;
|
public static double HC_MODIFIER;
|
||||||
@ -23,7 +23,7 @@ public class CalendarManager {
|
|||||||
public CalendarManager() {
|
public CalendarManager() {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
this.reload();
|
this.reload();
|
||||||
LOGGER.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
|
log.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -39,7 +39,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class CalendarManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarCampaigns.put(campaign.getId(), campaign);
|
calendarCampaigns.put(campaign.getId(), campaign);
|
||||||
@ -97,7 +97,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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -113,7 +113,7 @@ public class CalendarManager {
|
|||||||
|
|
||||||
public void claimCalendarReward(Habbo habbo, String campaignName, int day, boolean force) {
|
public void claimCalendarReward(Habbo habbo, String campaignName, int day, boolean force) {
|
||||||
CalendarCampaign campaign = calendarCampaigns.values().stream().filter(cc -> Objects.equals(cc.getName(), campaignName)).findFirst().orElse(null);
|
CalendarCampaign campaign = calendarCampaigns.values().stream().filter(cc -> Objects.equals(cc.getName(), campaignName)).findFirst().orElse(null);
|
||||||
if (campaign == null || campaign.getRewards().isEmpty() || (habbo.getHabboStats().calendarRewardsClaimed.stream().anyMatch(claimed -> claimed.getCampaignId() == campaign.getId() && claimed.getDay() == day)))
|
if (campaign == null || campaign.getRewards().isEmpty() || (habbo.getHabboStats().getCalendarRewardsClaimed().stream().anyMatch(claimed -> claimed.getCampaignId() == campaign.getId() && claimed.getDay() == day)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<CalendarRewardObject> rewards = new ArrayList<>(campaign.getRewards().values());
|
List<CalendarRewardObject> rewards = new ArrayList<>(campaign.getRewards().values());
|
||||||
@ -125,7 +125,7 @@ public class CalendarManager {
|
|||||||
if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) {
|
if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
habbo.getHabboStats().calendarRewardsClaimed.add(new CalendarRewardClaimed(habbo.getHabboInfo().getId(), campaign.getId(), day, object.getId(), new Timestamp(System.currentTimeMillis())));
|
habbo.getHabboStats().getCalendarRewardsClaimed().add(new CalendarRewardClaimed(habbo.getHabboInfo().getId(), campaign.getId(), day, object.getId(), new Timestamp(System.currentTimeMillis())));
|
||||||
habbo.getClient().sendResponse(new CampaignCalendarDoorOpenedMessageComposer(true, object, habbo));
|
habbo.getClient().sendResponse(new CampaignCalendarDoorOpenedMessageComposer(true, object, habbo));
|
||||||
object.give(habbo);
|
object.give(habbo);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public class CalendarManager {
|
|||||||
statement.setInt(5, Emulator.getIntUnixTimestamp());
|
statement.setInt(5, Emulator.getIntUnixTimestamp());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,26 @@
|
|||||||
package com.eu.habbo.habbohotel.campaign;
|
package com.eu.habbo.habbohotel.campaign;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
public class CalendarRewardClaimed {
|
public class CalendarRewardClaimed {
|
||||||
private final int user_id;
|
private final int userId;
|
||||||
private final int campaign;
|
private final int campaignId;
|
||||||
private final int day;
|
private final int day;
|
||||||
private final int reward_id;
|
private final int rewardId;
|
||||||
private final Timestamp timestamp;
|
private final Timestamp timestamp;
|
||||||
|
|
||||||
public CalendarRewardClaimed(ResultSet set) throws SQLException {
|
public CalendarRewardClaimed(ResultSet set) throws SQLException {
|
||||||
this.user_id = set.getInt("user_id");
|
this.userId = set.getInt("user_id");
|
||||||
this.campaign = set.getInt("campaign_id");
|
this.campaignId = set.getInt("campaign_id");
|
||||||
this.day = set.getInt("day");
|
this.day = set.getInt("day");
|
||||||
this.reward_id = set.getInt("reward_id");
|
this.rewardId = set.getInt("reward_id");
|
||||||
this.timestamp = new Timestamp(set.getInt("timestamp") * 1000L);
|
this.timestamp = new Timestamp(set.getInt("timestamp") * 1000L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CalendarRewardClaimed(int user_id, int campaign, int day, int reward_id, Timestamp timestamp) {
|
|
||||||
this.user_id = user_id;
|
|
||||||
this.campaign = campaign;
|
|
||||||
this.day = day;
|
|
||||||
this.reward_id = reward_id;
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUserId() {
|
|
||||||
return this.user_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCampaignId() {
|
|
||||||
return this.campaign;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDay() {
|
|
||||||
return this.day;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRewardId() {
|
|
||||||
return this.reward_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getTimestamp() {
|
|
||||||
return this.timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,17 @@ 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 com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
|
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
import org.slf4j.Logger;
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Getter
|
||||||
public class CalendarRewardObject {
|
public class CalendarRewardObject {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarRewardObject.class);
|
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private final String productName;
|
private final String productName;
|
||||||
private final String customImage;
|
private final String customImage;
|
||||||
@ -25,8 +25,8 @@ public class CalendarRewardObject {
|
|||||||
private final int pointsType;
|
private final int pointsType;
|
||||||
private final String badge;
|
private final String badge;
|
||||||
private final int itemId;
|
private final int itemId;
|
||||||
private final String subscription_type;
|
private final String subscriptionType;
|
||||||
private final int subscription_days;
|
private final int subscriptionDays;
|
||||||
|
|
||||||
public CalendarRewardObject(ResultSet set) throws SQLException {
|
public CalendarRewardObject(ResultSet set) throws SQLException {
|
||||||
this.id = set.getInt("id");
|
this.id = set.getInt("id");
|
||||||
@ -38,8 +38,8 @@ public class CalendarRewardObject {
|
|||||||
this.pointsType = set.getInt("points_type");
|
this.pointsType = set.getInt("points_type");
|
||||||
this.badge = set.getString("badge");
|
this.badge = set.getString("badge");
|
||||||
this.itemId = set.getInt("item_id");
|
this.itemId = set.getInt("item_id");
|
||||||
this.subscription_type = set.getString("subscription_type");
|
this.subscriptionType = set.getString("subscription_type");
|
||||||
this.subscription_days = set.getInt("subscription_days");
|
this.subscriptionDays = set.getInt("subscription_days");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void give(Habbo habbo) {
|
public void give(Habbo habbo) {
|
||||||
@ -48,7 +48,7 @@ public class CalendarRewardObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.pixels > 0) {
|
if (this.pixels > 0) {
|
||||||
habbo.givePixels((int)(this.pixels * (habbo.getHabboStats().hasActiveClub() ? CalendarManager.HC_MODIFIER : 1.0)));
|
habbo.givePixels((int) (this.pixels * (habbo.getHabboStats().hasActiveClub() ? CalendarManager.HC_MODIFIER : 1.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.points > 0) {
|
if (this.points > 0) {
|
||||||
@ -59,11 +59,11 @@ public class CalendarRewardObject {
|
|||||||
habbo.addBadge(this.badge);
|
habbo.addBadge(this.badge);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.subscription_type != null && !this.subscription_type.isEmpty()) {
|
if (this.subscriptionType != null && !this.subscriptionType.isEmpty()) {
|
||||||
if ("HABBO_CLUB".equals(this.subscription_type)) {
|
if ("HABBO_CLUB".equals(this.subscriptionType)) {
|
||||||
habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, this.subscription_days * 86400);
|
habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, this.subscriptionDays * 86400);
|
||||||
} else {
|
} else {
|
||||||
habbo.getHabboStats().createSubscription(this.subscription_type, this.subscription_days * 86400);
|
habbo.getHabboStats().createSubscription(this.subscriptionType, this.subscriptionDays * 86400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,44 +84,6 @@ public class CalendarRewardObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCustomImage() {
|
|
||||||
return this.customImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCredits() {
|
|
||||||
return this.credits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPixels() {
|
|
||||||
return this.pixels;
|
|
||||||
}
|
|
||||||
public int getPoints() {
|
|
||||||
return this.points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPointsType() {
|
|
||||||
return this.pointsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductName() {
|
|
||||||
return productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSubscriptionType() {
|
|
||||||
return subscription_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubscriptionDays() {
|
|
||||||
return subscription_days;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBadge() {
|
|
||||||
return this.badge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item getItem() {
|
public Item getItem() {
|
||||||
return Emulator.getGameEnvironment().getItemManager().getItem(this.itemId);
|
return Emulator.getGameEnvironment().getItemManager().getItem(this.itemId);
|
||||||
|
@ -3,7 +3,10 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
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 lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class CatalogFeaturedPage implements ISerialize {
|
public class CatalogFeaturedPage implements ISerialize {
|
||||||
private final int slotId;
|
private final int slotId;
|
||||||
private final String caption;
|
private final String caption;
|
||||||
@ -13,16 +16,6 @@ public class CatalogFeaturedPage implements ISerialize {
|
|||||||
private final String pageName;
|
private final String pageName;
|
||||||
private final int pageId;
|
private final int pageId;
|
||||||
private final String productName;
|
private final String productName;
|
||||||
public CatalogFeaturedPage(int slotId, String caption, String image, Type type, int expireTimestamp, String pageName, int pageId, String productName) {
|
|
||||||
this.slotId = slotId;
|
|
||||||
this.caption = caption;
|
|
||||||
this.image = image;
|
|
||||||
this.type = type;
|
|
||||||
this.expireTimestamp = expireTimestamp;
|
|
||||||
this.pageName = pageName;
|
|
||||||
this.pageId = pageId;
|
|
||||||
this.productName = productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ServerMessage message) {
|
public void serialize(ServerMessage message) {
|
||||||
@ -31,28 +24,20 @@ public class CatalogFeaturedPage implements ISerialize {
|
|||||||
message.appendString(this.image);
|
message.appendString(this.image);
|
||||||
message.appendInt(this.type.type);
|
message.appendInt(this.type.type);
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case PAGE_NAME:
|
case PAGE_NAME -> message.appendString(this.pageName);
|
||||||
message.appendString(this.pageName);
|
case PAGE_ID -> message.appendInt(this.pageId);
|
||||||
break;
|
case PRODUCT_NAME -> message.appendString(this.productName);
|
||||||
case PAGE_ID:
|
|
||||||
message.appendInt(this.pageId);
|
|
||||||
break;
|
|
||||||
case PRODUCT_NAME:
|
|
||||||
message.appendString(this.productName);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
message.appendInt(Emulator.getIntUnixTimestamp() - this.expireTimestamp);
|
message.appendInt(Emulator.getIntUnixTimestamp() - this.expireTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
public enum Type {
|
public enum Type {
|
||||||
PAGE_NAME(0),
|
PAGE_NAME(0),
|
||||||
PAGE_ID(1),
|
PAGE_ID(1),
|
||||||
PRODUCT_NAME(2);
|
PRODUCT_NAME(2);
|
||||||
|
|
||||||
public final int type;
|
private final int type;
|
||||||
|
|
||||||
Type(int type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,12 +3,12 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.FurnitureType;
|
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.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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -16,41 +16,54 @@ 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);
|
|
||||||
|
@Getter
|
||||||
int id;
|
int id;
|
||||||
|
@Getter
|
||||||
int limitedStack;
|
int limitedStack;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private int pageId;
|
private int pageId;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private String itemId;
|
private String itemId;
|
||||||
|
@Getter
|
||||||
private String name;
|
private String name;
|
||||||
|
@Getter
|
||||||
private int credits;
|
private int credits;
|
||||||
|
@Getter
|
||||||
private int points;
|
private int points;
|
||||||
|
@Getter
|
||||||
private short pointsType;
|
private short pointsType;
|
||||||
|
@Getter
|
||||||
private int amount;
|
private int amount;
|
||||||
private boolean allowGift = false;
|
private boolean allowGift = false;
|
||||||
private int limitedSells;
|
private int limitedSells;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private String extradata;
|
private String extradata;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private boolean clubOnly;
|
private boolean clubOnly;
|
||||||
|
|
||||||
|
|
||||||
private boolean haveOffer;
|
private boolean haveOffer;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private int offerId;
|
private int offerId;
|
||||||
|
|
||||||
|
|
||||||
private boolean needsUpdate;
|
private boolean needsUpdate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private int orderNumber;
|
private int orderNumber;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private HashMap<Integer, Integer> bundle;
|
private HashMap<Integer, Integer> bundle;
|
||||||
|
|
||||||
|
|
||||||
public CatalogItem(ResultSet set) throws SQLException {
|
public CatalogItem(ResultSet set) throws SQLException {
|
||||||
this.load(set);
|
this.load(set);
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
@ -105,49 +118,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
this.loadBundle();
|
this.loadBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPageId() {
|
|
||||||
return this.pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPageId(int pageId) {
|
|
||||||
this.pageId = pageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getItemId() {
|
|
||||||
return this.itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemId(String itemId) {
|
|
||||||
this.itemId = itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCredits() {
|
|
||||||
return this.credits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPoints() {
|
|
||||||
return this.points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPointsType() {
|
|
||||||
return this.pointsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAmount() {
|
|
||||||
return this.amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLimitedStack() {
|
|
||||||
return this.limitedStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLimitedSells() {
|
public int getLimitedSells() {
|
||||||
CatalogLimitedConfiguration ltdConfig = Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(this);
|
CatalogLimitedConfiguration ltdConfig = Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(this);
|
||||||
@ -159,29 +129,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
return this.limitedStack;
|
return this.limitedStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtradata() {
|
|
||||||
return this.extradata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isClubOnly() {
|
|
||||||
return this.clubOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isHaveOffer() {
|
|
||||||
return this.haveOffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOfferId() {
|
|
||||||
return this.offerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLimited() {
|
|
||||||
return this.limitedStack > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getOrderNumber() {
|
|
||||||
return this.orderNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void sellRare() {
|
public synchronized void sellRare() {
|
||||||
this.limitedSells++;
|
this.limitedSells++;
|
||||||
@ -214,7 +161,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
|
|
||||||
identifier = Integer.parseInt(itemId);
|
identifier = Integer.parseInt(itemId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
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");
|
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");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (identifier > 0) {
|
if (identifier > 0) {
|
||||||
@ -236,9 +183,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, Integer> getBundle() {
|
|
||||||
return this.bundle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadBundle() {
|
public void loadBundle() {
|
||||||
int intItemId;
|
int intItemId;
|
||||||
@ -261,17 +205,17 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.debug("Failed to load " + this.itemId);
|
log.debug("Failed to load " + this.itemId);
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(this.itemId));
|
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.parseInt(this.itemId));
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
this.allowGift = item.allowGift();
|
this.allowGift = item.allowGift();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,14 +290,13 @@ 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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("NullableProblems")
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(CatalogItem catalogItem) {
|
public int compareTo(CatalogItem catalogItem) {
|
||||||
if (CatalogManager.SORT_USING_ORDERNUM) {
|
if (CatalogManager.SORT_USING_ORDERNUM) {
|
||||||
@ -362,4 +305,14 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
|
|||||||
return this.getId() - catalogItem.getId();
|
return this.getId() - catalogItem.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isHaveOffer() {
|
||||||
|
return this.haveOffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLimited() {
|
||||||
|
return this.limitedStack > 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,9 @@ 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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -13,11 +14,12 @@ import java.util.Collections;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
|
@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 LinkedBlockingQueue<Integer> limitedNumbers;
|
private LinkedBlockingQueue<Integer> limitedNumbers;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private int totalSet;
|
private int totalSet;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
@ -61,7 +63,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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +82,7 @@ public class CatalogLimitedConfiguration implements Runnable {
|
|||||||
|
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.totalSet += amount;
|
this.totalSet += amount;
|
||||||
@ -100,13 +102,6 @@ public class CatalogLimitedConfiguration implements Runnable {
|
|||||||
return this.limitedNumbers.size();
|
return this.limitedNumbers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTotalSet() {
|
|
||||||
return this.totalSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalSet(int totalSet) {
|
|
||||||
this.totalSet = totalSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -116,7 +111,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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,12 +18,12 @@ import com.eu.habbo.habbohotel.users.HabboBadge;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
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.messages.outgoing.catalog.*;
|
import com.eu.habbo.messages.outgoing.catalog.*;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.BotAddedToInventoryComposer;
|
import com.eu.habbo.messages.outgoing.inventory.BotAddedToInventoryComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.PetAddedToInventoryComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.PetAddedToInventoryComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer;
|
import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.CreditBalanceComposer;
|
import com.eu.habbo.messages.outgoing.users.CreditBalanceComposer;
|
||||||
@ -37,19 +37,16 @@ import gnu.trove.map.TIntObjectMap;
|
|||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.map.hash.TIntIntHashMap;
|
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.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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<>();
|
public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<>();
|
||||||
public static int catalogItemAmount;
|
public static int catalogItemAmount;
|
||||||
public static int PURCHASE_COOLDOWN = 1;
|
public static int PURCHASE_COOLDOWN = 1;
|
||||||
@ -86,7 +83,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
|
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
|
||||||
|
|
||||||
LOGGER.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +255,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.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 +275,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) {
|
||||||
LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
|
log.info("Unknown Page Layout: " + set.getString("page_layout"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,12 +283,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) {
|
||||||
LOGGER.error("Failed to load layout: {}", set.getString("page_layout"));
|
log.error("Failed to load layout: {}", set.getString("page_layout"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
pages.forEachValue((object) -> {
|
pages.forEachValue((object) -> {
|
||||||
@ -303,7 +300,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (object.parentId != -2) {
|
if (object.parentId != -2) {
|
||||||
LOGGER.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")");
|
log.info("Parent Page not found for " + object.getPageName() + " (ID: " + object.id + ", parent_id: " + object.parentId + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -311,7 +308,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
this.catalogPages.putAll(pages);
|
this.catalogPages.putAll(pages);
|
||||||
|
|
||||||
LOGGER.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
|
log.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -332,7 +329,7 @@ public class CatalogManager {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +376,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CatalogPage page : this.catalogPages.valueCollection()) {
|
for (CatalogPage page : this.catalogPages.valueCollection()) {
|
||||||
@ -404,7 +401,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +417,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,7 +432,7 @@ public class CatalogManager {
|
|||||||
this.vouchers.add(new Voucher(set));
|
this.vouchers.add(new Voucher(set));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,11 +452,11 @@ public class CatalogManager {
|
|||||||
|
|
||||||
this.prizes.get(set.getInt("rarity")).add(item);
|
this.prizes.get(set.getInt("rarity")).add(item);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id"));
|
log.error("Cannot load item with ID: {} as recycler reward!", set.getInt("item_id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,17 +471,12 @@ public class CatalogManager {
|
|||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM gift_wrappers ORDER BY sprite_id DESC")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("SELECT * FROM gift_wrappers ORDER BY sprite_id DESC")) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
switch (set.getString("type")) {
|
switch (set.getString("type")) {
|
||||||
case "wrapper":
|
case "wrapper" -> this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id"));
|
||||||
this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id"));
|
case "gift" -> this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
|
||||||
break;
|
|
||||||
|
|
||||||
case "gift":
|
|
||||||
this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -499,14 +491,14 @@ 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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClothItem getClothing(String name) {
|
public ClothItem getClothing(String name) {
|
||||||
for (ClothItem item : this.clothing.values()) {
|
for (ClothItem item : this.clothing.values()) {
|
||||||
if (item.name.equalsIgnoreCase(name)) {
|
if (item.getName().equalsIgnoreCase(name)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,7 +509,7 @@ public class CatalogManager {
|
|||||||
public Voucher getVoucher(String code) {
|
public Voucher getVoucher(String code) {
|
||||||
synchronized (this.vouchers) {
|
synchronized (this.vouchers) {
|
||||||
for (Voucher voucher : this.vouchers) {
|
for (Voucher voucher : this.vouchers) {
|
||||||
if (voucher.code.equals(code)) {
|
if (voucher.getCode().equals(code)) {
|
||||||
return voucher;
|
return voucher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,18 +540,18 @@ public class CatalogManager {
|
|||||||
|
|
||||||
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
|
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
|
||||||
|
|
||||||
if (voucher.points > 0) {
|
if (voucher.getPoints() > 0) {
|
||||||
client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.pointsType, voucher.points);
|
client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.getPointsType(), voucher.getPoints());
|
||||||
client.sendResponse(new HabboActivityPointNotificationMessageComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.pointsType), voucher.points, voucher.pointsType));
|
client.sendResponse(new HabboActivityPointNotificationMessageComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.getPointsType()), voucher.getPoints(), voucher.getPointsType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voucher.credits > 0) {
|
if (voucher.getCredits() > 0) {
|
||||||
client.getHabbo().getHabboInfo().addCredits(voucher.credits);
|
client.getHabbo().getHabboInfo().addCredits(voucher.getCredits());
|
||||||
client.sendResponse(new CreditBalanceComposer(client.getHabbo()));
|
client.sendResponse(new CreditBalanceComposer(client.getHabbo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voucher.catalogItemId > 0) {
|
if (voucher.getCatalogItemId() > 0) {
|
||||||
CatalogItem item = this.getCatalogItem(voucher.catalogItemId);
|
CatalogItem item = this.getCatalogItem(voucher.getCatalogItemId());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
this.purchaseItem(null, item, client.getHabbo(), 1, "", true);
|
this.purchaseItem(null, item, client.getHabbo(), 1, "", true);
|
||||||
}
|
}
|
||||||
@ -570,7 +562,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
public boolean deleteVoucher(Voucher voucher) {
|
public boolean deleteVoucher(Voucher voucher) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM vouchers WHERE code = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM vouchers WHERE code = ?")) {
|
||||||
statement.setString(1, voucher.code);
|
statement.setString(1, voucher.getCode());
|
||||||
|
|
||||||
synchronized (this.vouchers) {
|
synchronized (this.vouchers) {
|
||||||
this.vouchers.remove(voucher);
|
this.vouchers.remove(voucher);
|
||||||
@ -578,7 +570,7 @@ public class CatalogManager {
|
|||||||
|
|
||||||
return statement.executeUpdate() >= 1;
|
return statement.executeUpdate() >= 1;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -609,13 +601,10 @@ public class CatalogManager {
|
|||||||
public CatalogItem getCatalogItem(int id) {
|
public CatalogItem getCatalogItem(int id) {
|
||||||
final CatalogItem[] item = {null};
|
final CatalogItem[] item = {null};
|
||||||
synchronized (this.catalogPages) {
|
synchronized (this.catalogPages) {
|
||||||
this.catalogPages.forEachValue(new TObjectProcedure<CatalogPage>() {
|
this.catalogPages.forEachValue(object -> {
|
||||||
@Override
|
item[0] = object.getCatalogItem(id);
|
||||||
public boolean execute(CatalogPage object) {
|
|
||||||
item[0] = object.getCatalogItem(id);
|
|
||||||
|
|
||||||
return item[0] == null;
|
return item[0] == null;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,24 +615,17 @@ public class CatalogManager {
|
|||||||
public List<CatalogPage> getCatalogPages(int parentId, final Habbo habbo) {
|
public List<CatalogPage> getCatalogPages(int parentId, final Habbo habbo) {
|
||||||
final List<CatalogPage> pages = new ArrayList<>();
|
final List<CatalogPage> pages = new ArrayList<>();
|
||||||
|
|
||||||
this.catalogPages.get(parentId).childPages.forEachValue(new TObjectProcedure<CatalogPage>() {
|
this.catalogPages.get(parentId).childPages.forEachValue(object -> {
|
||||||
@Override
|
|
||||||
public boolean execute(CatalogPage object) {
|
|
||||||
|
|
||||||
boolean isVisiblePage = object.visible;
|
boolean isVisiblePage = object.visible;
|
||||||
boolean hasRightRank = object.getRank() <= habbo.getHabboInfo().getRank().getId();
|
boolean hasRightRank = object.getRank() <= habbo.getHabboInfo().getRank().getId();
|
||||||
|
|
||||||
boolean clubRightsOkay = true;
|
boolean clubRightsOkay = !object.isClubOnly() || habbo.getHabboInfo().getHabboStats().hasActiveClub();
|
||||||
|
|
||||||
if(object.isClubOnly() && !habbo.getHabboInfo().getHabboStats().hasActiveClub()) {
|
if (isVisiblePage && hasRightRank && clubRightsOkay) {
|
||||||
clubRightsOkay = false;
|
pages.add(object);
|
||||||
}
|
|
||||||
|
|
||||||
if (isVisiblePage && hasRightRank && clubRightsOkay) {
|
|
||||||
pages.add(object);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
Collections.sort(pages);
|
Collections.sort(pages);
|
||||||
|
|
||||||
@ -702,7 +684,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 {
|
||||||
LOGGER.error("No rewards specified for rarity level {}", level);
|
log.error("No rewards specified for rarity level {}", level);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -734,10 +716,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Unknown page layout: {}", page.getString("page_layout"));
|
log.error("Unknown page layout: {}", page.getString("page_layout"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -745,7 +727,7 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (catalogPage != null) {
|
if (catalogPage != null) {
|
||||||
@ -804,19 +786,19 @@ public class CatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Catalog Manager -> Disposed!");
|
log.info("Catalog Manager -> Disposed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void purchaseItem(CatalogPage page, CatalogItem item, Habbo habbo, int amount, String extradata, boolean free) {
|
public void purchaseItem(CatalogPage page, CatalogItem item, Habbo habbo, int amount, String extradata, boolean free) {
|
||||||
Item cBaseItem = null;
|
Item cBaseItem = null;
|
||||||
|
|
||||||
if (item == null || habbo.getHabboStats().isPurchasingFurniture) {
|
if (item == null || habbo.getHabboStats().isPurchasingFurniture()) {
|
||||||
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR).compose());
|
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR).compose());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
habbo.getHabboStats().isPurchasingFurniture = true;
|
habbo.getHabboStats().setPurchasingFurniture(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (item.isClubOnly() && !habbo.getClient().getHabbo().getHabboStats().hasActiveClub()) {
|
if (item.isClubOnly() && !habbo.getClient().getHabbo().getHabboStats().hasActiveClub()) {
|
||||||
@ -873,7 +855,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);
|
||||||
LOGGER.info(message);
|
log.info(message);
|
||||||
habbo.getClient().sendResponse(new PurchaseNotAllowedMessageComposer(PurchaseNotAllowedMessageComposer.ILLEGAL));
|
habbo.getClient().sendResponse(new PurchaseNotAllowedMessageComposer(PurchaseNotAllowedMessageComposer.ILLEGAL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -958,7 +940,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) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,7 +999,7 @@ public class CatalogManager {
|
|||||||
try {
|
try {
|
||||||
guildId = Integer.parseInt(extradata);
|
guildId = Integer.parseInt(extradata);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1034,7 +1016,7 @@ public class CatalogManager {
|
|||||||
itemsList.add(habboItem);
|
itemsList.add(habboItem);
|
||||||
|
|
||||||
if (baseItem.getName().equals("guild_forum")) {
|
if (baseItem.getName().equals("guild_forum")) {
|
||||||
guild.setForum(true);
|
guild.setHasForum(true);
|
||||||
guild.needsUpdate = true;
|
guild.needsUpdate = true;
|
||||||
guild.run();
|
guild.run();
|
||||||
}
|
}
|
||||||
@ -1111,7 +1093,7 @@ public class CatalogManager {
|
|||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
|
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||||
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
|
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys));
|
||||||
unseenItems.get(UnseenItemsComposer.AddHabboItemCategory.BADGE).add(badge.getId());
|
unseenItems.get(UnseenItemsComposer.AddHabboItemCategory.BADGE).add(badge.getId());
|
||||||
}
|
}
|
||||||
habbo.getClient().getHabbo().getHabboStats().addPurchase(purchasedEvent.catalogItem);
|
habbo.getClient().getHabbo().getHabboStats().addPurchase(purchasedEvent.catalogItem);
|
||||||
@ -1123,11 +1105,11 @@ public class CatalogManager {
|
|||||||
|
|
||||||
THashSet<String> itemIds = new THashSet<>();
|
THashSet<String> itemIds = new THashSet<>();
|
||||||
|
|
||||||
for(HabboItem ix : purchasedEvent.itemsList) {
|
for (HabboItem ix : purchasedEvent.itemsList) {
|
||||||
itemIds.add(ix.getId() + "");
|
itemIds.add(ix.getId() + "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!free) {
|
if (!free) {
|
||||||
Emulator.getThreading().run(new CatalogPurchaseLogEntry(
|
Emulator.getThreading().run(new CatalogPurchaseLogEntry(
|
||||||
Emulator.getIntUnixTimestamp(),
|
Emulator.getIntUnixTimestamp(),
|
||||||
purchasedEvent.habbo.getHabboInfo().getId(),
|
purchasedEvent.habbo.getHabboInfo().getId(),
|
||||||
@ -1136,17 +1118,17 @@ public class CatalogManager {
|
|||||||
purchasedEvent.catalogItem != null ? purchasedEvent.catalogItem.getName() : "",
|
purchasedEvent.catalogItem != null ? purchasedEvent.catalogItem.getName() : "",
|
||||||
purchasedEvent.totalCredits,
|
purchasedEvent.totalCredits,
|
||||||
purchasedEvent.totalPoints,
|
purchasedEvent.totalPoints,
|
||||||
item != null ? item.getPointsType() : 0,
|
item.getPointsType(),
|
||||||
amount
|
amount
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Exception caught", e);
|
log.error("Exception caught", e);
|
||||||
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
habbo.getHabboStats().isPurchasingFurniture = false;
|
habbo.getHabboStats().setPurchasingFurniture(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,38 +7,63 @@ 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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
protected final TIntArrayList offerIds = new TIntArrayList();
|
protected final TIntArrayList offerIds = new TIntArrayList();
|
||||||
|
@Getter
|
||||||
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
|
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
|
||||||
|
@Getter
|
||||||
private final TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
|
private final TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
|
||||||
|
@Getter
|
||||||
private final ArrayList<Integer> included = new ArrayList<>();
|
private final ArrayList<Integer> included = new ArrayList<>();
|
||||||
|
@Getter
|
||||||
protected int id;
|
protected int id;
|
||||||
|
@Getter
|
||||||
protected int parentId;
|
protected int parentId;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
protected int rank;
|
protected int rank;
|
||||||
|
@Getter
|
||||||
protected String caption;
|
protected String caption;
|
||||||
|
@Getter
|
||||||
protected String pageName;
|
protected String pageName;
|
||||||
|
@Getter
|
||||||
protected int iconColor;
|
protected int iconColor;
|
||||||
|
@Getter
|
||||||
protected int iconImage;
|
protected int iconImage;
|
||||||
|
@Getter
|
||||||
protected int orderNum;
|
protected int orderNum;
|
||||||
|
@Getter
|
||||||
protected boolean visible;
|
protected boolean visible;
|
||||||
|
@Getter
|
||||||
protected boolean enabled;
|
protected boolean enabled;
|
||||||
|
@Getter
|
||||||
protected boolean clubOnly;
|
protected boolean clubOnly;
|
||||||
|
@Getter
|
||||||
protected String layout;
|
protected String layout;
|
||||||
|
@Getter
|
||||||
protected String headerImage;
|
protected String headerImage;
|
||||||
|
@Getter
|
||||||
protected String teaserImage;
|
protected String teaserImage;
|
||||||
|
@Getter
|
||||||
protected String specialImage;
|
protected String specialImage;
|
||||||
|
@Getter
|
||||||
protected String textOne;
|
protected String textOne;
|
||||||
|
@Getter
|
||||||
protected String textTwo;
|
protected String textTwo;
|
||||||
|
@Getter
|
||||||
protected String textDetails;
|
protected String textDetails;
|
||||||
|
@Getter
|
||||||
protected String textTeaser;
|
protected String textTeaser;
|
||||||
|
|
||||||
public CatalogPage() {
|
public CatalogPage() {
|
||||||
@ -71,99 +96,15 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
|
|||||||
if (!set.getString("includes").isEmpty()) {
|
if (!set.getString("includes").isEmpty()) {
|
||||||
for (String id : set.getString("includes").split(";")) {
|
for (String id : set.getString("includes").split(";")) {
|
||||||
try {
|
try {
|
||||||
this.included.add(Integer.valueOf(id));
|
this.included.add(Integer.parseInt(id));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
|
log.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getParentId() {
|
|
||||||
return this.parentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRank() {
|
|
||||||
return this.rank;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRank(int rank) {
|
|
||||||
this.rank = rank;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCaption() {
|
|
||||||
return this.caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPageName() {
|
|
||||||
return this.pageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIconColor() {
|
|
||||||
return this.iconColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIconImage() {
|
|
||||||
return this.iconImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrderNum() {
|
|
||||||
return this.orderNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVisible() {
|
|
||||||
return this.visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return this.enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isClubOnly() {
|
|
||||||
return this.clubOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLayout() {
|
|
||||||
return this.layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeaderImage() {
|
|
||||||
return this.headerImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTeaserImage() {
|
|
||||||
return this.teaserImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSpecialImage() {
|
|
||||||
return this.specialImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextOne() {
|
|
||||||
return this.textOne;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextTwo() {
|
|
||||||
return this.textTwo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextDetails() {
|
|
||||||
return this.textDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTextTeaser() {
|
|
||||||
return this.textTeaser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TIntArrayList getOfferIds() {
|
|
||||||
return this.offerIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addOfferId(int offerId) {
|
public void addOfferId(int offerId) {
|
||||||
this.offerIds.add(offerId);
|
this.offerIds.add(offerId);
|
||||||
}
|
}
|
||||||
@ -172,22 +113,10 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
|
|||||||
this.catalogItems.put(item.getId(), item);
|
this.catalogItems.put(item.getId(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TIntObjectMap<CatalogItem> getCatalogItems() {
|
|
||||||
return this.catalogItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CatalogItem getCatalogItem(int id) {
|
public CatalogItem getCatalogItem(int id) {
|
||||||
return this.catalogItems.get(id);
|
return this.catalogItems.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getIncluded() {
|
|
||||||
return this.included;
|
|
||||||
}
|
|
||||||
|
|
||||||
public THashMap<Integer, CatalogPage> getChildPages() {
|
|
||||||
return this.childPages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addChildPage(CatalogPage page) {
|
public void addChildPage(CatalogPage page) {
|
||||||
this.childPages.put(page.getId(), page);
|
this.childPages.put(page.getId(), page);
|
||||||
|
|
||||||
@ -196,7 +125,6 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("NullableProblems")
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(CatalogPage page) {
|
public int compareTo(CatalogPage page) {
|
||||||
return this.getOrderNum() - page.getOrderNum();
|
return this.getOrderNum() - page.getOrderNum();
|
||||||
|
@ -2,15 +2,16 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.core.DatabaseLoggable;
|
import com.eu.habbo.core.DatabaseLoggable;
|
||||||
import org.slf4j.Logger;
|
import lombok.AllArgsConstructor;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@AllArgsConstructor
|
||||||
public class CatalogPurchaseLogEntry implements Runnable, DatabaseLoggable {
|
public class CatalogPurchaseLogEntry implements Runnable, DatabaseLoggable {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPurchaseLogEntry.class);
|
|
||||||
private static final String QUERY = "INSERT INTO `logs_shop_purchases` (timestamp, user_id, catalog_item_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
private static final String QUERY = "INSERT INTO `logs_shop_purchases` (timestamp, user_id, catalog_item_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
private final int timestamp;
|
private final int timestamp;
|
||||||
@ -23,18 +24,6 @@ public class CatalogPurchaseLogEntry implements Runnable, DatabaseLoggable {
|
|||||||
private final int pointsType;
|
private final int pointsType;
|
||||||
private final int amount;
|
private final int amount;
|
||||||
|
|
||||||
public CatalogPurchaseLogEntry(int timestamp, int userId, int catalogItemId, String itemIds, String catalogName, int costCredits, int costPoints, int pointsType, int amount) {
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
this.userId = userId;
|
|
||||||
this.catalogItemId = catalogItemId;
|
|
||||||
this.itemIds = itemIds;
|
|
||||||
this.catalogName = catalogName;
|
|
||||||
this.costCredits = costCredits;
|
|
||||||
this.costPoints = costPoints;
|
|
||||||
this.pointsType = pointsType;
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getQuery() {
|
public String getQuery() {
|
||||||
return QUERY;
|
return QUERY;
|
||||||
|
@ -1,26 +1,32 @@
|
|||||||
package com.eu.habbo.habbohotel.catalog;
|
package com.eu.habbo.habbohotel.catalog;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class ClothItem {
|
public class ClothItem {
|
||||||
|
|
||||||
public int id;
|
@Setter
|
||||||
|
@Getter
|
||||||
|
private int id;
|
||||||
public String name;
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String name;
|
||||||
public int[] setId;
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private int[] setId;
|
||||||
|
|
||||||
public ClothItem(ResultSet set) throws SQLException {
|
public ClothItem(ResultSet set) throws SQLException {
|
||||||
this.id = set.getInt("id");
|
this.setId(set.getInt("id"));
|
||||||
this.name = set.getString("name");
|
this.setName(set.getString("name"));
|
||||||
String[] parts = set.getString("setid").split(",");
|
String[] parts = set.getString("setid").split(",");
|
||||||
|
|
||||||
this.setId = new int[parts.length];
|
this.setSetId(new int[parts.length]);
|
||||||
for (int i = 0; i < this.setId.length; i++) {
|
for (int i = 0; i < this.getSetId().length; i++) {
|
||||||
this.setId[i] = Integer.valueOf(parts[i]);
|
this.getSetId()[i] = Integer.parseInt(parts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
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 lombok.Getter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -11,27 +12,21 @@ import java.util.TimeZone;
|
|||||||
|
|
||||||
public class ClubOffer implements ISerialize {
|
public class ClubOffer implements ISerialize {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final int id;
|
private final int id;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final int days;
|
private final int days;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final int credits;
|
private final int credits;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final int points;
|
private final int points;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final int pointsType;
|
private final int pointsType;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final boolean vip;
|
private final boolean vip;
|
||||||
|
@Getter
|
||||||
|
|
||||||
private final boolean deal;
|
private final boolean deal;
|
||||||
|
|
||||||
public ClubOffer(ResultSet set) throws SQLException {
|
public ClubOffer(ResultSet set) throws SQLException {
|
||||||
@ -45,38 +40,6 @@ public class ClubOffer implements ISerialize {
|
|||||||
this.deal = set.getString("deal").equals("1");
|
this.deal = set.getString("deal").equals("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDays() {
|
|
||||||
return this.days;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCredits() {
|
|
||||||
return this.credits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPoints() {
|
|
||||||
return this.points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPointsType() {
|
|
||||||
return this.pointsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVip() {
|
|
||||||
return this.vip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDeal() {
|
|
||||||
return this.deal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ServerMessage message) {
|
public void serialize(ServerMessage message) {
|
||||||
serialize(message, Emulator.getIntUnixTimestamp());
|
serialize(message, Emulator.getIntUnixTimestamp());
|
||||||
|
@ -4,6 +4,7 @@ package com.eu.habbo.habbohotel.catalog;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
|
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -11,18 +12,31 @@ import java.sql.SQLException;
|
|||||||
public class TargetOffer {
|
public class TargetOffer {
|
||||||
public static int ACTIVE_TARGET_OFFER_ID = 0;
|
public static int ACTIVE_TARGET_OFFER_ID = 0;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final int id;
|
private final int id;
|
||||||
|
@Getter
|
||||||
private final int catalogItem;
|
private final int catalogItem;
|
||||||
|
@Getter
|
||||||
private final String identifier;
|
private final String identifier;
|
||||||
|
@Getter
|
||||||
private final int priceInCredits;
|
private final int priceInCredits;
|
||||||
|
@Getter
|
||||||
private final int priceInActivityPoints;
|
private final int priceInActivityPoints;
|
||||||
|
@Getter
|
||||||
private final int activityPointsType;
|
private final int activityPointsType;
|
||||||
|
@Getter
|
||||||
private final int purchaseLimit;
|
private final int purchaseLimit;
|
||||||
|
@Getter
|
||||||
private final int expirationTime;
|
private final int expirationTime;
|
||||||
|
@Getter
|
||||||
private final String title;
|
private final String title;
|
||||||
|
@Getter
|
||||||
private final String description;
|
private final String description;
|
||||||
|
@Getter
|
||||||
private final String imageUrl;
|
private final String imageUrl;
|
||||||
|
@Getter
|
||||||
private final String icon;
|
private final String icon;
|
||||||
|
@Getter
|
||||||
private final String[] vars;
|
private final String[] vars;
|
||||||
|
|
||||||
public TargetOffer(ResultSet set) throws SQLException {
|
public TargetOffer(ResultSet set) throws SQLException {
|
||||||
@ -62,55 +76,4 @@ public class TargetOffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIdentifier() {
|
|
||||||
return this.identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPriceInCredits() {
|
|
||||||
return this.priceInCredits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPriceInActivityPoints() {
|
|
||||||
return this.priceInActivityPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getActivityPointsType() {
|
|
||||||
return this.activityPointsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPurchaseLimit() {
|
|
||||||
return this.purchaseLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getExpirationTime() {
|
|
||||||
return this.expirationTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImageUrl() {
|
|
||||||
return this.imageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIcon() {
|
|
||||||
return this.icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getVars() {
|
|
||||||
return this.vars;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCatalogItem() {
|
|
||||||
return this.catalogItem;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -11,17 +11,23 @@ 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 String code;
|
private final int id;
|
||||||
public final int credits;
|
@Getter
|
||||||
public final int points;
|
private final String code;
|
||||||
public final int pointsType;
|
@Getter
|
||||||
public final int catalogItemId;
|
private final int credits;
|
||||||
public final int amount;
|
@Getter
|
||||||
public final int limit;
|
private final int points;
|
||||||
|
@Getter
|
||||||
|
private final int pointsType;
|
||||||
|
@Getter
|
||||||
|
private final int catalogItemId;
|
||||||
|
private final int amount;
|
||||||
|
private final int limit;
|
||||||
private final List<VoucherHistoryEntry> history = new ArrayList<>();
|
private final List<VoucherHistoryEntry> history = new ArrayList<>();
|
||||||
|
|
||||||
public Voucher(ResultSet set) throws SQLException {
|
public Voucher(ResultSet set) throws SQLException {
|
||||||
@ -46,7 +52,7 @@ public class Voucher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +75,8 @@ public class Voucher {
|
|||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
package com.eu.habbo.habbohotel.catalog;
|
package com.eu.habbo.habbohotel.catalog;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class VoucherHistoryEntry {
|
public class VoucherHistoryEntry {
|
||||||
|
@Getter
|
||||||
private final int voucherId;
|
private final int voucherId;
|
||||||
|
@Getter
|
||||||
private final int userId;
|
private final int userId;
|
||||||
|
@Getter
|
||||||
private final int timestamp;
|
private final int timestamp;
|
||||||
|
|
||||||
public VoucherHistoryEntry(ResultSet set) throws SQLException {
|
public VoucherHistoryEntry(ResultSet set) throws SQLException {
|
||||||
@ -14,21 +21,4 @@ public class VoucherHistoryEntry {
|
|||||||
this.timestamp = set.getInt("timestamp");
|
this.timestamp = set.getInt("timestamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoucherHistoryEntry(int voucherId, int userId, int timestamp) {
|
|
||||||
this.voucherId = voucherId;
|
|
||||||
this.userId = userId;
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVoucherId() {
|
|
||||||
return voucherId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,20 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomManager;
|
import com.eu.habbo.habbohotel.rooms.RoomManager;
|
||||||
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.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
|
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 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);
|
private final int roomId;
|
||||||
|
private Room room;
|
||||||
public int roomId;
|
|
||||||
public Room room;
|
|
||||||
private int lastUpdate = 0;
|
private int lastUpdate = 0;
|
||||||
private boolean loaded = false;
|
private boolean loaded = false;
|
||||||
|
|
||||||
@ -48,7 +45,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
if (this.room != null)
|
if (this.room != null)
|
||||||
this.room.preventUnloading = true;
|
this.room.preventUnloading = true;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")");
|
log.error("No room id specified for room bundle " + this.getPageName() + "(" + this.getId() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,15 +55,12 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
|
|
||||||
final CatalogItem[] item = {null};
|
final CatalogItem[] item = {null};
|
||||||
|
|
||||||
super.getCatalogItems().forEachValue(new TObjectProcedure<CatalogItem>() {
|
super.getCatalogItems().forEachValue(object -> {
|
||||||
@Override
|
if (object == null)
|
||||||
public boolean execute(CatalogItem object) {
|
return true;
|
||||||
if (object == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
item[0] = object;
|
item[0] = object;
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.room.isPreLoaded()) {
|
if (this.room.isPreLoaded()) {
|
||||||
@ -96,7 +90,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!item[0].getExtradata().isEmpty()) {
|
if (!item[0].getExtradata().isEmpty()) {
|
||||||
items.put(Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(item[0].getExtradata())), 1);
|
items.put(Emulator.getGameEnvironment().getItemManager().getItem(Integer.parseInt(item[0].getExtradata())), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
@ -190,7 +184,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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +218,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);
|
Room r = Emulator.getGameEnvironment().getRoomManager().loadRoom(roomId);
|
||||||
@ -241,7 +235,7 @@ public class RoomBundleLayout extends SingleBundle {
|
|||||||
keys.put("image", "${image.library.url}/notifications/room_bundle_" + this.getId() + ".png");
|
keys.put("image", "${image.library.url}/notifications/room_bundle_" + this.getId() + ".png");
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.PURCHASING_ROOM.key, keys));
|
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.PURCHASING_ROOM.getKey(), keys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,16 +8,15 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import com.eu.habbo.messages.incoming.catalog.marketplace.GetMarketplaceOffersEvent;
|
import com.eu.habbo.messages.incoming.catalog.marketplace.GetMarketplaceOffersEvent;
|
||||||
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceBuyOfferResultComposer;
|
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceBuyOfferResultComposer;
|
||||||
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceCancelOfferResultComposer;
|
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceCancelOfferResultComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListRemoveComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListRemoveComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.CreditBalanceComposer;
|
import com.eu.habbo.messages.outgoing.users.CreditBalanceComposer;
|
||||||
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemCancelledEvent;
|
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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@ -27,8 +26,8 @@ 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;
|
||||||
@ -47,7 +46,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return offers;
|
return offers;
|
||||||
@ -105,7 +104,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
habbo.getClient().sendResponse(new MarketplaceCancelOfferResultComposer(offer, false));
|
habbo.getClient().sendResponse(new MarketplaceCancelOfferResultComposer(offer, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +168,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return offers;
|
return offers;
|
||||||
@ -199,7 +198,7 @@ public class MarketPlace {
|
|||||||
message.appendInt(1);
|
message.appendInt(1);
|
||||||
message.appendInt(itemId);
|
message.appendInt(itemId);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +213,7 @@ public class MarketPlace {
|
|||||||
number = set.getInt("number");
|
number = set.getInt("number");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return number;
|
return number;
|
||||||
@ -232,7 +231,7 @@ public class MarketPlace {
|
|||||||
avg = set.getInt("avg");
|
avg = set.getInt("avg");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return calculateCommision(avg);
|
return calculateCommision(avg);
|
||||||
@ -279,7 +278,7 @@ public class MarketPlace {
|
|||||||
client.getHabbo().getInventory().getItemsComponent().addItem(item);
|
client.getHabbo().getInventory().getItemsComponent().addItem(item);
|
||||||
|
|
||||||
if (MARKETPLACE_CURRENCY == 0) {
|
if (MARKETPLACE_CURRENCY == 0) {
|
||||||
client.getHabbo().getHabboInfo().addCredits(-event.price);
|
client.getHabbo().giveCredits(-event.price);
|
||||||
} else {
|
} else {
|
||||||
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, -event.price);
|
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, -event.price);
|
||||||
}
|
}
|
||||||
@ -300,22 +299,23 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void sendErrorMessage(GameClient client, int baseItemId, int offerId) {
|
public static void sendErrorMessage(GameClient client, int baseItemId, int offerId) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT marketplace_items.*, COUNT( * ) AS count\n" +
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT marketplace_items.*, COUNT( * ) AS count\n" +
|
||||||
"FROM marketplace_items\n" +
|
"""
|
||||||
"INNER JOIN items ON marketplace_items.item_id = items.id\n" +
|
FROM marketplace_items
|
||||||
"INNER JOIN items_base ON items.item_id = items_base.id\n" +
|
INNER JOIN items ON marketplace_items.item_id = items.id
|
||||||
"WHERE items_base.sprite_id = ( \n" +
|
INNER JOIN items_base ON items.item_id = items_base.id
|
||||||
"SELECT items_base.sprite_id\n" +
|
WHERE items_base.sprite_id = (
|
||||||
"FROM items_base\n" +
|
SELECT items_base.sprite_id
|
||||||
"WHERE items_base.id = ? LIMIT 1)\n" +
|
FROM items_base
|
||||||
"ORDER BY price ASC\n" +
|
WHERE items_base.id = ? LIMIT 1)
|
||||||
"LIMIT 1", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
ORDER BY price ASC
|
||||||
|
LIMIT 1""", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
|
||||||
statement.setInt(1, baseItemId);
|
statement.setInt(1, baseItemId);
|
||||||
try (ResultSet countSet = statement.executeQuery()) {
|
try (ResultSet countSet = statement.executeQuery()) {
|
||||||
countSet.last();
|
countSet.last();
|
||||||
@ -327,7 +327,7 @@ public class MarketPlace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ public class MarketPlace {
|
|||||||
client.getHabbo().getInventory().removeMarketplaceOffer(offer);
|
client.getHabbo().getInventory().removeMarketplaceOffer(offer);
|
||||||
credits += offer.getPrice();
|
credits += offer.getPrice();
|
||||||
removeUser(offer);
|
removeUser(offer);
|
||||||
offer.needsUpdate(true);
|
offer.setNeedsUpdate(true);
|
||||||
Emulator.getThreading().run(offer);
|
Emulator.getThreading().run(offer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ public class MarketPlace {
|
|||||||
offers.clear();
|
offers.clear();
|
||||||
|
|
||||||
if (MARKETPLACE_CURRENCY == 0) {
|
if (MARKETPLACE_CURRENCY == 0) {
|
||||||
client.getHabbo().getHabboInfo().addCredits(credits);
|
client.getHabbo().giveCredits(credits);
|
||||||
} else {
|
} else {
|
||||||
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, credits);
|
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, credits);
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ public class MarketPlace {
|
|||||||
statement.setInt(2, offer.getOfferId());
|
statement.setInt(2, offer.getOfferId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,25 +5,38 @@ 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 org.slf4j.Logger;
|
import lombok.Getter;
|
||||||
import org.slf4j.LoggerFactory;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
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 average;
|
||||||
|
|
||||||
public int avarage;
|
|
||||||
public int count;
|
public int count;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private int offerId;
|
private int offerId;
|
||||||
private Item baseItem;
|
private final Item baseItem;
|
||||||
private int itemId;
|
|
||||||
|
private final int itemId;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private int price;
|
private int price;
|
||||||
|
@Getter
|
||||||
private int limitedStack;
|
private int limitedStack;
|
||||||
|
@Getter
|
||||||
private int limitedNumber;
|
private int limitedNumber;
|
||||||
|
@Getter
|
||||||
private int timestamp = Emulator.getIntUnixTimestamp();
|
private int timestamp = Emulator.getIntUnixTimestamp();
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private int soldTimestamp = 0;
|
private int soldTimestamp = 0;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private MarketPlaceState state = MarketPlaceState.OPEN;
|
private MarketPlaceState state = MarketPlaceState.OPEN;
|
||||||
|
@Setter
|
||||||
private boolean needsUpdate = false;
|
private boolean needsUpdate = false;
|
||||||
|
|
||||||
public MarketPlaceOffer(ResultSet set, boolean privateOffer) throws SQLException {
|
public MarketPlaceOffer(ResultSet set, boolean privateOffer) throws SQLException {
|
||||||
@ -36,12 +49,12 @@ public class MarketPlaceOffer implements Runnable {
|
|||||||
this.itemId = set.getInt("item_id");
|
this.itemId = set.getInt("item_id");
|
||||||
|
|
||||||
if (!set.getString("ltd_data").split(":")[1].equals("0")) {
|
if (!set.getString("ltd_data").split(":")[1].equals("0")) {
|
||||||
this.limitedStack = Integer.valueOf(set.getString("ltd_data").split(":")[0]);
|
this.limitedStack = Integer.parseInt(set.getString("ltd_data").split(":")[0]);
|
||||||
this.limitedNumber = Integer.valueOf(set.getString("ltd_data").split(":")[1]);
|
this.limitedNumber = Integer.parseInt(set.getString("ltd_data").split(":")[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!privateOffer) {
|
if (!privateOffer) {
|
||||||
this.avarage = set.getInt("avg");
|
this.average = set.getInt("avg");
|
||||||
this.count = set.getInt("number");
|
this.count = set.getInt("number");
|
||||||
this.price = set.getInt("minPrice");
|
this.price = set.getInt("minPrice");
|
||||||
}
|
}
|
||||||
@ -70,7 +83,7 @@ public class MarketPlaceOffer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,69 +103,10 @@ public class MarketPlaceOffer implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOfferId() {
|
|
||||||
return this.offerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOfferId(int offerId) {
|
|
||||||
this.offerId = offerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemId() {
|
|
||||||
return this.baseItem.getSpriteId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPrice() {
|
|
||||||
return this.price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MarketPlaceState getState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(MarketPlaceState state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTimestamp() {
|
|
||||||
return this.timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSoldTimestamp() {
|
|
||||||
return this.soldTimestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSoldTimestamp(int soldTimestamp) {
|
|
||||||
this.soldTimestamp = soldTimestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLimitedStack() {
|
|
||||||
return this.limitedStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLimitedNumber() {
|
|
||||||
return this.limitedNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSoldItemId() {
|
|
||||||
return this.itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void needsUpdate(boolean value) {
|
|
||||||
this.needsUpdate = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
if (this.limitedStack > 0) {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.baseItem.getType().equals(FurnitureType.WALL) ? 2 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -164,8 +118,25 @@ 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) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
if (this.limitedStack > 0) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.baseItem.getType().equals(FurnitureType.WALL) ? 2 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemId() {
|
||||||
|
return this.baseItem.getSpriteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getSoldItemId() {
|
||||||
|
return this.itemId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,27 @@
|
|||||||
package com.eu.habbo.habbohotel.catalog.marketplace;
|
package com.eu.habbo.habbohotel.catalog.marketplace;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
public enum MarketPlaceState {
|
public enum MarketPlaceState {
|
||||||
|
|
||||||
OPEN(1),
|
OPEN(1),
|
||||||
|
|
||||||
|
|
||||||
SOLD(2),
|
SOLD(2),
|
||||||
|
|
||||||
|
|
||||||
CLOSED(3);
|
CLOSED(3);
|
||||||
|
|
||||||
private final int state;
|
private final int state;
|
||||||
|
|
||||||
MarketPlaceState(int state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MarketPlaceState getType(int type) {
|
public static MarketPlaceState getType(int type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case 1:
|
case 1 -> OPEN;
|
||||||
return OPEN;
|
case 2 -> SOLD;
|
||||||
case 2:
|
case 3 -> CLOSED;
|
||||||
return SOLD;
|
default -> CLOSED;
|
||||||
case 3:
|
};
|
||||||
return CLOSED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CLOSED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,14 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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(";"));
|
||||||
@ -53,7 +52,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
|
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.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,16 +6,15 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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(";"));
|
||||||
@ -64,7 +63,6 @@ public class BadgeCommand extends Command {
|
|||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
|
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
|
||||||
statement.setInt(1, habboInfo.getId());
|
statement.setInt(1, habboInfo.getId());
|
||||||
@ -73,10 +71,10 @@ public class BadgeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class BanCommand extends Command {
|
|||||||
|
|
||||||
int banTime;
|
int banTime;
|
||||||
try {
|
try {
|
||||||
banTime = Integer.valueOf(params[2]);
|
banTime = Integer.parseInt(params[2]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.invalid_time"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.invalid_time"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -39,7 +39,7 @@ public class BanCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[1].toLowerCase().equals(gameClient.getHabbo().getHabboInfo().getUsername().toLowerCase())) {
|
if (params[1].equalsIgnoreCase(gameClient.getHabbo().getHabboInfo().getUsername())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.ban_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.ban_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ public class BanCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().ban(target.getId(), gameClient.getHabbo(), reason.toString(), banTime, ModToolBanType.ACCOUNT, -1).get(0);
|
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().ban(target.getId(), gameClient.getHabbo(), reason.toString(), banTime, ModToolBanType.ACCOUNT, -1).get(0);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_ban.ban_issued").replace("%user%", target.getUsername()).replace("%time%", ban.expireDate - Emulator.getIntUnixTimestamp() + "").replace("%reason%", ban.reason), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_ban.ban_issued").replace("%user%", target.getUsername()).replace("%time%", ban.getExpireDate() - Emulator.getIntUnixTimestamp() + "").replace("%reason%", ban.getReason()), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ public class BlockAlertCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
gameClient.getHabbo().getHabboStats().blockStaffAlerts = !gameClient.getHabbo().getHabboStats().blockStaffAlerts;
|
gameClient.getHabbo().getHabboStats().setBlockStaffAlerts(!gameClient.getHabbo().getHabboStats().isBlockStaffAlerts());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_blockalert").replace("%state%", (gameClient.getHabbo().getHabboStats().blockStaffAlerts ? Emulator.getTexts().getValue("generic.on") : Emulator.getTexts().getValue("generic.off"))), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_blockalert").replace("%state%", (gameClient.getHabbo().getHabboStats().isBlockStaffAlerts() ? Emulator.getTexts().getValue("generic.on") : Emulator.getTexts().getValue("generic.off"))), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class CalendarCommand extends Command {
|
|||||||
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
||||||
|
|
||||||
if (daysBetween >= 0) {
|
if (daysBetween >= 0) {
|
||||||
gameClient.sendResponse(new CampaignCalendarDataMessageComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, campaign.getLockExpired()));
|
gameClient.sendResponse(new CampaignCalendarDataMessageComposer(campaign.getName(), campaign.getImage(), campaign.getTotalDays(), daysBetween, gameClient.getHabbo().getHabboStats().getCalendarRewardsClaimed(), campaign.getLockExpired()));
|
||||||
gameClient.sendResponse(new InClientLinkMessageComposer("openView/calendar"));
|
gameClient.sendResponse(new InClientLinkMessageComposer("openView/calendar"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class ChangeNameCommand extends Command {
|
|||||||
|
|
||||||
// check if there are no params
|
// check if there are no params
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().getHabboStats().allowNameChange = !gameClient.getHabbo().getHabboStats().allowNameChange;
|
gameClient.getHabbo().getHabboStats().setAllowNameChange(!gameClient.getHabbo().getHabboStats().isAllowNameChange());
|
||||||
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public class ChangeNameCommand extends Command {
|
|||||||
// this runs if params[1] is a valid habbo
|
// this runs if params[1] is a valid habbo
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_changename.done").replace("%user%", params[1]));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_changename.done").replace("%user%", params[1]));
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.succes.cmd_changename.received"));
|
habbo.alert(Emulator.getTexts().getValue("commands.succes.cmd_changename.received"));
|
||||||
habbo.getHabboStats().allowNameChange = !habbo.getHabboStats().allowNameChange;
|
habbo.getHabboStats().setAllowNameChange(!habbo.getHabboStats().isAllowNameChange());
|
||||||
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class ChatTypeCommand extends Command {
|
|||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
int chatColor;
|
int chatColor;
|
||||||
try {
|
try {
|
||||||
chatColor = Integer.valueOf(params[1]);
|
chatColor = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -34,21 +34,20 @@ public class ChatTypeCommand extends Command {
|
|||||||
|
|
||||||
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
||||||
for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) {
|
for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) {
|
||||||
if (Integer.valueOf(s) == chatColor) {
|
if (Integer.parseInt(s) == chatColor) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().getHabboStats().chatColor = RoomChatMessageBubbles.getBubble(chatColor);
|
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.getBubble(chatColor));
|
||||||
gameClient.sendResponse(new AccountPreferencesComposer(gameClient.getHabbo()));
|
gameClient.sendResponse(new AccountPreferencesComposer(gameClient.getHabbo()));
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.set").replace("%chat%", RoomChatMessageBubbles.values()[chatColor].name().replace("_", " ").toLowerCase()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.set").replace("%chat%", RoomChatMessageBubbles.values()[chatColor].name().replace("_", " ").toLowerCase()), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().getHabboStats().chatColor = RoomChatMessageBubbles.NORMAL;
|
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.NORMAL);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.reset"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.reset"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
package com.eu.habbo.habbohotel.commands;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
|
|
||||||
public final String permission;
|
public final String permission;
|
||||||
|
|
||||||
|
|
||||||
public final String[] keys;
|
public final String[] keys;
|
||||||
|
|
||||||
public Command(String permission, String[] keys) {
|
|
||||||
this.permission = permission;
|
|
||||||
this.keys = keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public abstract boolean handle(GameClient gameClient, String[] params) throws Exception;
|
public abstract boolean handle(GameClient gameClient, String[] params) throws Exception;
|
||||||
}
|
}
|
@ -16,30 +16,25 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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 = (c1, c2) -> {
|
||||||
public int compare(Command c1, Command c2) {
|
int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
|
||||||
int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
|
return (res != 0) ? res : c1.permission.compareTo(c2.permission);
|
||||||
return (res != 0) ? res : c1.permission.compareTo(c2.permission);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public CommandHandler() {
|
public CommandHandler() {
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
this.reloadCommands();
|
this.reloadCommands();
|
||||||
LOGGER.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
log.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCommand(Command command) {
|
public static void addCommand(Command command) {
|
||||||
@ -54,9 +49,9 @@ public class CommandHandler {
|
|||||||
try {
|
try {
|
||||||
//command.getConstructor().setAccessible(true);
|
//command.getConstructor().setAccessible(true);
|
||||||
addCommand(command.newInstance());
|
addCommand(command.newInstance());
|
||||||
LOGGER.debug("Added command: {}", command.getName());
|
log.debug("Added command: {}", command.getName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +66,7 @@ public class CommandHandler {
|
|||||||
if (parts.length >= 1) {
|
if (parts.length >= 1) {
|
||||||
for (Command command : commands.values()) {
|
for (Command command : commands.values()) {
|
||||||
for (String s : command.keys) {
|
for (String s : command.keys) {
|
||||||
if (s.toLowerCase().equals(parts[0].toLowerCase())) {
|
if (s.equalsIgnoreCase(parts[0])) {
|
||||||
boolean succes = false;
|
boolean succes = false;
|
||||||
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))) {
|
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))) {
|
||||||
try {
|
try {
|
||||||
@ -90,7 +85,7 @@ public class CommandHandler {
|
|||||||
|
|
||||||
succes = event.succes;
|
succes = event.succes;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
|
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
|
||||||
@ -137,7 +132,7 @@ public class CommandHandler {
|
|||||||
s = new StringBuilder(s.substring(0, s.length() - 1));
|
s = new StringBuilder(s.substring(0, s.length() - 1));
|
||||||
|
|
||||||
for (PetCommand command : pet.getPetData().getPetCommands()) {
|
for (PetCommand command : pet.getPetData().getPetCommands()) {
|
||||||
if (command.key.equalsIgnoreCase(s.toString())) {
|
if (command.getKey().equalsIgnoreCase(s.toString())) {
|
||||||
if (pet instanceof RideablePet && ((RideablePet) pet).getRider() != null) {
|
if (pet instanceof RideablePet && ((RideablePet) pet).getRider() != null) {
|
||||||
if (((RideablePet) pet).getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
if (((RideablePet) pet).getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
||||||
((RideablePet) pet).getRider().getHabboInfo().dismountPet();
|
((RideablePet) pet).getRider().getHabboInfo().dismountPet();
|
||||||
@ -145,7 +140,7 @@ public class CommandHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.level <= pet.getLevel())
|
if (command.getLevel() <= pet.getLevel())
|
||||||
pet.handleCommand(command, gameClient.getHabbo(), args);
|
pet.handleCommand(command, gameClient.getHabbo(), args);
|
||||||
else
|
else
|
||||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
|
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
|
||||||
@ -307,7 +302,7 @@ public class CommandHandler {
|
|||||||
if (allowedCommands.contains(command))
|
if (allowedCommands.contains(command))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (permissions.contains(command.permission) && permissions.get(command.permission).setting != PermissionSetting.DISALLOWED) {
|
if (permissions.contains(command.permission) && permissions.get(command.permission).getSetting() != PermissionSetting.DISALLOWED) {
|
||||||
allowedCommands.add(command);
|
allowedCommands.add(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,6 +315,6 @@ public class CommandHandler {
|
|||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
commands.clear();
|
commands.clear();
|
||||||
LOGGER.info("Command Handler -> Disposed!");
|
log.info("Command Handler -> Disposed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ public class ControlCommand extends Command {
|
|||||||
gameClient.getHabbo().getRoomUnit().getCacheable().put("control", target);
|
gameClient.getHabbo().getRoomUnit().getCacheable().put("control", target);
|
||||||
target.getRoomUnit().getCacheable().put("controller", gameClient.getHabbo());
|
target.getRoomUnit().getCacheable().put("controller", gameClient.getHabbo());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.controlling").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.controlling").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
Object habbo = gameClient.getHabbo().getRoomUnit().getCacheable().get("control");
|
Object habbo = gameClient.getHabbo().getRoomUnit().getCacheable().get("control");
|
||||||
|
|
||||||
@ -44,8 +43,8 @@ public class ControlCommand extends Command {
|
|||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.stopped").replace("%user%", ((Habbo) habbo).getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.stopped").replace("%user%", ((Habbo) habbo).getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -24,20 +24,20 @@ public class CoordsCommand extends Command {
|
|||||||
Emulator.getTexts().getValue("generic.rotation.head") + ": " + gameClient.getHabbo().getRoomUnit().getHeadRotation() + "-" + gameClient.getHabbo().getRoomUnit().getHeadRotation().getValue() + "\r" +
|
Emulator.getTexts().getValue("generic.rotation.head") + ": " + gameClient.getHabbo().getRoomUnit().getHeadRotation() + "-" + gameClient.getHabbo().getRoomUnit().getHeadRotation().getValue() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.rotation.body") + ": " + gameClient.getHabbo().getRoomUnit().getBodyRotation() + "-" + gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue() + "\r" +
|
Emulator.getTexts().getValue("generic.rotation.body") + ": " + gameClient.getHabbo().getRoomUnit().getBodyRotation() + "-" + gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" +
|
Emulator.getTexts().getValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" +
|
||||||
"Tile State: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).state.name() + "\r" +
|
"Tile State: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getState().name() + "\r" +
|
||||||
"Tile Walkable: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).isWalkable() + "\r" +
|
"Tile Walkable: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).isWalkable() + "\r" +
|
||||||
"Tile relative height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).relativeHeight() + "\r" +
|
"Tile relative height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).relativeHeight() + "\r" +
|
||||||
"Tile stack height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getStackHeight());
|
"Tile stack height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getStackHeight());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(Short.valueOf(params[1]), Short.valueOf(params[2]));
|
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(Short.parseShort(params[1]), Short.parseShort(params[2]));
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
|
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
|
||||||
"x: " + tile.x + "\r" +
|
"x: " + tile.getX() + "\r" +
|
||||||
"y: " + tile.y + "\r" +
|
"y: " + tile.getY() + "\r" +
|
||||||
"z: " + tile.z + "\r" +
|
"z: " + tile.getZ() + "\r" +
|
||||||
"Tile State: " + tile.state.name() + "\r" +
|
"Tile State: " + tile.getState().name() + "\r" +
|
||||||
"Tile Relative Height: " + tile.relativeHeight() + "\r" +
|
"Tile Relative Height: " + tile.relativeHeight() + "\r" +
|
||||||
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
|
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
|
||||||
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
|
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
|
||||||
|
@ -17,7 +17,7 @@ public class DisconnectCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[1].toLowerCase().equals(gameClient.getHabbo().getHabboInfo().getUsername().toLowerCase())) {
|
if (params[1].equalsIgnoreCase(gameClient.getHabbo().getHabboInfo().getUsername())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.disconnect_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.disconnect_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import com.eu.habbo.habbohotel.permissions.Permission;
|
|||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
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 com.eu.habbo.messages.outgoing.inventory.PetInventoryComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.inventory.PetInventoryComposer;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
|
||||||
public class EmptyPetsInventoryCommand extends Command {
|
public class EmptyPetsInventoryCommand extends Command {
|
||||||
|
@ -5,12 +5,10 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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(";"));
|
||||||
}
|
}
|
||||||
@ -43,7 +41,7 @@ public class EnableCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class EventCommand extends Command {
|
|||||||
|
|
||||||
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();
|
||||||
if (habbo.getHabboStats().blockStaffAlerts)
|
if (habbo.getHabboStats().isBlockStaffAlerts()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
habbo.getClient().sendResponse(msg);
|
habbo.getClient().sendResponse(msg);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class FacelessCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,14 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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(";"));
|
||||||
@ -39,7 +38,7 @@ public class FilterWordCommand extends Command {
|
|||||||
statement.setString(2, replacement);
|
statement.setString(2, replacement);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.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,13 +23,12 @@ public class FreezeCommand extends Command {
|
|||||||
habbo.getRoomUnit().setCanWalk(false);
|
habbo.getRoomUnit().setCanWalk(false);
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.frozen"), RoomChatMessageBubbles.ALERT);
|
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.frozen"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_frozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_frozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
habbo.getRoomUnit().setCanWalk(true);
|
habbo.getRoomUnit().setCanWalk(true);
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.unfrozen"), RoomChatMessageBubbles.ALERT);
|
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.unfrozen"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_unfrozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_unfrozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
||||||
|
@ -8,8 +8,8 @@ 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.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class GiftCommand extends Command {
|
|||||||
int itemId;
|
int itemId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
itemId = Integer.valueOf(params[2]);
|
itemId = Integer.parseInt(params[2]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -80,7 +80,7 @@ public class GiftCommand extends Command {
|
|||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}notifications/gift.gif");
|
keys.put("image", "${image.library.url}notifications/gift.gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
||||||
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
|
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class GiveRankCommand extends Command {
|
|||||||
|
|
||||||
if (params.length == 3) {
|
if (params.length == 3) {
|
||||||
if (StringUtils.isNumeric(params[2])) {
|
if (StringUtils.isNumeric(params[2])) {
|
||||||
int rankId = Integer.valueOf(params[2]);
|
int rankId = Integer.parseInt(params[2]);
|
||||||
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
|
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
|
||||||
rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId);
|
rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId);
|
||||||
} else {
|
} else {
|
||||||
@ -52,11 +52,10 @@ public class GiveRankCommand extends Command {
|
|||||||
Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), rank.getId());
|
Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), rank.getId());
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_give_rank.updated").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_give_rank.updated").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.user_offline").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.user_offline").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class HotelAlertCommand extends Command {
|
|||||||
|
|
||||||
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();
|
||||||
if (habbo.getHabboStats().blockStaffAlerts)
|
if (habbo.getHabboStats().isBlockStaffAlerts())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
habbo.getClient().sendResponse(msg);
|
habbo.getClient().sendResponse(msg);
|
||||||
|
@ -6,9 +6,9 @@ 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.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.RoomUsersComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserRemoveMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.UserRemoveMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
|
|
||||||
import com.eu.habbo.threading.runnables.RoomUnitTeleport;
|
import com.eu.habbo.threading.runnables.RoomUnitTeleport;
|
||||||
|
|
||||||
public class InvisibleCommand extends Command {
|
public class InvisibleCommand extends Command {
|
||||||
@ -23,7 +23,7 @@ public class InvisibleCommand extends Command {
|
|||||||
if (roomUnit.isInvisible()) {
|
if (roomUnit.isInvisible()) {
|
||||||
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().getX(), roomLayout.getDoorTile().getY(), roomLayout.getDoorTile().getZ(), 0).run();
|
||||||
|
|
||||||
roomUnit.setInvisible(false);
|
roomUnit.setInvisible(false);
|
||||||
roomUnit.setInRoom(true);
|
roomUnit.setInRoom(true);
|
||||||
|
@ -7,8 +7,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class MassBadgeCommand extends Command {
|
|||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||||
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
|
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).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();
|
||||||
@ -40,18 +40,17 @@ public class MassBadgeCommand extends Command {
|
|||||||
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||||
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||||
|
|
||||||
if (b != null) {
|
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
||||||
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
habbo.getClient().sendResponse(message);
|
||||||
|
|
||||||
habbo.getClient().sendResponse(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massbadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massbadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class MassCreditsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(params[1]);
|
amount = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,8 +7,8 @@ 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.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class MassGiftCommand extends Command {
|
|||||||
int itemId;
|
int itemId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
itemId = Integer.valueOf(params[1]);
|
itemId = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -57,7 +57,7 @@ public class MassGiftCommand extends Command {
|
|||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}notifications/gift.gif");
|
keys.put("image", "${image.library.url}notifications/gift.gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
||||||
ServerMessage giftNotificiationMessage = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
|
ServerMessage giftNotificiationMessage = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||||
|
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||||
|
@ -18,7 +18,7 @@ public class MassPixelsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(params[1]);
|
amount = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,7 @@ public class MassPointsCommand extends Command {
|
|||||||
if (params.length == 3) {
|
if (params.length == 3) {
|
||||||
amountString = params[1];
|
amountString = params[1];
|
||||||
try {
|
try {
|
||||||
type = Integer.valueOf(params[2]);
|
type = Integer.parseInt(params[2]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -48,7 +48,7 @@ public class MassPointsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(amountString);
|
amount = Integer.parseInt(amountString);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -11,8 +11,8 @@ public class MuteBotsCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
gameClient.getHabbo().getHabboStats().ignoreBots = !gameClient.getHabbo().getHabboStats().ignoreBots;
|
gameClient.getHabbo().getHabboStats().setIgnoreBots(!gameClient.getHabbo().getHabboStats().isIgnoreBots());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().ignoreBots ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().isIgnoreBots() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ public class MuteCommand extends Command {
|
|||||||
|
|
||||||
if (params.length == 3) {
|
if (params.length == 3) {
|
||||||
try {
|
try {
|
||||||
duration = Integer.valueOf(params[2]);
|
duration = Integer.parseInt(params[2]);
|
||||||
|
|
||||||
if (duration <= 0)
|
if (duration <= 0)
|
||||||
throw new Exception("");
|
throw new Exception("");
|
||||||
|
@ -11,8 +11,8 @@ public class MutePetsCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
gameClient.getHabbo().getHabboStats().ignorePets = !gameClient.getHabbo().getHabboStats().ignorePets;
|
gameClient.getHabbo().getHabboStats().setIgnorePets(!gameClient.getHabbo().getHabboStats().isIgnorePets());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().ignorePets ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().isIgnorePets() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,10 +2,8 @@ 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.pets.Pet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.PetManager;
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import gnu.trove.procedure.TIntObjectProcedure;
|
|
||||||
|
|
||||||
public class PetInfoCommand extends Command {
|
public class PetInfoCommand extends Command {
|
||||||
public PetInfoCommand() {
|
public PetInfoCommand() {
|
||||||
@ -20,30 +18,27 @@ public class PetInfoCommand extends Command {
|
|||||||
|
|
||||||
String name = params[1];
|
String name = params[1];
|
||||||
|
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry(new TIntObjectProcedure<Pet>() {
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry((a, pet) -> {
|
||||||
@Override
|
if (pet.getName().equalsIgnoreCase(name)) {
|
||||||
public boolean execute(int a, Pet pet) {
|
gameClient.getHabbo().alert("" +
|
||||||
if (pet.getName().equalsIgnoreCase(name)) {
|
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
|
||||||
gameClient.getHabbo().alert("" +
|
Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
|
||||||
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
|
Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
|
Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
|
Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
|
"\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
|
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
|
||||||
"\r" +
|
Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
|
||||||
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
|
Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
|
Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappiness() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
|
Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappyness() + "\r" +
|
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
|
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
|
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + ""
|
||||||
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +
|
);
|
||||||
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + ""
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
|
||||||
|
@ -20,11 +20,11 @@ public class PixelCommand extends Command {
|
|||||||
if (Integer.parseInt(params[2]) != 0) {
|
if (Integer.parseInt(params[2]) != 0) {
|
||||||
habbo.givePixels(Integer.parseInt(params[2]));
|
habbo.givePixels(Integer.parseInt(params[2]));
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""), RoomChatMessageBubbles.ALERT);
|
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.parseInt(params[2]) + ""), RoomChatMessageBubbles.ALERT);
|
||||||
else
|
else
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""));
|
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.parseInt(params[2]) + ""));
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_duckets.send").replace("%amount%", Integer.valueOf(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_duckets.send").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
|
@ -21,7 +21,7 @@ public class PointsCommand extends Command {
|
|||||||
|
|
||||||
if (params.length == 4) {
|
if (params.length == 4) {
|
||||||
try {
|
try {
|
||||||
type = Integer.valueOf(params[3]);
|
type = Integer.parseInt(params[3]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -31,7 +31,7 @@ public class PointsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(params[2]);
|
amount = Integer.parseInt(params[2]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,8 +47,8 @@ public class PromoteTargetOfferCommand extends Command {
|
|||||||
} else {
|
} else {
|
||||||
int offerId = 0;
|
int offerId = 0;
|
||||||
try {
|
try {
|
||||||
offerId = Integer.valueOf(offerKey);
|
offerId = Integer.parseInt(offerKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offerId > 0) {
|
if (offerId > 0) {
|
||||||
|
@ -31,23 +31,23 @@ public class PushCommand extends Command {
|
|||||||
}
|
}
|
||||||
RoomTile tFront = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
RoomTile tFront = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
||||||
|
|
||||||
if (tFront != null && tFront.isWalkable() && tFront.x == habbo.getRoomUnit().getX() && tFront.y == habbo.getRoomUnit().getY()) {
|
if (tFront != null && tFront.isWalkable()) {
|
||||||
RoomTile tFrontTarget = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(habbo.getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
if (tFront.getX() == habbo.getRoomUnit().getX() && tFront.getY() == habbo.getRoomUnit().getY()) {
|
||||||
|
RoomTile tFrontTarget = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(habbo.getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
||||||
|
|
||||||
if (tFrontTarget != null && tFrontTarget.isWalkable()) {
|
if (tFrontTarget != null && tFrontTarget.isWalkable()) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.invalid").replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.invalid").replace("%username%", params[1]));
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
habbo.getRoomUnit().setGoalLocation(tFrontTarget);
|
||||||
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.succes.cmd_push.push").replace("%user%", params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
||||||
}
|
}
|
||||||
habbo.getRoomUnit().setGoalLocation(tFrontTarget);
|
} else {
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.succes.cmd_push.push").replace("%user%", params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.cant_reach").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.cant_reach").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import com.eu.habbo.threading.runnables.QueryDeleteHabboItems;
|
|||||||
import gnu.trove.map.TIntIntMap;
|
import gnu.trove.map.TIntIntMap;
|
||||||
import gnu.trove.map.hash.TIntIntHashMap;
|
import gnu.trove.map.hash.TIntIntHashMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
import gnu.trove.procedure.TIntIntProcedure;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -35,21 +34,21 @@ public class RedeemCommand extends Command {
|
|||||||
items.add(item);
|
items.add(item);
|
||||||
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
|
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
|
||||||
try {
|
try {
|
||||||
credits += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
|
credits += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (item.getBaseItem().getName().startsWith("PF_")) {
|
} else if (item.getBaseItem().getName().startsWith("PF_")) {
|
||||||
try {
|
try {
|
||||||
pixels += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
|
pixels += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
} else if (item.getBaseItem().getName().startsWith("DF_")) {
|
} else if (item.getBaseItem().getName().startsWith("DF_")) {
|
||||||
int pointsType;
|
int pointsType;
|
||||||
int pointsAmount;
|
int pointsAmount;
|
||||||
|
|
||||||
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
|
pointsType = Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
|
||||||
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
|
pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
|
||||||
|
|
||||||
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ public class RedeemCommand extends Command {
|
|||||||
int pointsAmount;
|
int pointsAmount;
|
||||||
|
|
||||||
pointsType = 5;
|
pointsType = 5;
|
||||||
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
|
pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
|
||||||
|
|
||||||
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
||||||
}
|
}
|
||||||
@ -89,13 +88,10 @@ public class RedeemCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!points.isEmpty()) {
|
if (!points.isEmpty()) {
|
||||||
points.forEachEntry(new TIntIntProcedure() {
|
points.forEachEntry((a, b) -> {
|
||||||
@Override
|
gameClient.getHabbo().givePoints(a, b);
|
||||||
public boolean execute(int a, int b) {
|
message[0] += " ," + Emulator.getTexts().getValue("seasonal.name." + a) + ": " + b;
|
||||||
gameClient.getHabbo().givePoints(a, b);
|
return true;
|
||||||
message[0] += " ," + Emulator.getTexts().getValue("seasonal.name." + a) + ": " + b;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class RoomBadgeCommand extends Command {
|
|||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||||
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
|
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||||
|
|
||||||
for (Habbo habbo : gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()) {
|
for (Habbo habbo : gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()) {
|
||||||
if (habbo.isOnline()) {
|
if (habbo.isOnline()) {
|
||||||
|
@ -7,13 +7,12 @@ 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 org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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(";"));
|
||||||
@ -36,10 +35,10 @@ public class RoomBundleCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
parentId = Integer.valueOf(params[1]);
|
parentId = Integer.parseInt(params[1]);
|
||||||
credits = Integer.valueOf(params[2]);
|
credits = Integer.parseInt(params[2]);
|
||||||
points = Integer.valueOf(params[3]);
|
points = Integer.parseInt(params[3]);
|
||||||
pointsType = Integer.valueOf(params[4]);
|
pointsType = Integer.parseInt(params[4]);
|
||||||
|
|
||||||
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getRank().getId(), parentId);
|
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getRank().getId(), parentId);
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ public class RoomBundleCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class RoomCreditsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(params[1]);
|
amount = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,7 +18,7 @@ public class RoomDanceCommand extends Command {
|
|||||||
int danceId;
|
int danceId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
danceId = Integer.valueOf(params[1]);
|
danceId = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.invalid_dance"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.invalid_dance"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,7 @@ public class RoomEffectCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int effectId = Integer.valueOf(params[1]);
|
int effectId = Integer.parseInt(params[1]);
|
||||||
|
|
||||||
if (effectId >= 0) {
|
if (effectId >= 0) {
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
@ -27,11 +27,10 @@ public class RoomEffectCommand extends Command {
|
|||||||
room.giveEffect(habbo, effectId, -1);
|
room.giveEffect(habbo, effectId, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.positive"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.positive"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.numbers_only"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.numbers_only"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ public class RoomGiftCommand extends Command {
|
|||||||
int itemId;
|
int itemId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
itemId = Integer.valueOf(params[1]);
|
itemId = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,7 +17,7 @@ public class RoomItemCommand extends Command {
|
|||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
try {
|
try {
|
||||||
itemId = Integer.valueOf(params[1]);
|
itemId = Integer.parseInt(params[1]);
|
||||||
|
|
||||||
if (itemId < 0) {
|
if (itemId < 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomitem.positive"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomitem.positive"), RoomChatMessageBubbles.ALERT);
|
||||||
@ -36,10 +36,9 @@ public class RoomItemCommand extends Command {
|
|||||||
|
|
||||||
if (itemId > 0) {
|
if (itemId > 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.given").replace("%item%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.given").replace("%item%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.removed"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.removed"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public class RoomPixelsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(params[1]);
|
amount = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -18,7 +18,7 @@ public class RoomPointsCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
amountString = params[1];
|
amountString = params[1];
|
||||||
|
|
||||||
type = Integer.valueOf(params[2]);
|
type = Integer.parseInt(params[2]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
@ -46,7 +46,7 @@ public class RoomPointsCommand extends Command {
|
|||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
amount = Integer.valueOf(amountString);
|
amount = Integer.parseInt(amountString);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,7 +14,7 @@ public class SetMaxCommand extends Command {
|
|||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
int max;
|
int max;
|
||||||
try {
|
try {
|
||||||
max = Integer.valueOf(params[1]);
|
max = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -22,11 +22,10 @@ public class SetMaxCommand extends Command {
|
|||||||
if (max > 0 && max < 9999) {
|
if (max > 0 && max < 9999) {
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setUsersMax(max);
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setUsersMax(max);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_setmax").replace("%value%", max + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_setmax").replace("%value%", max + ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user