diff --git a/README.md b/README.md
index 5fac8b63..7d0a6ec0 100644
--- a/README.md
+++ b/README.md
@@ -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)
## 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) *
diff --git a/pom.xml b/pom.xml
index bdc3afb9..d55e42fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,8 +34,8 @@
maven-compiler-plugin
3.8.1
-
- 1.8
+
+ 18
@@ -92,21 +92,21 @@
io.netty
netty-all
- 4.1.49.Final
+ 4.1.86.Final
com.google.code.gson
gson
- 2.8.6
+ 2.8.9
mysql
mysql-connector-java
- 8.0.22
+ 8.0.28
runtime
@@ -143,14 +143,14 @@
org.jsoup
jsoup
- 1.13.1
+ 1.15.3
compile
ch.qos.logback
logback-classic
- 1.2.3
+ 1.2.9
compile
@@ -165,5 +165,12 @@
joda-time
2.10.6
+
+
+ org.projectlombok
+ lombok
+ 1.18.24
+ provided
+
\ No newline at end of file
diff --git a/sqlupdates/Update 3_5_0 to 3_5_2.sql b/sqlupdates/Update 3_5_0 to 3_5_2.sql
new file mode 100644
index 00000000..4a5d607b
--- /dev/null
+++ b/sqlupdates/Update 3_5_0 to 3_5_2.sql
@@ -0,0 +1,2 @@
+-- Trade Currency Setting
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('redeem.currency.trade', '1');
diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java
index 47e5b507..7e59f956 100644
--- a/src/main/java/com/eu/habbo/Emulator.java
+++ b/src/main/java/com/eu/habbo/Emulator.java
@@ -17,6 +17,7 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.util.imager.badges.BadgeImager;
+import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,6 +30,7 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@Slf4j
public final class Emulator {
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 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 logo =
- "\n" +
- "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
- "████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗\n" +
- "██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
- "██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
- "██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
- "╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n";
+ """
+
+ ███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗\s
+ ████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗
+ ██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝
+ ██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗
+ ██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║
+ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝
+ """;
@@ -64,7 +69,6 @@ public final class Emulator {
private static GameServer gameServer;
private static RCONServer rconServer;
private static CameraClient cameraClient;
- private static Logging logging;
private static Database database;
private static DatabaseLogger databaseLogger;
private static ThreadPooling threading;
@@ -90,7 +94,7 @@ public final class Emulator {
scanner.nextLine();
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
try {
// Check if running on Windows and not in IntelliJ.
// If so, we need to reconfigure the console appender and enable Jansi for colors.
@@ -107,7 +111,6 @@ public final class Emulator {
setBuild();
Emulator.stopped = false;
ConsoleCommand.load();
- Emulator.logging = new Logging();
System.out.println(logo);
@@ -116,11 +119,11 @@ public final class Emulator {
System.out.println();
promptEnterKey();
}
- LOGGER.info("eek. Has it really been a year?");
- LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
- LOGGER.info("Version: {}", version);
- LOGGER.info("Build: {}", build);
- LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
+ log.info("eek. Has it really been a year?");
+ log.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
+ log.info("Version: {}", version);
+ log.info("Build: {}", build);
+ log.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
long startTime = System.nanoTime();
@@ -153,16 +156,16 @@ public final class Emulator {
Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager();
- LOGGER.info("Arcturus Morningstar has successfully loaded.");
- LOGGER.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
- LOGGER.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
+ log.info("Arcturus Morningstar has successfully loaded.");
+ log.info("System launched in: {}ms. Using {} threads!", (System.nanoTime() - startTime) / 1e6, Runtime.getRuntime().availableProcessors() * 2);
+ log.info("Memory: {}/{}MB", (runtime.totalMemory() - runtime.freeMemory()) / (1024 * 1024), (runtime.freeMemory()) / (1024 * 1024));
Emulator.debugging = Emulator.getConfig().getBoolean("debug.mode");
if (debugging) {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.DEBUG);
- LOGGER.debug("Debugging enabled.");
+ log.debug("Debugging enabled.");
}
Emulator.getPluginManager().fireEvent(new EmulatorLoadedEvent());
@@ -170,7 +173,7 @@ public final class Emulator {
Emulator.timeStarted = getIntUnixTimestamp();
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"),
Runtime.getRuntime().availableProcessors() * 2);
}
@@ -193,7 +196,7 @@ public final class Emulator {
System.out.println("Waiting for command: ");
} catch (Exception e) {
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.isReady = false;
- LOGGER.info("Stopping Arcturus Morningstar {}", version);
+ log.info("Stopping Arcturus Morningstar {}", version);
try {
if (Emulator.getPluginManager() != null)
@@ -285,7 +288,7 @@ public final class Emulator {
} catch (Exception ignored) {
}
- LOGGER.info("Stopped Arcturus Morningstar {}", version);
+ log.info("Stopped Arcturus Morningstar {}", version);
if (Emulator.database != null) {
Emulator.getDatabase().dispose();
@@ -332,13 +335,6 @@ public final class Emulator {
return rconServer;
}
- /**
- * @deprecated Do not use. Please use LoggerFactory.getLogger(YourClass.class) to log.
- */
- @Deprecated
- public static Logging getLogging() {
- return logging;
- }
public static ThreadPooling getThreading() {
return threading;
@@ -384,7 +380,7 @@ public final class Emulator {
int totalSeconds = 0;
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
- Map map = new HashMap();
+ Map map = new HashMap<>();
map.put("second", 1);
map.put("minute", 60);
map.put("hour", 3600);
@@ -406,13 +402,12 @@ public final class Emulator {
}
public static Date modifyDate(Date date, String timeString) {
- int totalSeconds = 0;
Calendar c = Calendar.getInstance();
c.setTime(date);
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
- Map map = new HashMap();
+ Map map = new HashMap<>();
map.put("second", Calendar.SECOND);
map.put("minute", Calendar.MINUTE);
map.put("hour", Calendar.HOUR);
@@ -437,7 +432,7 @@ public final class Emulator {
String res = "";
Date aux = stringToDate("1970-01-01 00:00:00");
if(aux == null) return null;
-
+
Timestamp aux1 = dateToTimeStamp(aux);
Timestamp aux2 = dateToTimeStamp(date);
long difference = aux2.getTime() - aux1.getTime();
@@ -451,7 +446,7 @@ public final class Emulator {
try {
res = format.parse(date);
} catch (Exception e) {
- LOGGER.error("Error parsing date", e);
+ log.error("Error parsing date", e);
}
return res;
}
diff --git a/src/main/java/com/eu/habbo/core/CleanerThread.java b/src/main/java/com/eu/habbo/core/CleanerThread.java
index 4d2a87a5..7897ddbe 100644
--- a/src/main/java/com/eu/habbo/core/CleanerThread.java
+++ b/src/main/java/com/eu/habbo/core/CleanerThread.java
@@ -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.outgoing.users.UserObjectComposer;
import com.eu.habbo.threading.runnables.AchievementUpdater;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -16,10 +15,9 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;
+@Slf4j
public class CleanerThread implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(CleanerThread.class);
-
private static final int DELAY = 10000;
private static final int RELOAD_HALL_OF_FAME = 1800;
private static final int RELOAD_NEWS_LIST = 3600;
@@ -128,10 +126,10 @@ public class CleanerThread implements Runnable {
statement.execute("DELETE FROM users_effects WHERE total <= 0");
}
} 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() {
@@ -140,13 +138,13 @@ public class CleanerThread implements Runnable {
statement.setInt(2, Emulator.getConfig().getInt("hotel.daily.respect.pets"));
statement.executeUpdate();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
if (Emulator.isReady) {
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
- habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
- habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
+ habbo.getHabboStats().setRespectPointsToGive(Emulator.getConfig().getInt("hotel.daily.respect"));
+ habbo.getHabboStats().setPetRespectPointsToGive(Emulator.getConfig().getInt("hotel.daily.respect.pets"));
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
}
}
@@ -162,7 +160,7 @@ public class CleanerThread implements Runnable {
habbo.clearCaches();
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/CommandLog.java b/src/main/java/com/eu/habbo/core/CommandLog.java
index 1dfb2847..41040efa 100644
--- a/src/main/java/com/eu/habbo/core/CommandLog.java
+++ b/src/main/java/com/eu/habbo/core/CommandLog.java
@@ -2,10 +2,12 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.Command;
+import lombok.AllArgsConstructor;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+@AllArgsConstructor
public class CommandLog implements DatabaseLoggable {
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 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
public String getQuery() {
return CommandLog.INSERT_QUERY;
diff --git a/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/src/main/java/com/eu/habbo/core/ConfigurationManager.java
index 19b442fe..85b5a00f 100644
--- a/src/main/java/com/eu/habbo/core/ConfigurationManager.java
+++ b/src/main/java/com/eu/habbo/core/ConfigurationManager.java
@@ -3,21 +3,18 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
import java.sql.*;
import java.util.Map;
import java.util.Properties;
+@Slf4j
public class ConfigurationManager {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationManager.class);
-
private final Properties properties;
private final String configurationPath;
public boolean loaded = false;
@@ -47,11 +44,11 @@ public class ConfigurationManager {
if (!useEnvVarsForDbConnection) {
try {
File f = new File(this.configurationPath);
- input = new FileInputStream(f);
+ input = Files.newInputStream(f.toPath());
this.properties.load(input);
} catch (IOException ex) {
- LOGGER.error("Failed to load config file.", ex);
+ log.error("Failed to load config file.", ex);
ex.printStackTrace();
} finally {
if (input != null) {
@@ -92,7 +89,7 @@ public class ConfigurationManager {
String envValue = System.getenv(entry.getValue());
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 {
this.properties.setProperty(entry.getKey(), envValue);
}
@@ -104,7 +101,7 @@ public class ConfigurationManager {
}
this.isLoading = false;
- LOGGER.info("Configuration Manager -> Loaded!");
+ log.info("Configuration Manager -> Loaded!");
if (Emulator.getPluginManager() != null) {
Emulator.getPluginManager().fireEvent(new EmulatorConfigUpdatedEvent());
@@ -112,7 +109,7 @@ public class ConfigurationManager {
}
public void loadFromDatabase() {
- LOGGER.info("Loading configuration from database...");
+ log.info("Loading configuration from database...");
long millis = System.currentTimeMillis();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); Statement statement = connection.createStatement()) {
@@ -124,10 +121,10 @@ public class ConfigurationManager {
}
}
} 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() {
@@ -138,7 +135,7 @@ public class ConfigurationManager {
statement.executeUpdate();
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -153,7 +150,7 @@ public class ConfigurationManager {
return defaultValue;
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);
}
@@ -169,7 +166,7 @@ public class ConfigurationManager {
try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} 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;
}
@@ -185,15 +182,11 @@ public class ConfigurationManager {
try {
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} 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;
}
- public double getDouble(String key) {
- return this.getDouble(key, 0.0);
- }
-
public double getDouble(String key, Double defaultValue) {
if (this.isLoading)
return defaultValue;
@@ -201,7 +194,7 @@ public class ConfigurationManager {
try {
return Double.parseDouble(this.getValue(key, defaultValue.toString()));
} 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;
@@ -220,7 +213,7 @@ public class ConfigurationManager {
statement.setString(2, value);
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
this.update(key, value);
diff --git a/src/main/java/com/eu/habbo/core/CreditsScheduler.java b/src/main/java/com/eu/habbo/core/CreditsScheduler.java
index db5e74fb..2fe24faa 100644
--- a/src/main/java/com/eu/habbo/core/CreditsScheduler.java
+++ b/src/main/java/com/eu/habbo/core/CreditsScheduler.java
@@ -2,14 +2,13 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.Map;
+@Slf4j
public class CreditsScheduler extends Scheduler {
- private static final Logger LOGGER = LoggerFactory.getLogger(CreditsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
@@ -52,10 +51,10 @@ public class CreditsScheduler extends Scheduler {
if (habbo.getRoomUnit().isIdle() && IGNORE_IDLED)
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) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/CryptoConfig.java b/src/main/java/com/eu/habbo/core/CryptoConfig.java
index 28fbe7cd..24c73acd 100644
--- a/src/main/java/com/eu/habbo/core/CryptoConfig.java
+++ b/src/main/java/com/eu/habbo/core/CryptoConfig.java
@@ -1,5 +1,10 @@
package com.eu.habbo.core;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor
public class CryptoConfig {
private final boolean enabled;
@@ -7,27 +12,4 @@ public class CryptoConfig {
private final String modulus;
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;
- }
-
}
diff --git a/src/main/java/com/eu/habbo/core/DatabaseLogger.java b/src/main/java/com/eu/habbo/core/DatabaseLogger.java
index 2f8806a9..81b1cbe0 100644
--- a/src/main/java/com/eu/habbo/core/DatabaseLogger.java
+++ b/src/main/java/com/eu/habbo/core/DatabaseLogger.java
@@ -1,18 +1,15 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.ConcurrentLinkedQueue;
+@Slf4j
public class DatabaseLogger {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseLogger.class);
-
private final ConcurrentLinkedQueue loggables = new ConcurrentLinkedQueue<>();
public void store(DatabaseLoggable loggable) {
@@ -39,7 +36,7 @@ public class DatabaseLogger {
}
} catch (SQLException e) {
- LOGGER.error("Exception caught while saving loggables to database.", e);
+ log.error("Exception caught while saving loggables to database.", e);
}
}
diff --git a/src/main/java/com/eu/habbo/core/ErrorLog.java b/src/main/java/com/eu/habbo/core/ErrorLog.java
index f0d62072..aa2a5c6a 100644
--- a/src/main/java/com/eu/habbo/core/ErrorLog.java
+++ b/src/main/java/com/eu/habbo/core/ErrorLog.java
@@ -1,8 +1,7 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.io.PrintWriter;
@@ -10,9 +9,9 @@ import java.io.StringWriter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+@Slf4j
public class ErrorLog implements DatabaseLoggable {
- private static final Logger LOGGER = LoggerFactory.getLogger(ErrorLog.class);
private static final String QUERY = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
public final String version;
@@ -38,7 +37,7 @@ public class ErrorLog implements DatabaseLoggable {
pw.close();
sw.close();
} catch (IOException e1) {
- LOGGER.error("Exception caught", e1);
+ log.error("Exception caught", e1);
}
}
diff --git a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
index 58350a95..8a816274 100644
--- a/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
+++ b/src/main/java/com/eu/habbo/core/GotwPointsScheduler.java
@@ -2,15 +2,12 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.Map;
+@Slf4j
public class GotwPointsScheduler extends Scheduler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(GotwPointsScheduler.class);
-
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static String GOTW_POINTS_NAME;
@@ -68,7 +65,7 @@ public class GotwPointsScheduler extends Scheduler {
}
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/Logging.java b/src/main/java/com/eu/habbo/core/Logging.java
deleted file mode 100644
index b1384a42..00000000
--- a/src/main/java/com/eu/habbo/core/Logging.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/src/main/java/com/eu/habbo/core/PixelScheduler.java b/src/main/java/com/eu/habbo/core/PixelScheduler.java
index 2b0bddd5..993ac885 100644
--- a/src/main/java/com/eu/habbo/core/PixelScheduler.java
+++ b/src/main/java/com/eu/habbo/core/PixelScheduler.java
@@ -2,15 +2,12 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.Map;
+@Slf4j
public class PixelScheduler extends Scheduler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PixelScheduler.class);
-
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
public static double HC_MODIFIER;
@@ -52,7 +49,7 @@ public class PixelScheduler extends Scheduler {
habbo.givePixels((int)(habbo.getHabboInfo().getRank().getPixelsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/PointsScheduler.java b/src/main/java/com/eu/habbo/core/PointsScheduler.java
index ca863cb8..8f74569d 100644
--- a/src/main/java/com/eu/habbo/core/PointsScheduler.java
+++ b/src/main/java/com/eu/habbo/core/PointsScheduler.java
@@ -2,14 +2,13 @@ package com.eu.habbo.core;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.Map;
+@Slf4j
public class PointsScheduler extends Scheduler {
- private static final Logger LOGGER = LoggerFactory.getLogger(PointsScheduler.class);
public static boolean IGNORE_HOTEL_VIEW;
public static boolean IGNORE_IDLED;
@@ -55,7 +54,7 @@ public class PointsScheduler extends Scheduler {
habbo.givePoints((int)(habbo.getHabboInfo().getRank().getDiamondsTimerAmount() * (habbo.getHabboStats().hasActiveClub() ? HC_MODIFIER : 1.0)));
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java b/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java
index 40eaff54..515334d5 100644
--- a/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java
+++ b/src/main/java/com/eu/habbo/core/RoomUserPetComposer.java
@@ -4,19 +4,15 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
+import lombok.AllArgsConstructor;
+@AllArgsConstructor
public class RoomUserPetComposer extends MessageComposer {
private final int petType;
private final int race;
private final String color;
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
protected ServerMessage composeInternal() {
diff --git a/src/main/java/com/eu/habbo/core/TextsManager.java b/src/main/java/com/eu/habbo/core/TextsManager.java
index 523740db..7981678f 100644
--- a/src/main/java/com/eu/habbo/core/TextsManager.java
+++ b/src/main/java/com/eu/habbo/core/TextsManager.java
@@ -1,16 +1,13 @@
package com.eu.habbo.core;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.Properties;
+@Slf4j
public class TextsManager {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(TextsManager.class);
-
private final Properties texts;
public TextsManager() {
@@ -21,9 +18,9 @@ public class TextsManager {
try {
this.reload();
- LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ log.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -37,7 +34,7 @@ public class TextsManager {
}
}
} 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) {
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);
}
@@ -60,7 +57,7 @@ public class TextsManager {
try {
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return defaultValue;
}
@@ -73,7 +70,7 @@ public class TextsManager {
try {
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (NumberFormatException e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return defaultValue;
}
@@ -91,7 +88,7 @@ public class TextsManager {
statement.setString(2, value);
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
this.update(key, value);
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
index ea103623..96cb775d 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java
@@ -1,11 +1,10 @@
package com.eu.habbo.core.consolecommands;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public abstract class ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleCommand.class);
private static final THashMap commands = new THashMap<>();
public final String key;
@@ -45,14 +44,14 @@ public abstract class ConsoleCommand {
command.handle(message);
return true;
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
} else {
- LOGGER.info("Unknown Console Command " + message[0]);
- LOGGER.info("Commands Available (" + commands.size() + "): ");
+ log.info("Unknown Console Command " + message[0]);
+ log.info("Commands Available (" + commands.size() + "): ");
for (ConsoleCommand c : commands.values()) {
- LOGGER.info(c.key + " - " + c.usage);
+ log.info(c.key + " - " + c.usage);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
index db7c22bf..211e8f82 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java
@@ -2,13 +2,12 @@ package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.TimeUnit;
+@Slf4j
public class ConsoleInfoCommand extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleInfoCommand.class);
public ConsoleInfoCommand() {
super("info", "Show current statistics.");
@@ -22,21 +21,21 @@ public class ConsoleInfoCommand extends ConsoleCommand {
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
- LOGGER.info("Emulator version: " + Emulator.version);
- LOGGER.info("Emulator build: " + Emulator.build);
+ log.info("Emulator version: " + Emulator.version);
+ log.info("Emulator build: " + Emulator.build);
- LOGGER.info("");
+ log.info("");
- LOGGER.info("Hotel Statistics");
- LOGGER.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
- LOGGER.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
- LOGGER.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
- LOGGER.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
- LOGGER.info("");
- LOGGER.info("Server Statistics");
- LOGGER.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
- LOGGER.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
- LOGGER.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
- LOGGER.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
+ log.info("Hotel Statistics");
+ log.info("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
+ log.info("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
+ log.info("- Shop: " + Emulator.getGameEnvironment().getCatalogManager().catalogPages.size() + " pages and " + CatalogManager.catalogItemAmount + " items.");
+ log.info("- Furni: " + Emulator.getGameEnvironment().getItemManager().getItems().size() + " items.");
+ log.info("");
+ log.info("Server Statistics");
+ log.info("- Uptime: " + day + (day > 1 ? " days, " : " day, ") + hours + (hours > 1 ? " hours, " : " hour, ") + minute + (minute > 1 ? " minutes, " : " minute, ") + second + (second > 1 ? " seconds!" : " second!"));
+ log.info("- RAM Usage: " + (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "/" + (Emulator.getRuntime().freeMemory()) / (1024 * 1024) + "MB");
+ log.info("- CPU Cores: " + Emulator.getRuntime().availableProcessors());
+ log.info("- Total Memory: " + Emulator.getRuntime().maxMemory() / (1024 * 1024) + "MB");
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
index 587130d1..f1c31a95 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java
@@ -1,11 +1,10 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.networking.camera.CameraClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class ConsoleReconnectCameraCommand extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleReconnectCameraCommand.class);
public ConsoleReconnectCameraCommand() {
super("camera", "Attempt to reconnect to the camera server.");
@@ -13,7 +12,7 @@ public class ConsoleReconnectCameraCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
- LOGGER.info("Connecting to the camera...");
+ log.info("Connecting to the camera...");
CameraClient.attemptReconnect = true;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
index cd02b90c..374109c4 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java
@@ -3,11 +3,10 @@ package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class ConsoleTestCommand extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleTestCommand.class);
public ConsoleTestCommand() {
super("test", "This is just a test.");
@@ -16,7 +15,7 @@ public class ConsoleTestCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
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);
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
index e8487a92..14400e12 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java
@@ -1,11 +1,10 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class ShowInteractionsCommand extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ShowInteractionsCommand.class);
public ShowInteractionsCommand() {
super("interactions", "Show a list of available furniture interactions.");
@@ -14,7 +13,7 @@ public class ShowInteractionsCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) {
- LOGGER.info(interaction);
+ log.info(interaction);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
index 821d2f1f..4da7f13f 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowRCONCommands.java
@@ -1,11 +1,10 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class ShowRCONCommands extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ShowRCONCommands.class);
public ShowRCONCommands() {
super("rconcommands", "Show a list of all RCON commands");
@@ -14,7 +13,7 @@ public class ShowRCONCommands extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
for (String command : Emulator.getRconServer().getCommands()) {
- LOGGER.info(command);
+ log.info(command);
}
}
}
diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
index 64378af5..761cae5b 100644
--- a/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
+++ b/src/main/java/com/eu/habbo/core/consolecommands/ThankyouArcturusCommand.java
@@ -1,11 +1,10 @@
package com.eu.habbo.core.consolecommands;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class ThankyouArcturusCommand extends ConsoleCommand {
- private static final Logger LOGGER = LoggerFactory.getLogger(ThankyouArcturusCommand.class);
public ThankyouArcturusCommand() {
super("thankyou", "A thankyou message.");
@@ -13,31 +12,31 @@ public class ThankyouArcturusCommand extends ConsoleCommand {
@Override
public void handle(String[] args) throws Exception {
- LOGGER.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
- LOGGER.info("Thankyou to the following people who have helped with it's development:");
- LOGGER.info("TheGeneral - For Creating Arcturus.");
- LOGGER.info("Capheus - Decompilation");
- LOGGER.info("Beny - Lead Developer");
- LOGGER.info("Alejandro - Lead Developer");
- LOGGER.info("Harmonic - Developer");
- LOGGER.info("ArpyAge - Developer");
- LOGGER.info("Mike - Developer");
- LOGGER.info("Skeletor - Developer");
- LOGGER.info("zGrav - Developer");
- LOGGER.info("Swirny - Developer");
- LOGGER.info("Quadral - Developer");
- LOGGER.info("Dome - Developer");
- LOGGER.info("Necmi - Developer");
- LOGGER.info("Oliver - Support");
- LOGGER.info("Rasmus - Support");
- LOGGER.info("Layne - Support");
- LOGGER.info("Bill - Support");
- LOGGER.info("Harmony - Support");
- LOGGER.info("Ridge - Catalogue");
- LOGGER.info("Tenshie - Catalogue");
- LOGGER.info("Wulles - Catalogue");
- LOGGER.info("Gizmo - Catalogue");
- LOGGER.info("TheJava - Motivation");
- LOGGER.info("The Entire Krews.org Community.");
+ log.info("Arcturus Morningstar is an opensource community fork of Arcturus Emulator by TheGeneral");
+ log.info("Thankyou to the following people who have helped with it's development:");
+ log.info("TheGeneral - For Creating Arcturus.");
+ log.info("Capheus - Decompilation");
+ log.info("Beny - Lead Developer");
+ log.info("Alejandro - Lead Developer");
+ log.info("Harmonic - Developer");
+ log.info("ArpyAge - Developer");
+ log.info("Mike - Developer");
+ log.info("Skeletor - Developer");
+ log.info("zGrav - Developer");
+ log.info("Swirny - Developer");
+ log.info("Quadral - Developer");
+ log.info("Dome - Developer");
+ log.info("Necmi - Developer");
+ log.info("Oliver - Support");
+ log.info("Rasmus - Support");
+ log.info("Layne - Support");
+ log.info("Bill - Support");
+ log.info("Harmony - Support");
+ log.info("Ridge - Catalogue");
+ log.info("Tenshie - Catalogue");
+ log.info("Wulles - Catalogue");
+ log.info("Gizmo - Catalogue");
+ log.info("TheJava - Motivation");
+ log.info("The Entire Krews.org Community.");
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java
index f9db196d..50790239 100644
--- a/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java
+++ b/src/main/java/com/eu/habbo/crypto/HabboDiffieHellman.java
@@ -83,7 +83,7 @@ public class HabboDiffieHellman {
this.DHPrime = decryptBigInteger(signedPrime);
this.DHGenerator = decryptBigInteger(signedGenerator);
- if (this.DHPrime == null || this.DHGenerator == null) {
+ if (this.DHPrime == null) {
throw new HabboCryptoException("DHPrime or DHGenerator was null.");
}
diff --git a/src/main/java/com/eu/habbo/database/Database.java b/src/main/java/com/eu/habbo/database/Database.java
index 00be0fee..f6067ade 100644
--- a/src/main/java/com/eu/habbo/database/Database.java
+++ b/src/main/java/com/eu/habbo/database/Database.java
@@ -5,8 +5,7 @@ import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariDataSource;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -15,10 +14,8 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@Slf4j
public class Database {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(Database.class);
-
private HikariDataSource dataSource;
private DatabasePool databasePool;
@@ -30,21 +27,21 @@ public class Database {
try {
this.databasePool = new DatabasePool();
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;
return;
}
this.dataSource = this.databasePool.getDatabase();
} catch (Exception e) {
SQLException = true;
- LOGGER.error("Failed to connect to your database.", e);
+ log.error("Failed to connect to your database.", e);
} finally {
if (SQLException) {
Emulator.prepareShutdown();
}
}
- LOGGER.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
+ log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
}
public void dispose() {
@@ -64,7 +61,7 @@ public class Database {
}
public static PreparedStatement preparedStatementWithParams(Connection connection, String query, THashMap queryParams) throws SQLException {
- THashMap params = new THashMap();
+ THashMap params = new THashMap<>();
THashSet quotedParams = new THashSet<>();
for(String key : queryParams.keySet()) {
diff --git a/src/main/java/com/eu/habbo/database/DatabasePool.java b/src/main/java/com/eu/habbo/database/DatabasePool.java
index 9a33ba29..399134d1 100644
--- a/src/main/java/com/eu/habbo/database/DatabasePool.java
+++ b/src/main/java/com/eu/habbo/database/DatabasePool.java
@@ -3,11 +3,8 @@ package com.eu.habbo.database;
import com.eu.habbo.core.ConfigurationManager;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
class DatabasePool {
- private final Logger log = LoggerFactory.getLogger(DatabasePool.class);
private HikariDataSource database;
public boolean getStoragePooling(ConfigurationManager config) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
index ba201e53..f79bbf98 100644
--- a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
+++ b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
@@ -1,7 +1,10 @@
package com.eu.habbo.habbohotel;
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.bots.BotManager;
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.subscriptions.SubscriptionManager;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionScheduler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
+@Getter
public class GameEnvironment {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(GameEnvironment.class);
-
- public CreditsScheduler creditsScheduler;
- public PixelScheduler pixelScheduler;
- public PointsScheduler pointsScheduler;
- public GotwPointsScheduler gotwPointsScheduler;
- public SubscriptionScheduler subscriptionScheduler;
+ private CreditsScheduler creditsScheduler;
+ private PixelScheduler pixelScheduler;
+ private PointsScheduler pointsScheduler;
+ private GotwPointsScheduler gotwPointsScheduler;
+ private SubscriptionScheduler subscriptionScheduler;
private HabboManager habboManager;
private NavigatorManager navigatorManager;
@@ -58,7 +60,7 @@ public class GameEnvironment {
private CalendarManager calendarManager;
public void load() throws Exception {
- LOGGER.info("GameEnvironment -> Loading...");
+ log.info("GameEnvironment -> Loading...");
this.permissionsManager = new PermissionsManager();
this.habboManager = new HabboManager();
@@ -100,7 +102,7 @@ public class GameEnvironment {
this.subscriptionScheduler = new SubscriptionScheduler();
Emulator.getThreading().run(this.subscriptionScheduler);
- LOGGER.info("GameEnvironment -> Loaded!");
+ log.info("GameEnvironment -> Loaded!");
}
public void dispose() {
@@ -118,98 +120,7 @@ public class GameEnvironment {
this.hotelViewManager.dispose();
this.subscriptionManager.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; }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/Achievement.java b/src/main/java/com/eu/habbo/habbohotel/achievements/Achievement.java
index dcf34c16..1e16f29b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/achievements/Achievement.java
+++ b/src/main/java/com/eu/habbo/habbohotel/achievements/Achievement.java
@@ -32,7 +32,7 @@ public class Achievement {
public void addLevel(AchievementLevel level) {
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;
if (progress > 0) {
for (AchievementLevel level : this.levels.values()) {
- if (progress >= level.progress) {
+ if (progress >= level.getProgress()) {
if (l != null) {
- if (l.level > level.level) {
+ if (l.getLevel() > level.getLevel()) {
continue;
}
}
@@ -60,7 +60,7 @@ public class Achievement {
AchievementLevel l = null;
for (AchievementLevel level : this.levels.values()) {
- if (level.level == (currentLevel + 1))
+ if (level.getLevel() == (currentLevel + 1))
return level;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementLevel.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementLevel.java
index 28868aa7..53213677 100644
--- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementLevel.java
+++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementLevel.java
@@ -1,23 +1,20 @@
package com.eu.habbo.habbohotel.achievements;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
+@Getter
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;
-
-
- public final int rewardType;
-
-
- public final int points;
-
-
- public final int progress;
+ private final int progress;
public AchievementLevel(ResultSet set) throws SQLException {
this.level = set.getInt("level");
diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
index 75a0ca63..001585cc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
@@ -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.AchievementUnlockedComposer;
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.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer;
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
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 gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectIntProcedure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.LinkedHashMap;
import java.util.Map;
+@Slf4j
public class AchievementManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(AchievementManager.class);
-
public static boolean TALENTTRACK_ENABLED = false;
private final THashMap achievements;
@@ -59,7 +57,7 @@ public class AchievementManager {
statement.setInt(4, amount);
statement.execute();
} 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);
- 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;
habbo.getHabboStats().setProgress(achievement, currentProgress + amount);
@@ -109,7 +107,7 @@ public class AchievementManager {
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type)) {
for (Map.Entry entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet()) {
if (entry.getValue().achievements.containsKey(achievement)) {
- Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
+ Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type);
break;
}
}
@@ -118,7 +116,7 @@ public class AchievementManager {
}
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));
} else {
if (Emulator.getPluginManager().isRegistered(UserAchievementLeveledEvent.class, true)) {
@@ -139,14 +137,14 @@ public class AchievementManager {
if (oldLevel != null) {
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) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
return;
}
}
- String newBadgCode = "ACH_" + achievement.name + newLevel.level;
+ String newBadgCode = "ACH_" + achievement.name + newLevel.getLevel();
if (badge != null) {
badge.setCode(newBadgCode);
@@ -173,10 +171,10 @@ public class AchievementManager {
habbo.getClient().sendResponse(new UnseenItemsComposer(badge.getId(), UnseenItemsComposer.AddHabboItemCategory.BADGE));
- habbo.getHabboStats().addAchievementScore(newLevel.points);
+ habbo.getHabboStats().addAchievementScore(newLevel.getPoints());
- if (newLevel.rewardAmount > 0) {
- habbo.givePoints(newLevel.rewardType, newLevel.rewardAmount);
+ if (newLevel.getRewardAmount() > 0) {
+ habbo.givePoints(newLevel.getRewardType(), newLevel.getRewardAmount());
}
if (habbo.getHabboInfo().getCurrentRoom() != null) {
@@ -197,9 +195,9 @@ public class AchievementManager {
if (level == null)
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) {
@@ -209,7 +207,7 @@ public class AchievementManager {
statement.setInt(3, 1);
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -223,7 +221,7 @@ public class AchievementManager {
}
statement.executeBatch();
} 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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return 0;
@@ -260,9 +258,9 @@ public class AchievementManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL 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) {
- LOGGER.error("Caught SQL exception", e);
- LOGGER.error("Achievement Manager -> Failed to load!");
+ log.error("Caught SQL exception", e);
+ log.error("Achievement Manager -> Failed to load!");
return;
}
}
- LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ log.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
public Achievement getAchievement(String name) {
@@ -343,7 +341,7 @@ public class AchievementManager {
return level;
}
- public void handleTalentTrackAchievement(Habbo habbo, TalentTrackType type, Achievement achievement) {
+ public void handleTalentTrackAchievement(Habbo habbo, TalentTrackType type) {
TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type);
if (currentLevel != null) {
@@ -375,7 +373,8 @@ public class AchievementManager {
if (level.perks != null && level.perks.length > 0) {
for (String perk : level.perks) {
if (perk.equalsIgnoreCase("TRADE")) {
- habbo.getHabboStats().perkTrade = true;
+ habbo.getHabboStats().setPerkTrade(true);
+ break;
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
index e491523f..1a8739ad 100644
--- a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
+++ b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java
@@ -5,15 +5,13 @@ import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class TalentTrackLevel {
- private static final Logger LOGGER = LoggerFactory.getLogger(TalentTrackLevel.class);
-
public TalentTrackType type;
public int level;
public TObjectIntMap achievements;
@@ -34,23 +32,23 @@ public class TalentTrackLevel {
if (achievements[i].isEmpty() || achievementLevels[i].isEmpty())
continue;
- Achievement achievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement(Integer.valueOf(achievements[i]));
+ Achievement achievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement(Integer.parseInt(achievements[i]));
if (achievement != null) {
- this.achievements.put(achievement, Integer.valueOf(achievementLevels[i]));
+ this.achievements.put(achievement, Integer.parseInt(achievementLevels[i]));
} 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(",")) {
- Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(s));
+ Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.parseInt(s));
if (item != null) {
this.items.add(item);
} 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);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
index 5cc1f9ea..fbda5ee7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
+++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
@@ -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.BotWhisperEvent;
import com.eu.habbo.threading.runnables.BotFollowHabbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -22,9 +21,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
+@Slf4j
public class Bot implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(Bot.class);
-
public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}";
public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";");
@@ -164,7 +162,7 @@ public class Bot implements Runnable {
statement.execute();
this.needsUpdate = false;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
index 869dc872..1c9951f4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java
@@ -7,26 +7,22 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboItem;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.BotAddedToInventoryComposer;
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.UserUpdateComposer;
import com.eu.habbo.plugin.events.bots.BotPickUpEvent;
import com.eu.habbo.plugin.events.bots.BotPlacedEvent;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.Map;
-
-
-
+@Slf4j
public class BotManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class);
final private static THashMap> botDefenitions = new THashMap<>();
public static int MINIMUM_CHAT_SPEED = 7;
@@ -44,7 +40,7 @@ public class BotManager {
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 {
@@ -59,10 +55,10 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} 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;
} 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;
}
}
@@ -89,12 +85,12 @@ public class BotManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return bot;
@@ -114,10 +110,10 @@ public class BotManager {
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;
- 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));
return;
}
@@ -144,19 +140,19 @@ public class BotManager {
habbo.getClient().sendResponse(new BotRemovedFromInventoryComposer(bot));
bot.onPlace(habbo, room);
- HabboItem topItem = room.getTopItemAt(location.x, location.y);
+ HabboItem topItem = room.getTopItemAt(location.getX(), location.getY());
if (topItem != null) {
try {
topItem.onWalkOn(bot.getRoomUnit(), room, null);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
bot.cycle(false);
} 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)
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
else
- LOGGER.error("Unknown Bot Type: " + type);
+ log.error("Unknown Bot Type: " + type);
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
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")) {
statement.setInt(1, bot.getId());
- return statement.execute();
+ statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
-
- return false;
}
public void dispose() {
@@ -236,9 +230,9 @@ public class BotManager {
m.setAccessible(true);
m.invoke(null);
} 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) {
- 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());
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
index b5acb9f2..84d979ee 100644
--- a/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
+++ b/src/main/java/com/eu/habbo/habbohotel/bots/ButlerBot.java
@@ -10,8 +10,7 @@ import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.ResultSet;
@@ -22,8 +21,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
+@Slf4j
public class ButlerBot extends Bot {
- private static final Logger LOGGER = LoggerFactory.getLogger(ButlerBot.class);
public static THashMap, Integer> serveItems = new THashMap<>();
public ButlerBot(ResultSet set) throws SQLException {
@@ -48,7 +47,7 @@ public class ButlerBot extends Bot {
serveItems.put(ks, set.getInt("item"));
}
} 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(() -> {
- if(this.getRoom() != null) {
+ if (this.getRoom() != null) {
String botMessage = Emulator.getTexts()
.getValue("bots.butler.given")
.replace("%key%", key)
.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);
}
}
@@ -124,7 +123,7 @@ public class ButlerBot extends Bot {
Emulator.getThreading().run(failedReached.get(0), 1000);
}
} else {
- if(this.getRoom() != null) {
+ if (this.getRoom() != null) {
this.getRoom().giveHandItem(serveEvent.habbo, serveEvent.itemId);
String msg = Emulator.getTexts().getValue("bots.butler.given").replace("%key%", keyword).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername());
diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java b/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java
index bf160161..130ff3b1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java
+++ b/src/main/java/com/eu/habbo/habbohotel/bots/VisitorBot.java
@@ -39,9 +39,9 @@ public class VisitorBot extends Bot {
StringBuilder list = new StringBuilder();
for (ModToolRoomVisit visit : this.visits) {
list.append("\r");
- list.append(visit.roomName).append(" ");
+ list.append(visit.getRoomName()).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());
diff --git a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java
index cf0beded..025db31e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarManager.java
@@ -5,8 +5,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDoorOpenedMessageComposer;
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.time.temporal.ChronoUnit;
@@ -14,8 +13,9 @@ import java.util.Date;
import java.util.*;
+
+@Slf4j
public class CalendarManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(CalendarManager.class);
private static final Map calendarCampaigns = new THashMap<>();
public static double HC_MODIFIER;
@@ -23,7 +23,7 @@ public class CalendarManager {
public CalendarManager() {
long millis = System.currentTimeMillis();
this.reload();
- LOGGER.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
+ log.info("Calendar Manager -> Loaded! ({} MS)", (System.currentTimeMillis() - millis));
}
public void dispose() {
@@ -39,7 +39,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
return false;
}
@@ -53,7 +53,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
return false;
}
@@ -84,7 +84,7 @@ public class CalendarManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
calendarCampaigns.put(campaign.getId(), campaign);
@@ -97,7 +97,7 @@ public class CalendarManager {
statement.setInt(1, campaign.getId());
return statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return false;
@@ -113,7 +113,7 @@ public class CalendarManager {
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);
- 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;
List 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()) {
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));
object.give(habbo);
@@ -137,7 +137,7 @@ public class CalendarManager {
statement.setInt(5, Emulator.getIntUnixTimestamp());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardClaimed.java b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardClaimed.java
index 96f0c0d9..e136d339 100644
--- a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardClaimed.java
+++ b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardClaimed.java
@@ -1,50 +1,26 @@
package com.eu.habbo.habbohotel.campaign;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
+@Getter
+@AllArgsConstructor
public class CalendarRewardClaimed {
- private final int user_id;
- private final int campaign;
+ private final int userId;
+ private final int campaignId;
private final int day;
- private final int reward_id;
+ private final int rewardId;
private final Timestamp timestamp;
public CalendarRewardClaimed(ResultSet set) throws SQLException {
- this.user_id = set.getInt("user_id");
- this.campaign = set.getInt("campaign_id");
+ this.userId = set.getInt("user_id");
+ this.campaignId = set.getInt("campaign_id");
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);
}
-
- 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;
- }
-
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardObject.java b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardObject.java
index 90f92e6b..d8b74fa3 100644
--- a/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardObject.java
+++ b/src/main/java/com/eu/habbo/habbohotel/campaign/CalendarRewardObject.java
@@ -5,17 +5,17 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
+@Getter
public class CalendarRewardObject {
- private static final Logger LOGGER = LoggerFactory.getLogger(CalendarRewardObject.class);
-
private final int id;
private final String productName;
private final String customImage;
@@ -25,8 +25,8 @@ public class CalendarRewardObject {
private final int pointsType;
private final String badge;
private final int itemId;
- private final String subscription_type;
- private final int subscription_days;
+ private final String subscriptionType;
+ private final int subscriptionDays;
public CalendarRewardObject(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -38,8 +38,8 @@ public class CalendarRewardObject {
this.pointsType = set.getInt("points_type");
this.badge = set.getString("badge");
this.itemId = set.getInt("item_id");
- this.subscription_type = set.getString("subscription_type");
- this.subscription_days = set.getInt("subscription_days");
+ this.subscriptionType = set.getString("subscription_type");
+ this.subscriptionDays = set.getInt("subscription_days");
}
public void give(Habbo habbo) {
@@ -48,7 +48,7 @@ public class CalendarRewardObject {
}
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) {
@@ -59,11 +59,11 @@ public class CalendarRewardObject {
habbo.addBadge(this.badge);
}
- if(this.subscription_type != null && !this.subscription_type.isEmpty()) {
- if ("HABBO_CLUB".equals(this.subscription_type)) {
- habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, this.subscription_days * 86400);
+ if (this.subscriptionType != null && !this.subscriptionType.isEmpty()) {
+ if ("HABBO_CLUB".equals(this.subscriptionType)) {
+ habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, this.subscriptionDays * 86400);
} 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() {
return Emulator.getGameEnvironment().getItemManager().getItem(this.itemId);
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogFeaturedPage.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogFeaturedPage.java
index 30da0eb1..916ef68a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogFeaturedPage.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogFeaturedPage.java
@@ -3,7 +3,10 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+@AllArgsConstructor
public class CatalogFeaturedPage implements ISerialize {
private final int slotId;
private final String caption;
@@ -13,16 +16,6 @@ public class CatalogFeaturedPage implements ISerialize {
private final String pageName;
private final int pageId;
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
public void serialize(ServerMessage message) {
@@ -31,28 +24,20 @@ public class CatalogFeaturedPage implements ISerialize {
message.appendString(this.image);
message.appendInt(this.type.type);
switch (this.type) {
- case PAGE_NAME:
- message.appendString(this.pageName);
- break;
- case PAGE_ID:
- message.appendInt(this.pageId);
- break;
- case PRODUCT_NAME:
- message.appendString(this.productName);
- break;
+ case PAGE_NAME -> message.appendString(this.pageName);
+ case PAGE_ID -> message.appendInt(this.pageId);
+ case PRODUCT_NAME -> message.appendString(this.productName);
}
message.appendInt(Emulator.getIntUnixTimestamp() - this.expireTimestamp);
}
+ @Getter
+ @AllArgsConstructor
public enum Type {
PAGE_NAME(0),
PAGE_ID(1),
PRODUCT_NAME(2);
- public final int type;
-
- Type(int type) {
- this.type = type;
- }
+ private final int type;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
index c8d015e6..d2557cf1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
@@ -3,12 +3,12 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.FurnitureType;
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.ServerMessage;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -16,41 +16,54 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
+@Slf4j
public class CatalogItem implements ISerialize, Runnable, Comparable {
- private static final Logger LOGGER = LoggerFactory.getLogger(CatalogItem.class);
+
+ @Getter
int id;
+ @Getter
int limitedStack;
+ @Getter
+ @Setter
private int pageId;
+ @Getter
+ @Setter
private String itemId;
+ @Getter
private String name;
+ @Getter
private int credits;
+ @Getter
private int points;
+ @Getter
private short pointsType;
+ @Getter
private int amount;
private boolean allowGift = false;
private int limitedSells;
-
+ @Getter
private String extradata;
-
+ @Getter
private boolean clubOnly;
private boolean haveOffer;
-
+ @Getter
private int offerId;
private boolean needsUpdate;
-
+ @Getter
private int orderNumber;
-
+ @Getter
private HashMap bundle;
+
public CatalogItem(ResultSet set) throws SQLException {
this.load(set);
this.needsUpdate = false;
@@ -105,49 +118,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0;
- }
-
- private int getOrderNumber() {
- return this.orderNumber;
- }
public synchronized void sellRare() {
this.limitedSells++;
@@ -214,7 +161,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0) {
@@ -236,9 +183,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable getBundle() {
- return this.bundle;
- }
public void loadBundle() {
int intItemId;
@@ -261,17 +205,17 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0;
+ }
+
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogLimitedConfiguration.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogLimitedConfiguration.java
index 1cf3e3ef..18ce8684 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogLimitedConfiguration.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogLimitedConfiguration.java
@@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -13,11 +14,12 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
+@Slf4j
public class CatalogLimitedConfiguration implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(CatalogLimitedConfiguration.class);
-
private final int itemId;
private LinkedBlockingQueue limitedNumbers;
+ @Getter
+ @Setter
private int totalSet;
private final Object lock = new Object();
@@ -61,7 +63,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(5, item.getLimitedSells());
statement.execute();
} 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();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
this.totalSet += amount;
@@ -100,13 +102,6 @@ public class CatalogLimitedConfiguration implements Runnable {
return this.limitedNumbers.size();
}
- public int getTotalSet() {
- return this.totalSet;
- }
-
- public void setTotalSet(int totalSet) {
- this.totalSet = totalSet;
- }
@Override
public void run() {
@@ -116,7 +111,7 @@ public class CatalogLimitedConfiguration implements Runnable {
statement.setInt(3, this.itemId);
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
index b3aaee97..4a0d542e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java
@@ -18,12 +18,12 @@ import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
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.NotificationDialogMessageComposer;
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.PetAddedToInventoryComposer;
+import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer;
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
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.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
+@Slf4j
public class CatalogManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(CatalogManager.class);
-
public static final THashMap> pageDefinitions = new THashMap<>();
public static int catalogItemAmount;
public static int PURCHASE_COOLDOWN = 1;
@@ -86,7 +83,7 @@ public class CatalogManager {
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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
for (Map.Entry> set : limiteds.entrySet()) {
@@ -278,7 +275,7 @@ public class CatalogManager {
Class extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout"));
if (pageClazz == null) {
- LOGGER.info("Unknown Page Layout: " + set.getString("page_layout"));
+ log.info("Unknown Page Layout: " + set.getString("page_layout"));
continue;
}
@@ -286,12 +283,12 @@ public class CatalogManager {
CatalogPage page = pageClazz.getConstructor(ResultSet.class).newInstance(set);
pages.put(page.getId(), page);
} 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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
pages.forEachValue((object) -> {
@@ -303,7 +300,7 @@ public class CatalogManager {
}
} else {
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;
@@ -311,7 +308,7 @@ public class CatalogManager {
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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -379,7 +376,7 @@ public class CatalogManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
for (CatalogPage page : this.catalogPages.valueCollection()) {
@@ -404,7 +401,7 @@ public class CatalogManager {
}
}
} 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) {
- 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));
}
} 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);
} 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) {
- 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")) {
while (set.next()) {
switch (set.getString("type")) {
- case "wrapper":
- this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id"));
- break;
-
- case "gift":
- this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
- break;
+ case "wrapper" -> this.giftWrappers.put(set.getInt("sprite_id"), set.getInt("item_id"));
+ case "gift" -> this.giftFurnis.put(set.getInt("sprite_id"), set.getInt("item_id"));
}
}
} 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));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
public ClothItem getClothing(String name) {
for (ClothItem item : this.clothing.values()) {
- if (item.name.equalsIgnoreCase(name)) {
+ if (item.getName().equalsIgnoreCase(name)) {
return item;
}
}
@@ -517,7 +509,7 @@ public class CatalogManager {
public Voucher getVoucher(String code) {
synchronized (this.vouchers) {
for (Voucher voucher : this.vouchers) {
- if (voucher.code.equals(code)) {
+ if (voucher.getCode().equals(code)) {
return voucher;
}
}
@@ -548,18 +540,18 @@ public class CatalogManager {
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
- if (voucher.points > 0) {
- client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.pointsType, voucher.points);
- client.sendResponse(new HabboActivityPointNotificationMessageComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.pointsType), voucher.points, voucher.pointsType));
+ if (voucher.getPoints() > 0) {
+ client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.getPointsType(), voucher.getPoints());
+ client.sendResponse(new HabboActivityPointNotificationMessageComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.getPointsType()), voucher.getPoints(), voucher.getPointsType()));
}
- if (voucher.credits > 0) {
- client.getHabbo().getHabboInfo().addCredits(voucher.credits);
+ if (voucher.getCredits() > 0) {
+ client.getHabbo().getHabboInfo().addCredits(voucher.getCredits());
client.sendResponse(new CreditBalanceComposer(client.getHabbo()));
}
- if (voucher.catalogItemId > 0) {
- CatalogItem item = this.getCatalogItem(voucher.catalogItemId);
+ if (voucher.getCatalogItemId() > 0) {
+ CatalogItem item = this.getCatalogItem(voucher.getCatalogItemId());
if (item != null) {
this.purchaseItem(null, item, client.getHabbo(), 1, "", true);
}
@@ -570,7 +562,7 @@ public class CatalogManager {
public boolean deleteVoucher(Voucher voucher) {
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) {
this.vouchers.remove(voucher);
@@ -578,7 +570,7 @@ public class CatalogManager {
return statement.executeUpdate() >= 1;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return false;
@@ -609,13 +601,10 @@ public class CatalogManager {
public CatalogItem getCatalogItem(int id) {
final CatalogItem[] item = {null};
synchronized (this.catalogPages) {
- this.catalogPages.forEachValue(new TObjectProcedure() {
- @Override
- public boolean execute(CatalogPage object) {
- item[0] = object.getCatalogItem(id);
+ this.catalogPages.forEachValue(object -> {
+ item[0] = object.getCatalogItem(id);
- return item[0] == null;
- }
+ return item[0] == null;
});
}
@@ -626,24 +615,17 @@ public class CatalogManager {
public List getCatalogPages(int parentId, final Habbo habbo) {
final List pages = new ArrayList<>();
- this.catalogPages.get(parentId).childPages.forEachValue(new TObjectProcedure() {
- @Override
- public boolean execute(CatalogPage object) {
+ this.catalogPages.get(parentId).childPages.forEachValue(object -> {
- boolean isVisiblePage = object.visible;
- boolean hasRightRank = object.getRank() <= habbo.getHabboInfo().getRank().getId();
+ boolean isVisiblePage = object.visible;
+ 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()) {
- clubRightsOkay = false;
- }
-
- if (isVisiblePage && hasRightRank && clubRightsOkay) {
- pages.add(object);
- }
- return true;
+ if (isVisiblePage && hasRightRank && clubRightsOkay) {
+ pages.add(object);
}
+ return true;
});
Collections.sort(pages);
@@ -702,7 +684,7 @@ public class CatalogManager {
if (this.prizes.containsKey(level) && !this.prizes.get(level).isEmpty()) {
return (Item) this.prizes.get(level).toArray()[Emulator.getRandom().nextInt(this.prizes.get(level).size())];
} else {
- LOGGER.error("No rewards specified for rarity level {}", level);
+ log.error("No rewards specified for rarity level {}", level);
}
return null;
@@ -734,10 +716,10 @@ public class CatalogManager {
try {
catalogPage = pageClazz.getConstructor(ResultSet.class).newInstance(page);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
} 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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
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) {
- 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());
return;
}
- habbo.getHabboStats().isPurchasingFurniture = true;
+ habbo.getHabboStats().setPurchasingFurniture(true);
try {
if (item.isClubOnly() && !habbo.getClient().getHabbo().getHabboStats().hasActiveClub()) {
@@ -873,7 +855,7 @@ public class CatalogManager {
if (amount > 1 && !CatalogItem.haveOffer(item)) {
String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption());
ScripterManager.scripterDetected(habbo.getClient(), message);
- LOGGER.info(message);
+ log.info(message);
habbo.getClient().sendResponse(new PurchaseNotAllowedMessageComposer(PurchaseNotAllowedMessageComposer.ILLEGAL));
return;
}
@@ -958,7 +940,7 @@ public class CatalogManager {
try {
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
}
@@ -996,7 +978,7 @@ public class CatalogManager {
if (extradata.length() > Emulator.getConfig().getInt("hotel.trophies.length.max", 300)) {
extradata = extradata.substring(0, Emulator.getConfig().getInt("hotel.trophies.length.max", 300));
}
-
+
extradata = habbo.getClient().getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + Emulator.getGameEnvironment().getWordFilter().filter(extradata.replace(((char) 9) + "", ""), habbo);
}
@@ -1017,7 +999,7 @@ public class CatalogManager {
try {
guildId = Integer.parseInt(extradata);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
return;
}
@@ -1034,7 +1016,7 @@ public class CatalogManager {
itemsList.add(habboItem);
if (baseItem.getName().equals("guild_forum")) {
- guild.setForum(true);
+ guild.setHasForum(true);
guild.needsUpdate = true;
guild.run();
}
@@ -1111,7 +1093,7 @@ public class CatalogManager {
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
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());
}
habbo.getClient().getHabbo().getHabboStats().addPurchase(purchasedEvent.catalogItem);
@@ -1123,11 +1105,11 @@ public class CatalogManager {
THashSet itemIds = new THashSet<>();
- for(HabboItem ix : purchasedEvent.itemsList) {
+ for (HabboItem ix : purchasedEvent.itemsList) {
itemIds.add(ix.getId() + "");
}
- if(!free) {
+ if (!free) {
Emulator.getThreading().run(new CatalogPurchaseLogEntry(
Emulator.getIntUnixTimestamp(),
purchasedEvent.habbo.getHabboInfo().getId(),
@@ -1136,17 +1118,17 @@ public class CatalogManager {
purchasedEvent.catalogItem != null ? purchasedEvent.catalogItem.getName() : "",
purchasedEvent.totalCredits,
purchasedEvent.totalPoints,
- item != null ? item.getPointsType() : 0,
+ item.getPointsType(),
amount
));
}
} catch (Exception e) {
- LOGGER.error("Exception caught", e);
+ log.error("Exception caught", e);
habbo.getClient().sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
}
} finally {
- habbo.getHabboStats().isPurchasingFurniture = false;
+ habbo.getHabboStats().setPurchasingFurniture(false);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
index b161c201..39ec532f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java
@@ -7,38 +7,63 @@ import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+@Slf4j
public abstract class CatalogPage implements Comparable, ISerialize {
- private static final Logger LOGGER = LoggerFactory.getLogger(CatalogPage.class);
+ @Getter
protected final TIntArrayList offerIds = new TIntArrayList();
+ @Getter
protected final THashMap childPages = new THashMap<>();
+ @Getter
private final TIntObjectMap catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
+ @Getter
private final ArrayList included = new ArrayList<>();
+ @Getter
protected int id;
+ @Getter
protected int parentId;
+ @Getter
+ @Setter
protected int rank;
+ @Getter
protected String caption;
+ @Getter
protected String pageName;
+ @Getter
protected int iconColor;
+ @Getter
protected int iconImage;
+ @Getter
protected int orderNum;
+ @Getter
protected boolean visible;
+ @Getter
protected boolean enabled;
+ @Getter
protected boolean clubOnly;
+ @Getter
protected String layout;
+ @Getter
protected String headerImage;
+ @Getter
protected String teaserImage;
+ @Getter
protected String specialImage;
+ @Getter
protected String textOne;
+ @Getter
protected String textTwo;
+ @Getter
protected String textDetails;
+ @Getter
protected String textTeaser;
public CatalogPage() {
@@ -71,99 +96,15 @@ public abstract class CatalogPage implements Comparable, ISerialize
if (!set.getString("includes").isEmpty()) {
for (String id : set.getString("includes").split(";")) {
try {
- this.included.add(Integer.valueOf(id));
+ this.included.add(Integer.parseInt(id));
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
- LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
+ log.error("Caught exception", e);
+ 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) {
this.offerIds.add(offerId);
}
@@ -172,22 +113,10 @@ public abstract class CatalogPage implements Comparable, ISerialize
this.catalogItems.put(item.getId(), item);
}
- public TIntObjectMap getCatalogItems() {
- return this.catalogItems;
- }
-
public CatalogItem getCatalogItem(int id) {
return this.catalogItems.get(id);
}
- public ArrayList getIncluded() {
- return this.included;
- }
-
- public THashMap getChildPages() {
- return this.childPages;
- }
-
public void addChildPage(CatalogPage page) {
this.childPages.put(page.getId(), page);
@@ -196,7 +125,6 @@ public abstract class CatalogPage implements Comparable, ISerialize
}
}
- @SuppressWarnings("NullableProblems")
@Override
public int compareTo(CatalogPage page) {
return this.getOrderNum() - page.getOrderNum();
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPurchaseLogEntry.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPurchaseLogEntry.java
index 5f6febd7..2326c1ce 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPurchaseLogEntry.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPurchaseLogEntry.java
@@ -2,15 +2,16 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.DatabaseLoggable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+@Slf4j
+@AllArgsConstructor
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 final int timestamp;
@@ -23,18 +24,6 @@ public class CatalogPurchaseLogEntry implements Runnable, DatabaseLoggable {
private final int pointsType;
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
public String getQuery() {
return QUERY;
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/ClothItem.java b/src/main/java/com/eu/habbo/habbohotel/catalog/ClothItem.java
index c99f81d4..58104cd6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/ClothItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/ClothItem.java
@@ -1,26 +1,32 @@
package com.eu.habbo.habbohotel.catalog;
+import lombok.Getter;
+import lombok.Setter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClothItem {
- public int id;
-
-
- public String name;
-
-
- public int[] setId;
+ @Setter
+ @Getter
+ private int id;
+ @Getter
+ @Setter
+ private String name;
+ @Getter
+ @Setter
+ private int[] setId;
public ClothItem(ResultSet set) throws SQLException {
- this.id = set.getInt("id");
- this.name = set.getString("name");
+ this.setId(set.getInt("id"));
+ this.setName(set.getString("name"));
String[] parts = set.getString("setid").split(",");
- this.setId = new int[parts.length];
- for (int i = 0; i < this.setId.length; i++) {
- this.setId[i] = Integer.valueOf(parts[i]);
+ this.setSetId(new int[parts.length]);
+ for (int i = 0; i < this.getSetId().length; i++) {
+ this.getSetId()[i] = Integer.parseInt(parts[i]);
}
}
+
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java
index b7654416..8d65844e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
+import lombok.Getter;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -11,27 +12,21 @@ import java.util.TimeZone;
public class ClubOffer implements ISerialize {
+ @Getter
private final int id;
-
-
+ @Getter
private final String name;
-
-
+ @Getter
private final int days;
-
-
+ @Getter
private final int credits;
-
-
+ @Getter
private final int points;
-
-
+ @Getter
private final int pointsType;
-
-
+ @Getter
private final boolean vip;
-
-
+ @Getter
private final boolean deal;
public ClubOffer(ResultSet set) throws SQLException {
@@ -45,38 +40,6 @@ public class ClubOffer implements ISerialize {
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
public void serialize(ServerMessage message) {
serialize(message, Emulator.getIntUnixTimestamp());
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
index 3766c16a..c1f20844 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
@@ -4,6 +4,7 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.ServerMessage;
+import lombok.Getter;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -11,18 +12,31 @@ import java.sql.SQLException;
public class TargetOffer {
public static int ACTIVE_TARGET_OFFER_ID = 0;
+ @Getter
private final int id;
+ @Getter
private final int catalogItem;
+ @Getter
private final String identifier;
+ @Getter
private final int priceInCredits;
+ @Getter
private final int priceInActivityPoints;
+ @Getter
private final int activityPointsType;
+ @Getter
private final int purchaseLimit;
+ @Getter
private final int expirationTime;
+ @Getter
private final String title;
+ @Getter
private final String description;
+ @Getter
private final String imageUrl;
+ @Getter
private final String icon;
+ @Getter
private final String[] vars;
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;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
index 468e2a2b..2a0b2f59 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/Voucher.java
@@ -1,8 +1,8 @@
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -11,17 +11,23 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+@Slf4j
public class Voucher {
- private static final Logger LOGGER = LoggerFactory.getLogger(Voucher.class);
- public final int id;
- public final String code;
- public final int credits;
- public final int points;
- public final int pointsType;
- public final int catalogItemId;
- public final int amount;
- public final int limit;
+
+ private final int id;
+ @Getter
+ private final String code;
+ @Getter
+ private final int credits;
+ @Getter
+ 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 history = new ArrayList<>();
public Voucher(ResultSet set) throws SQLException {
@@ -46,7 +52,7 @@ public class Voucher {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -69,7 +75,8 @@ public class Voucher {
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
+
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/VoucherHistoryEntry.java b/src/main/java/com/eu/habbo/habbohotel/catalog/VoucherHistoryEntry.java
index 300c7c8f..9e69ccc1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/VoucherHistoryEntry.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/VoucherHistoryEntry.java
@@ -1,11 +1,18 @@
package com.eu.habbo.habbohotel.catalog;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
+@AllArgsConstructor
public class VoucherHistoryEntry {
+ @Getter
private final int voucherId;
+ @Getter
private final int userId;
+ @Getter
private final int timestamp;
public VoucherHistoryEntry(ResultSet set) throws SQLException {
@@ -14,21 +21,4 @@ public class VoucherHistoryEntry {
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;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
index d41ebead..de366cad 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java
@@ -8,23 +8,20 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomManager;
import com.eu.habbo.habbohotel.users.Habbo;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.Map;
+@Slf4j
public class RoomBundleLayout extends SingleBundle {
- private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleLayout.class);
-
- public int roomId;
- public Room room;
+ private final int roomId;
+ private Room room;
private int lastUpdate = 0;
private boolean loaded = false;
@@ -48,7 +45,7 @@ public class RoomBundleLayout extends SingleBundle {
if (this.room != null)
this.room.preventUnloading = true;
} 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};
- super.getCatalogItems().forEachValue(new TObjectProcedure() {
- @Override
- public boolean execute(CatalogItem object) {
- if (object == null)
- return true;
+ super.getCatalogItems().forEachValue(object -> {
+ if (object == null)
+ return true;
- item[0] = object;
- return false;
- }
+ item[0] = object;
+ return false;
});
if (this.room.isPreLoaded()) {
@@ -96,7 +90,7 @@ public class RoomBundleLayout extends SingleBundle {
}
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();
@@ -190,7 +184,7 @@ public class RoomBundleLayout extends SingleBundle {
statement.setInt(3, this.room.getId());
statement.execute();
} 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) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
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");
if (habbo != null) {
- habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.PURCHASING_ROOM.key, keys));
+ habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.PURCHASING_ROOM.getKey(), keys));
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
index e4ac30e1..31850d93 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java
@@ -8,16 +8,15 @@ import com.eu.habbo.messages.ServerMessage;
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.MarketplaceCancelOfferResultComposer;
-import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
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.plugin.events.marketplace.MarketPlaceItemCancelledEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemOfferedEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -27,8 +26,8 @@ import java.util.ArrayList;
import java.util.List;
+@Slf4j
public class MarketPlace {
- private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlace.class);
//Configuration. Loaded from database & updated accordingly.
public static boolean MARKETPLACE_ENABLED = true;
@@ -47,7 +46,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return offers;
@@ -105,7 +104,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
habbo.getClient().sendResponse(new MarketplaceCancelOfferResultComposer(offer, false));
}
}
@@ -169,7 +168,7 @@ public class MarketPlace {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return offers;
@@ -199,7 +198,7 @@ public class MarketPlace {
message.appendInt(1);
message.appendInt(itemId);
} 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");
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return number;
@@ -232,7 +231,7 @@ public class MarketPlace {
avg = set.getInt("avg");
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return calculateCommision(avg);
@@ -279,7 +278,7 @@ public class MarketPlace {
client.getHabbo().getInventory().getItemsComponent().addItem(item);
if (MARKETPLACE_CURRENCY == 0) {
- client.getHabbo().getHabboInfo().addCredits(-event.price);
+ client.getHabbo().giveCredits(-event.price);
} else {
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, -event.price);
}
@@ -300,22 +299,23 @@ public class MarketPlace {
}
}
} 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) {
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" +
- "INNER JOIN items_base ON items.item_id = items_base.id\n" +
- "WHERE items_base.sprite_id = ( \n" +
- "SELECT items_base.sprite_id\n" +
- "FROM items_base\n" +
- "WHERE items_base.id = ? LIMIT 1)\n" +
- "ORDER BY price ASC\n" +
- "LIMIT 1", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
+ """
+ FROM marketplace_items
+ INNER JOIN items ON marketplace_items.item_id = items.id
+ INNER JOIN items_base ON items.item_id = items_base.id
+ WHERE items_base.sprite_id = (
+ SELECT items_base.sprite_id
+ FROM items_base
+ WHERE items_base.id = ? LIMIT 1)
+ ORDER BY price ASC
+ LIMIT 1""", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) {
statement.setInt(1, baseItemId);
try (ResultSet countSet = statement.executeQuery()) {
countSet.last();
@@ -327,7 +327,7 @@ public class MarketPlace {
}
}
} 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);
credits += offer.getPrice();
removeUser(offer);
- offer.needsUpdate(true);
+ offer.setNeedsUpdate(true);
Emulator.getThreading().run(offer);
}
}
@@ -381,7 +381,7 @@ public class MarketPlace {
offers.clear();
if (MARKETPLACE_CURRENCY == 0) {
- client.getHabbo().getHabboInfo().addCredits(credits);
+ client.getHabbo().giveCredits(credits);
} else {
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, credits);
}
@@ -394,7 +394,7 @@ public class MarketPlace {
statement.setInt(2, offer.getOfferId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
index 196544e7..cada0040 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceOffer.java
@@ -5,25 +5,38 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
+@Slf4j
public class MarketPlaceOffer implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(MarketPlaceOffer.class);
-
- public int avarage;
+ public int average;
public int count;
+ @Getter
+ @Setter
private int offerId;
- private Item baseItem;
- private int itemId;
+ private final Item baseItem;
+
+ private final int itemId;
+
+ @Getter
private int price;
+ @Getter
private int limitedStack;
+ @Getter
private int limitedNumber;
+ @Getter
private int timestamp = Emulator.getIntUnixTimestamp();
+ @Getter
+ @Setter
private int soldTimestamp = 0;
+ @Getter
+ @Setter
private MarketPlaceState state = MarketPlaceState.OPEN;
+ @Setter
private boolean needsUpdate = false;
public MarketPlaceOffer(ResultSet set, boolean privateOffer) throws SQLException {
@@ -36,12 +49,12 @@ public class MarketPlaceOffer implements Runnable {
this.itemId = set.getInt("item_id");
if (!set.getString("ltd_data").split(":")[1].equals("0")) {
- this.limitedStack = Integer.valueOf(set.getString("ltd_data").split(":")[0]);
- this.limitedNumber = Integer.valueOf(set.getString("ltd_data").split(":")[1]);
+ this.limitedStack = Integer.parseInt(set.getString("ltd_data").split(":")[0]);
+ this.limitedNumber = Integer.parseInt(set.getString("ltd_data").split(":")[1]);
}
if (!privateOffer) {
- this.avarage = set.getInt("avg");
+ this.average = set.getInt("avg");
this.count = set.getInt("number");
this.price = set.getInt("minPrice");
}
@@ -70,7 +83,7 @@ public class MarketPlaceOffer implements Runnable {
}
}
} 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) {
- 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
public void run() {
@@ -164,8 +118,25 @@ public class MarketPlaceOffer implements Runnable {
statement.setInt(3, this.offerId);
statement.execute();
} 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;
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceState.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceState.java
index 3cd7386d..8c83006f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlaceState.java
@@ -1,36 +1,27 @@
package com.eu.habbo.habbohotel.catalog.marketplace;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor
public enum MarketPlaceState {
OPEN(1),
-
SOLD(2),
-
CLOSED(3);
private final int state;
- MarketPlaceState(int state) {
- this.state = state;
- }
-
public static MarketPlaceState getType(int type) {
- switch (type) {
- case 1:
- return OPEN;
- case 2:
- return SOLD;
- case 3:
- return CLOSED;
- }
+ return switch (type) {
+ case 1 -> OPEN;
+ case 2 -> SOLD;
+ case 3 -> CLOSED;
+ default -> CLOSED;
+ };
- return CLOSED;
}
-
- public int getState() {
- return this.state;
- }
-
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
index cddf2f2f..be689722 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/AddYoutubePlaylistCommand.java
@@ -3,15 +3,14 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.YoutubeManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+@Slf4j
public class AddYoutubePlaylistCommand extends Command {
- private static final Logger LOGGER = LoggerFactory.getLogger(AddYoutubePlaylistCommand.class);
public AddYoutubePlaylistCommand() {
super("cmd_add_youtube_playlist", Emulator.getTexts().getValue("commands.keys.cmd_add_youtube_playlist").split(";"));
@@ -53,7 +52,7 @@ public class AddYoutubePlaylistCommand extends Command {
statement.execute();
} 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"));
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
index 1328ed19..899b954b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/BadgeCommand.java
@@ -6,16 +6,15 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class BadgeCommand extends Command {
- private static final Logger LOGGER = LoggerFactory.getLogger(BadgeCommand.class);
public BadgeCommand() {
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
@@ -64,7 +63,6 @@ public class BadgeCommand extends Command {
if (found) {
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 {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
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);
- return true;
}
+ return true;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/BanCommand.java
index b9946ffa..8b447a0f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/BanCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/BanCommand.java
@@ -28,7 +28,7 @@ public class BanCommand extends Command {
int banTime;
try {
- banTime = Integer.valueOf(params[2]);
+ banTime = Integer.parseInt(params[2]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.invalid_time"), RoomChatMessageBubbles.ALERT);
return true;
@@ -39,7 +39,7 @@ public class BanCommand extends Command {
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);
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);
- 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;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java
index b2fc711c..f23691cc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/BlockAlertCommand.java
@@ -12,8 +12,8 @@ public class BlockAlertCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
- gameClient.getHabbo().getHabboStats().blockStaffAlerts = !gameClient.getHabbo().getHabboStats().blockStaffAlerts;
- 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().getHabboStats().setBlockStaffAlerts(!gameClient.getHabbo().getHabboStats().isBlockStaffAlerts());
+ 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;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java
index d1a06d2a..90a7dad0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java
@@ -32,7 +32,7 @@ public class CalendarCommand extends Command {
int daysBetween = (int) DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
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"));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java
index da17cc8f..bed49403 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/ChangeNameCommand.java
@@ -15,7 +15,7 @@ public class ChangeNameCommand extends Command {
// check if there are no params
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()));
return true;
}
@@ -31,7 +31,7 @@ public class ChangeNameCommand extends Command {
// this runs if params[1] is a valid habbo
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.getHabboStats().allowNameChange = !habbo.getHabboStats().allowNameChange;
+ habbo.getHabboStats().setAllowNameChange(!habbo.getHabboStats().isAllowNameChange());
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java
index 8d6a53b3..0e7ae5c0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/ChatTypeCommand.java
@@ -17,7 +17,7 @@ public class ChatTypeCommand extends Command {
if (params.length >= 2) {
int chatColor;
try {
- chatColor = Integer.valueOf(params[1]);
+ chatColor = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
return true;
@@ -34,21 +34,20 @@ public class ChatTypeCommand extends Command {
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
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);
return true;
}
}
}
- gameClient.getHabbo().getHabboStats().chatColor = RoomChatMessageBubbles.getBubble(chatColor);
+ gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.getBubble(chatColor));
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);
- return true;
} 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);
- return true;
}
+ return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/Command.java b/src/main/java/com/eu/habbo/habbohotel/commands/Command.java
index 6c71c7a2..711bede9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/Command.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/Command.java
@@ -1,19 +1,14 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.habbohotel.gameclients.GameClient;
+import lombok.AllArgsConstructor;
+@AllArgsConstructor
public abstract class Command {
public final String permission;
-
-
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;
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
index 9a0e54a4..bce43f15 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/CommandHandler.java
@@ -16,30 +16,25 @@ import com.eu.habbo.plugin.events.users.UserCommandEvent;
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;
+@Slf4j
public class CommandHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandler.class);
-
private final static THashMap commands = new THashMap<>(5);
- private static final Comparator ALPHABETICAL_ORDER = new Comparator() {
- public int compare(Command c1, Command c2) {
- int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
- return (res != 0) ? res : c1.permission.compareTo(c2.permission);
- }
+ private static final Comparator ALPHABETICAL_ORDER = (c1, c2) -> {
+ int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
+ return (res != 0) ? res : c1.permission.compareTo(c2.permission);
};
public CommandHandler() {
long millis = System.currentTimeMillis();
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) {
@@ -54,9 +49,9 @@ public class CommandHandler {
try {
//command.getConstructor().setAccessible(true);
addCommand(command.newInstance());
- LOGGER.debug("Added command: {}", command.getName());
+ log.debug("Added command: {}", command.getName());
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -71,7 +66,7 @@ public class CommandHandler {
if (parts.length >= 1) {
for (Command command : commands.values()) {
for (String s : command.keys) {
- if (s.toLowerCase().equals(parts[0].toLowerCase())) {
+ if (s.equalsIgnoreCase(parts[0])) {
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)))) {
try {
@@ -90,7 +85,7 @@ public class CommandHandler {
succes = event.succes;
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands()) {
@@ -137,7 +132,7 @@ public class CommandHandler {
s = new StringBuilder(s.substring(0, s.length() - 1));
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 (((RideablePet) pet).getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
((RideablePet) pet).getRider().getHabboInfo().dismountPet();
@@ -145,7 +140,7 @@ public class CommandHandler {
break;
}
- if (command.level <= pet.getLevel())
+ if (command.getLevel() <= pet.getLevel())
pet.handleCommand(command, gameClient.getHabbo(), args);
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
@@ -307,7 +302,7 @@ public class CommandHandler {
if (allowedCommands.contains(command))
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);
}
}
@@ -320,6 +315,6 @@ public class CommandHandler {
public void dispose() {
commands.clear();
- LOGGER.info("Command Handler -> Disposed!");
+ log.info("Command Handler -> Disposed!");
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java
index d14bdb17..269ad245 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/ControlCommand.java
@@ -35,7 +35,6 @@ public class ControlCommand extends Command {
gameClient.getHabbo().getRoomUnit().getCacheable().put("control", target);
target.getRoomUnit().getCacheable().put("controller", gameClient.getHabbo());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.controlling").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
- return true;
} else {
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);
}
- return true;
}
+ return true;
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java
index 405dbfde..48399f27 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java
@@ -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.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" +
- "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 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());
} 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) {
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
- "x: " + tile.x + "\r" +
- "y: " + tile.y + "\r" +
- "z: " + tile.z + "\r" +
- "Tile State: " + tile.state.name() + "\r" +
+ "x: " + tile.getX() + "\r" +
+ "y: " + tile.getY() + "\r" +
+ "z: " + tile.getZ() + "\r" +
+ "Tile State: " + tile.getState().name() + "\r" +
"Tile Relative Height: " + tile.relativeHeight() + "\r" +
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java
index 867e7a95..82dd200e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/DisconnectCommand.java
@@ -17,7 +17,7 @@ public class DisconnectCommand extends Command {
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);
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java
index dbe1ae2f..513c4cd3 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/EmptyPetsInventoryCommand.java
@@ -6,8 +6,8 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
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.PetInventoryComposer;
import gnu.trove.map.hash.TIntObjectHashMap;
public class EmptyPetsInventoryCommand extends Command {
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
index cf69a1d1..b9a44e40 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/EnableCommand.java
@@ -5,12 +5,10 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class EnableCommand extends Command {
- private static final Logger LOGGER = LoggerFactory.getLogger(EnableCommand.class);
-
public EnableCommand() {
super("cmd_enable", Emulator.getTexts().getValue("commands.keys.cmd_enable").split(";"));
}
@@ -43,7 +41,7 @@ public class EnableCommand extends Command {
}
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java
index 16b807fc..1c2e9eab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/EventCommand.java
@@ -37,8 +37,9 @@ public class EventCommand extends Command {
for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue();
- if (habbo.getHabboStats().blockStaffAlerts)
+ if (habbo.getHabboStats().isBlockStaffAlerts()) {
continue;
+ }
habbo.getClient().sendResponse(msg);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java
index ac211cd4..a897b7cd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/FacelessCommand.java
@@ -36,7 +36,7 @@ public class FacelessCommand extends Command {
}
}
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
index 9e208a0a..e746f954 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/FilterWordCommand.java
@@ -4,15 +4,14 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.modtool.WordFilterWord;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+@Slf4j
public class FilterWordCommand extends Command {
- private static final Logger LOGGER = LoggerFactory.getLogger(FilterWordCommand.class);
public FilterWordCommand() {
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";"));
@@ -39,7 +38,7 @@ public class FilterWordCommand extends Command {
statement.setString(2, replacement);
statement.execute();
} 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"));
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java
index b640a806..c79d5aa1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/FreezeCommand.java
@@ -23,13 +23,12 @@ public class FreezeCommand extends Command {
habbo.getRoomUnit().setCanWalk(false);
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);
- return true;
} else {
habbo.getRoomUnit().setCanWalk(true);
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);
- return true;
}
+ return true;
}
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/GiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/GiftCommand.java
index 13640d4f..05abb1f7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/GiftCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/GiftCommand.java
@@ -8,8 +8,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboItem;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
import gnu.trove.map.hash.THashMap;
@@ -25,7 +25,7 @@ public class GiftCommand extends Command {
int itemId;
try {
- itemId = Integer.valueOf(params[2]);
+ itemId = Integer.parseInt(params[2]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
@@ -80,7 +80,7 @@ public class GiftCommand extends Command {
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}notifications/gift.gif");
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;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java
index 274368c1..1ea3275f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/GiveRankCommand.java
@@ -28,7 +28,7 @@ public class GiveRankCommand extends Command {
if (params.length == 3) {
if (StringUtils.isNumeric(params[2])) {
- int rankId = Integer.valueOf(params[2]);
+ int rankId = Integer.parseInt(params[2]);
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId);
} else {
@@ -52,11 +52,10 @@ public class GiveRankCommand extends Command {
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);
- return true;
} else {
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;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
index 31aa0006..2f8ce1b8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java
@@ -27,7 +27,7 @@ public class HotelAlertCommand extends Command {
for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue();
- if (habbo.getHabboStats().blockStaffAlerts)
+ if (habbo.getHabboStats().isBlockStaffAlerts())
continue;
habbo.getClient().sendResponse(msg);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
index 27e1eb16..64b019b9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java
@@ -6,9 +6,9 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
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.UserUpdateComposer;
-import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer;
import com.eu.habbo.threading.runnables.RoomUnitTeleport;
public class InvisibleCommand extends Command {
@@ -23,7 +23,7 @@ public class InvisibleCommand extends Command {
if (roomUnit.isInvisible()) {
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.setInRoom(true);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java
index b874d70d..267327ff 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassBadgeCommand.java
@@ -7,8 +7,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
import gnu.trove.map.hash.THashMap;
@@ -31,7 +31,7 @@ public class MassBadgeCommand extends Command {
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
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 set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
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)) {
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
- if (b != null) {
- habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
-
- habbo.getClient().sendResponse(message);
- }
+ habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
+ habbo.getClient().sendResponse(message);
}
}
}
+ return true;
}
- return true;
}
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massbadge.no_badge"), RoomChatMessageBubbles.ALERT);
return true;
+
+
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassCreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassCreditsCommand.java
index 7028183d..584fa20d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MassCreditsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassCreditsCommand.java
@@ -19,7 +19,7 @@ public class MassCreditsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(params[1]);
+ amount = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java
index 2ca71e0a..b267cbba 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassGiftCommand.java
@@ -7,8 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
import gnu.trove.map.hash.THashMap;
@@ -25,7 +25,7 @@ public class MassGiftCommand extends Command {
int itemId;
try {
- itemId = Integer.valueOf(params[1]);
+ itemId = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
@@ -57,7 +57,7 @@ public class MassGiftCommand extends Command {
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}notifications/gift.gif");
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(() -> {
for (Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassPixelsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassPixelsCommand.java
index 7d4fd95b..504bd75e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MassPixelsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassPixelsCommand.java
@@ -18,7 +18,7 @@ public class MassPixelsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(params[1]);
+ amount = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MassPointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MassPointsCommand.java
index 79103ea8..dd659c7a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MassPointsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MassPointsCommand.java
@@ -19,7 +19,7 @@ public class MassPointsCommand extends Command {
if (params.length == 3) {
amountString = params[1];
try {
- type = Integer.valueOf(params[2]);
+ type = Integer.parseInt(params[2]);
} 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);
return true;
@@ -48,7 +48,7 @@ public class MassPointsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(amountString);
+ amount = Integer.parseInt(amountString);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java
index 768a42e2..15e29098 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MuteBotsCommand.java
@@ -11,8 +11,8 @@ public class MuteBotsCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
- gameClient.getHabbo().getHabboStats().ignoreBots = !gameClient.getHabbo().getHabboStats().ignoreBots;
- gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().ignoreBots ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
+ gameClient.getHabbo().getHabboStats().setIgnoreBots(!gameClient.getHabbo().getHabboStats().isIgnoreBots());
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().isIgnoreBots() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
return true;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java
index 0d41a472..0b0d60f2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MuteCommand.java
@@ -33,7 +33,7 @@ public class MuteCommand extends Command {
if (params.length == 3) {
try {
- duration = Integer.valueOf(params[2]);
+ duration = Integer.parseInt(params[2]);
if (duration <= 0)
throw new Exception("");
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java
index 6dcb6972..7c33c505 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/MutePetsCommand.java
@@ -11,8 +11,8 @@ public class MutePetsCommand extends Command {
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception {
- gameClient.getHabbo().getHabboStats().ignorePets = !gameClient.getHabbo().getHabboStats().ignorePets;
- gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().ignorePets ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
+ gameClient.getHabbo().getHabboStats().setIgnorePets(!gameClient.getHabbo().getHabboStats().isIgnorePets());
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().isIgnorePets() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
return true;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java
index 00a81642..ffe2d433 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/PetInfoCommand.java
@@ -2,10 +2,8 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
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.rooms.RoomChatMessageBubbles;
-import gnu.trove.procedure.TIntObjectProcedure;
public class PetInfoCommand extends Command {
public PetInfoCommand() {
@@ -20,30 +18,27 @@ public class PetInfoCommand extends Command {
String name = params[1];
- gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry(new TIntObjectProcedure() {
- @Override
- public boolean execute(int a, Pet pet) {
- if (pet.getName().equalsIgnoreCase(name)) {
- gameClient.getHabbo().alert("" +
- Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
- Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
- Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
- Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
- Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
- "\r" +
- Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
- Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
- Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
- Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappyness() + "\r" +
- Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
- Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
- 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;
+ gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry((a, pet) -> {
+ if (pet.getName().equalsIgnoreCase(name)) {
+ gameClient.getHabbo().alert("" +
+ Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
+ Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
+ Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
+ Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
+ Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
+ "\r" +
+ Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
+ Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
+ Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
+ Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappiness() + "\r" +
+ Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
+ Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
+ 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;
});
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PixelCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PixelCommand.java
index 327dc4e9..11a7eb99 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/PixelCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/PixelCommand.java
@@ -20,11 +20,11 @@ public class PixelCommand extends Command {
if (Integer.parseInt(params[2]) != 0) {
habbo.givePixels(Integer.parseInt(params[2]));
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
- 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 {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PointsCommand.java
index 0580188f..56ca70cd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/PointsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/PointsCommand.java
@@ -21,7 +21,7 @@ public class PointsCommand extends Command {
if (params.length == 4) {
try {
- type = Integer.valueOf(params[3]);
+ type = Integer.parseInt(params[3]);
} 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);
return true;
@@ -31,7 +31,7 @@ public class PointsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(params[2]);
+ amount = Integer.parseInt(params[2]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java
index de943796..6263bb88 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/PromoteTargetOfferCommand.java
@@ -47,8 +47,8 @@ public class PromoteTargetOfferCommand extends Command {
} else {
int offerId = 0;
try {
- offerId = Integer.valueOf(offerKey);
- } catch (Exception e) {
+ offerId = Integer.parseInt(offerKey);
+ } catch (Exception ignored) {
}
if (offerId > 0) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java
index 5e041f3a..f8a4fffe 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/PushCommand.java
@@ -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());
- if (tFront != null && tFront.isWalkable() && tFront.x == habbo.getRoomUnit().getX() && tFront.y == habbo.getRoomUnit().getY()) {
- RoomTile tFrontTarget = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(habbo.getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
+ if (tFront != null && tFront.isWalkable()) {
+ 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 (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
- gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.invalid").replace("%username%", params[1]));
- return true;
+ if (tFrontTarget != null && tFrontTarget.isWalkable()) {
+ if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
+ gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.invalid").replace("%username%", params[1]));
+ 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);
- 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());
+ } else {
+ 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;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java
index ad48e0f7..df56edad 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RedeemCommand.java
@@ -9,7 +9,6 @@ import com.eu.habbo.threading.runnables.QueryDeleteHabboItems;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.procedure.TIntIntProcedure;
import java.util.ArrayList;
@@ -35,21 +34,21 @@ public class RedeemCommand extends Command {
items.add(item);
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
try {
- credits += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
- } catch (Exception e) {
+ credits += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
+ } catch (Exception ignored) {
}
} else if (item.getBaseItem().getName().startsWith("PF_")) {
try {
- pixels += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
- } catch (Exception e) {
+ pixels += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
+ } catch (Exception ignored) {
}
} else if (item.getBaseItem().getName().startsWith("DF_")) {
int pointsType;
int pointsAmount;
- pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
- pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
+ pointsType = Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
+ pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
}
@@ -58,7 +57,7 @@ public class RedeemCommand extends Command {
int pointsAmount;
pointsType = 5;
- pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
+ pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
}
@@ -89,13 +88,10 @@ public class RedeemCommand extends Command {
}
if (!points.isEmpty()) {
- points.forEachEntry(new TIntIntProcedure() {
- @Override
- public boolean execute(int a, int b) {
- gameClient.getHabbo().givePoints(a, b);
- message[0] += " ," + Emulator.getTexts().getValue("seasonal.name." + a) + ": " + b;
- return true;
- }
+ points.forEachEntry((a, b) -> {
+ gameClient.getHabbo().givePoints(a, b);
+ message[0] += " ," + Emulator.getTexts().getValue("seasonal.name." + a) + ": " + b;
+ return true;
});
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBadgeCommand.java
index 3d9be4c8..099ff962 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBadgeCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBadgeCommand.java
@@ -7,8 +7,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
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.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
import gnu.trove.map.hash.THashMap;
@@ -32,7 +32,7 @@ public class RoomBadgeCommand extends Command {
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
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()) {
if (habbo.isOnline()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
index 3b3f5161..1ce9dfc1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomBundleCommand.java
@@ -7,13 +7,12 @@ import com.eu.habbo.habbohotel.catalog.CatalogPageLayouts;
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
+@Slf4j
public class RoomBundleCommand extends Command {
- private static final Logger LOGGER = LoggerFactory.getLogger(RoomBundleCommand.class);
public RoomBundleCommand() {
super("cmd_bundle", Emulator.getTexts().getValue("commands.keys.cmd_bundle").split(";"));
@@ -36,10 +35,10 @@ public class RoomBundleCommand extends Command {
return true;
}
- parentId = Integer.valueOf(params[1]);
- credits = Integer.valueOf(params[2]);
- points = Integer.valueOf(params[3]);
- pointsType = Integer.valueOf(params[4]);
+ parentId = Integer.parseInt(params[1]);
+ credits = Integer.parseInt(params[2]);
+ points = Integer.parseInt(params[3]);
+ 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);
@@ -66,7 +65,7 @@ public class RoomBundleCommand extends Command {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomCreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomCreditsCommand.java
index 1c72b7a8..762b1d29 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomCreditsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomCreditsCommand.java
@@ -16,7 +16,7 @@ public class RoomCreditsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(params[1]);
+ amount = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masscredits.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java
index b968342c..32db45a0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomDanceCommand.java
@@ -18,7 +18,7 @@ public class RoomDanceCommand extends Command {
int danceId;
try {
- danceId = Integer.valueOf(params[1]);
+ danceId = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.invalid_dance"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java
index 111b3887..0f4fb4f2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomEffectCommand.java
@@ -19,7 +19,7 @@ public class RoomEffectCommand extends Command {
}
try {
- int effectId = Integer.valueOf(params[1]);
+ int effectId = Integer.parseInt(params[1]);
if (effectId >= 0) {
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
@@ -27,11 +27,10 @@ public class RoomEffectCommand extends Command {
room.giveEffect(habbo, effectId, -1);
}
- return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.positive"), RoomChatMessageBubbles.ALERT);
- return true;
}
+ return true;
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.numbers_only"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomGiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomGiftCommand.java
index 7b821959..ad0aa1c7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomGiftCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomGiftCommand.java
@@ -20,7 +20,7 @@ public class RoomGiftCommand extends Command {
int itemId;
try {
- itemId = Integer.valueOf(params[1]);
+ itemId = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java
index a1a6f3a6..34a55915 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomItemCommand.java
@@ -17,7 +17,7 @@ public class RoomItemCommand extends Command {
if (params.length >= 2) {
try {
- itemId = Integer.valueOf(params[1]);
+ itemId = Integer.parseInt(params[1]);
if (itemId < 0) {
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) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.given").replace("%item%", itemId + ""), RoomChatMessageBubbles.ALERT);
- return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.removed"), RoomChatMessageBubbles.ALERT);
- return true;
}
+ return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomPixelsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomPixelsCommand.java
index 567400f1..b28fd599 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomPixelsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomPixelsCommand.java
@@ -16,7 +16,7 @@ public class RoomPixelsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(params[1]);
+ amount = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massduckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomPointsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomPointsCommand.java
index 32ebe50d..eac86282 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomPointsCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomPointsCommand.java
@@ -18,7 +18,7 @@ public class RoomPointsCommand extends Command {
try {
amountString = params[1];
- type = Integer.valueOf(params[2]);
+ type = Integer.parseInt(params[2]);
} 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);
return true;
@@ -46,7 +46,7 @@ public class RoomPointsCommand extends Command {
int amount;
try {
- amount = Integer.valueOf(amountString);
+ amount = Integer.parseInt(amountString);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_masspoints.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java
index b6bdfd87..ae173d33 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/SetMaxCommand.java
@@ -14,7 +14,7 @@ public class SetMaxCommand extends Command {
if (params.length >= 2) {
int max;
try {
- max = Integer.valueOf(params[1]);
+ max = Integer.parseInt(params[1]);
} catch (Exception e) {
return false;
}
@@ -22,11 +22,10 @@ public class SetMaxCommand extends Command {
if (max > 0 && max < 9999) {
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setUsersMax(max);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_setmax").replace("%value%", max + ""), RoomChatMessageBubbles.ALERT);
- return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
- return true;
}
+ return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java
index b9c0072f..9678aadb 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/SetPollCommand.java
@@ -15,8 +15,8 @@ public class SetPollCommand extends Command {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
int pollId = -1;
try {
- pollId = Integer.valueOf(params[1]);
- } catch (Exception e) {
+ pollId = Integer.parseInt(params[1]);
+ } catch (Exception ignored) {
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java
index bdce54d6..ab9c1fe2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/SetSpeedCommand.java
@@ -20,7 +20,7 @@ public class SetSpeedCommand extends Command {
int newSpeed;
try {
- newSpeed = Integer.valueOf(params[1]);
+ newSpeed = Integer.parseInt(params[1]);
} catch (Exception e) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setspeed.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java
index 310ba8d8..c48360c4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/ShoutCommand.java
@@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.users.ShoutMessageComposer;
public class ShoutCommand extends Command {
- private static String idea = "Kudo's To Droppy for this idea!";
public ShoutCommand() {
super("cmd_shout", Emulator.getTexts().getValue("commands.keys.cmd_shout").split(";"));
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java
index 19eabcab..fe47fdab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/StaffOnlineCommand.java
@@ -20,7 +20,7 @@ public class StaffOnlineCommand extends Command {
if (params.length >= 2) {
try {
- int i = Integer.valueOf(params[1]);
+ int i = Integer.parseInt(params[1]);
if (i < 1) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffonline.positive_only"), RoomChatMessageBubbles.ALERT);
@@ -43,12 +43,7 @@ public class StaffOnlineCommand extends Command {
}
}
- staffs.sort(new Comparator() {
- @Override
- public int compare(Habbo o1, Habbo o2) {
- return o1.getHabboInfo().getId() - o2.getHabboInfo().getId();
- }
- });
+ staffs.sort(Comparator.comparingInt(o -> o.getHabboInfo().getId()));
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_staffonline.staffs"));
message.append("\r\n");
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
index b4dad5c4..55e9d446 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/StalkCommand.java
@@ -41,10 +41,9 @@ public class StalkCommand extends Command {
gameClient.sendResponse(new GetGuestRoomResultComposer(habbo.getHabboInfo().getCurrentRoom(), gameClient.getHabbo(), true, false));
//gameClient.sendResponse(new ForwardToRoomComposer(habbo.getHabboInfo().getCurrentRoom().getId()));
- return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.forgot_username"), RoomChatMessageBubbles.ALERT);
- return true;
}
+ return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java
index 96350ae9..27b7e55b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/SubscriptionCommand.java
@@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
-import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.habbohotel.users.HabboStats;
@@ -54,7 +53,7 @@ public class SubscriptionCommand extends Command {
}
}
- if(!Emulator.getGameEnvironment().getSubscriptionManager().types.containsKey(subscription)) {
+ if(!Emulator.getGameEnvironment().getSubscriptionManager().getTypes().containsKey(subscription)) {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.type_not_found", "%subscription% is not a valid subscription type").replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java
index 366907ce..71bb9de0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java
@@ -52,10 +52,9 @@ public class SummonCommand extends Command {
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername()));
- return true;
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_summon.forgot_username"), RoomChatMessageBubbles.ALERT);
- return true;
}
+ return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java
index 243dec78..6c9eceab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java
@@ -15,7 +15,7 @@ public class TestCommand extends Command {
if (gameClient.getHabbo() != null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL) || !Emulator.debugging)
return false;
- int header = Integer.valueOf(params[1]);
+ int header = Integer.parseInt(params[1]);
ServerMessage message = new ServerMessage(header);
@@ -31,11 +31,11 @@ public class TestCommand extends Command {
message.appendString("");
}
} else if (data[0].equals("i")) {
- message.appendInt(Integer.valueOf(data[1]));
+ message.appendInt(Integer.parseInt(data[1]));
} else if (data[0].equalsIgnoreCase("by")) {
- message.appendByte(Integer.valueOf(data[1]));
+ message.appendByte(Integer.parseInt(data[1]));
} else if (data[0].equalsIgnoreCase("sh")) {
- message.appendShort(Integer.valueOf(data[1]));
+ message.appendShort(Integer.parseInt(data[1]));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java
index b50d4bc7..d7337d37 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/TransformCommand.java
@@ -31,7 +31,6 @@ public class TransformCommand extends Command {
}
gameClient.sendResponse(new MOTDNotificationComposer(new String[]{petNames.toString()}));
- return true;
} else {
String petName = params[1];
PetData petData = Emulator.getGameEnvironment().getPetManager().getPetData(petName);
@@ -40,7 +39,7 @@ public class TransformCommand extends Command {
if (params.length >= 3) {
try {
- race = Integer.valueOf(params[2]);
+ race = Integer.parseInt(params[2]);
} catch (Exception e) {
return true;
}
@@ -54,16 +53,16 @@ public class TransformCommand extends Command {
if (petData != null) {
RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit();
roomUnit.setRoomUnitType(RoomUnitType.PET);
- gameClient.getHabbo().getHabboStats().cache.put("pet_type", petData);
- gameClient.getHabbo().getHabboStats().cache.put("pet_race", race);
- gameClient.getHabbo().getHabboStats().cache.put("pet_color", color);
+ gameClient.getHabbo().getHabboStats().getCache().put("pet_type", petData);
+ gameClient.getHabbo().getHabboStats().getCache().put("pet_race", race);
+ gameClient.getHabbo().getHabboStats().getCache().put("pet_color", color);
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserRemoveMessageComposer(gameClient.getHabbo().getRoomUnit()).compose());
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserPetComposer(petData.getType(), race, color, gameClient.getHabbo()).compose());
} else {
//Pet Not Found
return true;
}
- return true;
}
+ return true;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
index b4a3ca78..b5f7148e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/UserInfoCommand.java
@@ -46,7 +46,7 @@ public class UserInfoCommand extends Command {
((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") +
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") +
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") +
- (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r" : ""));
+ (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().getAchievementScore() + "\r" : ""));
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId());
@@ -70,7 +70,7 @@ public class UserInfoCommand extends Command {
message.append(Emulator.getTexts().getValue("seasonal.name." + iterator.key())).append(": ").append(iterator.value()).append("\r");
}
- message.append("\r").append(onlineHabbo != null ? "" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().blockFriendRequests) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");
+ message.append("\r").append(onlineHabbo != null ? "" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().getRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().getPetRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().isBlockFollowing()) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().isBlockFriendRequests()) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
@@ -85,12 +85,7 @@ public class UserInfoCommand extends Command {
message.append("\r" + "Other accounts (");
ArrayList users = Emulator.getGameEnvironment().getHabboManager().getCloneAccounts(onlineHabbo, 10);
- users.sort(new Comparator() {
- @Override
- public int compare(HabboInfo o1, HabboInfo o2) {
- return o1.getId() - o2.getId();
- }
- });
+ users.sort(Comparator.comparingInt(HabboInfo::getId));
message.append(users.size()).append("):\r");
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java
index ba74d5d2..c66cb4b6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/WordQuizCommand.java
@@ -25,7 +25,7 @@ public class WordQuizCommand extends Command {
duration = Integer.parseInt(params[params.length-1]);
params = Arrays.copyOf(params, params.length-1);
}
- catch (Exception e) {}
+ catch (Exception ignored) {}
for (int i = 1; i < params.length; i++) {
question.append(" ").append(params[i]);
diff --git a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
index 9fe611a4..c356f337 100644
--- a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java
@@ -3,17 +3,15 @@ package com.eu.habbo.habbohotel.crafting;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class CraftingManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(CraftingManager.class);
private final THashMap- altars;
@@ -29,7 +27,7 @@ public class CraftingManager {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM crafting_altars_recipes " +
"INNER JOIN crafting_recipes ON crafting_altars_recipes.recipe_id = crafting_recipes.id " +
"INNER JOIN crafting_recipes_ingredients ON crafting_recipes.id = crafting_recipes_ingredients.recipe_id " +
- "WHERE crafting_recipes.enabled = ? ORDER BY altar_id ASC")) {
+ "WHERE crafting_recipes.enabled = ? ORDER BY altar_id ")) {
statement.setString(1, "1");
try (ResultSet set = statement.executeQuery()) {
while (set.next()) {
@@ -56,14 +54,14 @@ public class CraftingManager {
recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount"));
altar.addIngredient(ingredientItem);
} else {
- LOGGER.error("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id"));
+ log.error("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id"));
}
}
}
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -71,15 +69,12 @@ public class CraftingManager {
final int[] i = {0};
synchronized (this.altars) {
- this.altars.forEachValue(new TObjectProcedure() {
- @Override
- public boolean execute(CraftingAltar altar) {
- if (altar.hasIngredient(item)) {
- i[0]++;
- }
-
- return true;
+ this.altars.forEachValue(altar -> {
+ if (altar.hasIngredient(item)) {
+ i[0]++;
}
+
+ return true;
});
}
@@ -117,7 +112,7 @@ public class CraftingManager {
}
statement.executeBatch();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
this.altars.clear();
diff --git a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingRecipe.java b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingRecipe.java
index 286dfb62..2dffae90 100644
--- a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingRecipe.java
+++ b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingRecipe.java
@@ -3,18 +3,27 @@ package com.eu.habbo.habbohotel.crafting;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import gnu.trove.map.hash.THashMap;
+import lombok.Getter;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CraftingRecipe {
+ @Getter
private final int id;
+ @Getter
private final String name;
+ @Getter
private final Item reward;
+ @Getter
private final boolean secret;
+ @Getter
private final String achievement;
+ @Getter
private final boolean limited;
+ @Getter
private final THashMap
- ingredients;
+ @Getter
private int remaining;
public CraftingRecipe(ResultSet set) throws SQLException {
@@ -30,7 +39,7 @@ public class CraftingRecipe {
}
public boolean canBeCrafted() {
- return !this.limited || this.remaining > 0;
+ return this.limited && this.remaining <= 0;
}
public synchronized boolean decrease() {
@@ -54,35 +63,4 @@ public class CraftingRecipe {
return this.ingredients.containsKey(item);
}
- public int getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- public Item getReward() {
- return this.reward;
- }
-
- public boolean isSecret() {
- return this.secret;
- }
-
- public String getAchievement() {
- return this.achievement;
- }
-
- public boolean isLimited() {
- return this.limited;
- }
-
- public THashMap
- getIngredients() {
- return this.ingredients;
- }
-
- public int getRemaining() {
- return this.remaining;
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
index a05ef0a0..be3f12f2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
+++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClient.java
@@ -7,24 +7,28 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.MessageComposer;
import io.netty.channel.Channel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
+@Slf4j
public class GameClient {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(GameClient.class);
-
+
+ @Getter
private final Channel channel;
+ @Getter
private final HabboEncryption encryption;
+ @Setter
+ @Getter
private Habbo habbo;
+ @Setter
+ @Getter
private boolean handshakeFinished;
+ @Getter
private String machineId = "";
public final ConcurrentHashMap incomingPacketCounter = new ConcurrentHashMap<>(25);
@@ -41,41 +45,6 @@ public class GameClient {
: null;
}
- public Channel getChannel() {
- return this.channel;
- }
-
- public HabboEncryption getEncryption() {
- return encryption;
- }
-
- public Habbo getHabbo() {
- return this.habbo;
- }
-
- public void setHabbo(Habbo habbo) {
- this.habbo = habbo;
- }
-
- public boolean isHandshakeFinished() {
- return handshakeFinished;
- }
-
- public void setHandshakeFinished(boolean handshakeFinished) {
- this.handshakeFinished = handshakeFinished;
- }
-
- public String getMachineId() {
- return this.machineId;
- }
-
- public void setMachineId(String machineId) {
- if (machineId == null) {
- throw new RuntimeException("Cannot set machineID to NULL");
- }
-
- this.machineId = machineId;
- }
public void sendResponse(MessageComposer composer) {
this.sendResponse(composer.compose());
@@ -119,7 +88,16 @@ public class GameClient {
this.habbo = null;
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
+
+ public void setMachineId(String machineId) {
+ if (machineId == null) {
+ throw new RuntimeException("Cannot set machineID to NULL");
+ }
+
+ this.machineId = machineId;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java
index ad9b28ff..056c566b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java
@@ -4,7 +4,11 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.networking.gameserver.GameServerAttributes;
-import io.netty.channel.*;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelId;
+import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
@@ -13,6 +17,7 @@ import java.util.concurrent.ConcurrentMap;
public class GameClientManager {
+ @Getter
private final ConcurrentMap clients;
public GameClientManager() {
@@ -20,19 +25,10 @@ public class GameClientManager {
}
- public ConcurrentMap getSessions() {
- return this.clients;
- }
-
public boolean addClient(ChannelHandlerContext ctx) {
GameClient client = new GameClient(ctx.channel());
- ctx.channel().closeFuture().addListener(new ChannelFutureListener() {
- @Override
- public void operationComplete(ChannelFuture channelFuture) throws Exception {
- GameClientManager.this.disposeClient(ctx.channel());
- }
- });
+ ctx.channel().closeFuture().addListener((ChannelFutureListener) channelFuture -> GameClientManager.this.disposeClient(ctx.channel()));
ctx.channel().attr(GameServerAttributes.CLIENT).set(client);
ctx.fireChannelRegistered();
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java
index a7219978..aa50cea7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java
@@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredHighscore;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
-import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreDataEntry;
import com.eu.habbo.habbohotel.items.interactions.wired.triggers.WiredTriggerTeamLoses;
import com.eu.habbo.habbohotel.items.interactions.wired.triggers.WiredTriggerTeamWins;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
+import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreDataEntry;
import com.eu.habbo.messages.outgoing.guides.YouArePlayingGameMessageComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.games.GameHabboJoinEvent;
@@ -20,14 +20,13 @@ import com.eu.habbo.plugin.events.games.GameStartedEvent;
import com.eu.habbo.plugin.events.games.GameStoppedEvent;
import com.eu.habbo.threading.runnables.SaveScoreForTeam;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.stream.Collectors;
+@Slf4j
public abstract class Game implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(Game.class);
protected final THashMap teams = new THashMap<>();
protected final Room room;
private final Class extends GameTeam> gameTeamClazz;
@@ -75,7 +74,7 @@ public abstract class Game implements Runnable {
return true;
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return false;
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java
index 143974dd..794160ff 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/GameTeam.java
@@ -1,9 +1,6 @@
package com.eu.habbo.habbohotel.games;
-import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
-import com.eu.habbo.plugin.Event;
-import com.eu.habbo.plugin.events.games.GameHabboLeaveEvent;
import gnu.trove.set.hash.THashSet;
public class GameTeam {
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
index c82796c1..33f83e3b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
@@ -17,26 +17,21 @@ import com.eu.habbo.messages.outgoing.rooms.users.ExpressionMessageComposer;
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
+@Slf4j
public class BattleBanzaiGame extends Game {
- private static final Logger LOGGER = LoggerFactory.getLogger(BattleBanzaiGame.class);
-
-
+
public static final int effectId = 32;
-
-
+
public static final int POINTS_HIJACK_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.steal", 0);
-
-
+
public static final int POINTS_FILL_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.fill", 0);
-
-
+
public static final int POINTS_LOCK_TILE = Emulator.getConfig().getInt("hotel.banzai.points.tile.lock", 1);
private static final ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(Emulator.getConfig().getInt("hotel.banzai.fill.threads", 2));
@@ -165,7 +160,7 @@ public class BattleBanzaiGame extends Game {
}
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -283,7 +278,7 @@ public class BattleBanzaiGame extends Game {
if (largestAreaOfAll.isPresent()) {
for (RoomTile tile : largestAreaOfAll.get()) {
- Optional tileItem = this.gameTiles.values().stream().filter(i -> i.getX() == tile.x && i.getY() == tile.y && i instanceof InteractionBattleBanzaiTile).findAny();
+ Optional tileItem = this.gameTiles.values().stream().filter(i -> i.getX() == tile.getX() && i.getY() == tile.getY() && i instanceof InteractionBattleBanzaiTile).findAny();
tileItem.ifPresent(habboItem -> {
this.tileLocked(teamColor, habboItem, habbo, true);
@@ -375,7 +370,7 @@ public class BattleBanzaiGame extends Game {
scoreboard.setExtradata("0");
}
- int oldScore = Integer.valueOf(scoreboard.getExtradata());
+ int oldScore = Integer.parseInt(scoreboard.getExtradata());
if (oldScore == totalScore)
continue;
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java
index 2156e471..94725332 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java
@@ -38,7 +38,7 @@ public class BattleBanzaiGameTeam extends GameTeam {
RoomUnit roomUnit = habbo.getRoomUnit();
Room room = roomUnit.getRoom();
if(room == null) return;
- HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
+ HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().getX(), roomUnit.getCurrentLocation().getY());
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
index 1f341d45..262f48db 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
@@ -21,17 +21,14 @@ import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import com.eu.habbo.threading.runnables.freeze.FreezeClearEffects;
import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball;
import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.Map;
+@Slf4j
public class FreezeGame extends Game {
- private static final Logger LOGGER = LoggerFactory.getLogger(FreezeGame.class);
-
public static final int effectId = 39;
public static int POWER_UP_POINTS;
@@ -113,7 +110,7 @@ public class FreezeGame extends Game {
for (int j = 0; j < radius; j++) {
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), rotatation, j);
- if (t == null || t.x < 0 || t.y < 0 || t.x >= this.room.getLayout().getMapSizeX() || t.y >= this.room.getLayout().getMapSizeY())
+ if (t == null || t.getX() < 0 || t.getY() < 0 || t.getX() >= this.room.getLayout().getMapSizeX() || t.getY() >= this.room.getLayout().getMapSizeY())
continue;
tiles.add(t);
@@ -127,13 +124,13 @@ public class FreezeGame extends Game {
THashSet tiles = new THashSet<>();
for (int rotation = 1; rotation < 9; rotation += 2) {
- RoomTile t = this.room.getLayout().getTile(x, y);
+ RoomTile t;
for (int j = 0; j < radius; j++) {
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), rotation, j);
if (t != null) {
- if (t.x < 0 || t.y < 0 || t.x >= this.room.getLayout().getMapSizeX() || t.y >= this.room.getLayout().getMapSizeY())
+ if (t.getX() < 0 || t.getY() < 0 || t.getX() >= this.room.getLayout().getMapSizeX() || t.getY() >= this.room.getLayout().getMapSizeY())
continue;
tiles.add(t);
@@ -159,37 +156,16 @@ public class FreezeGame extends Game {
player.addScore(FreezeGame.POWER_UP_POINTS);
switch (powerUpId) {
- case 2: {
- player.increaseExplosion();
- break;
- }
-
- case 3: {
- player.addSnowball();
- break;
- }
-
- case 4: {
- player.nextDiagonal = true;
- break;
- }
-
- case 5: {
+ case 2 -> player.increaseExplosion();
+ case 3 -> player.addSnowball();
+ case 4 -> player.nextDiagonal = true;
+ case 5 -> {
player.nextHorizontal = true;
player.nextDiagonal = true;
player.tempMassiveExplosion = true;
- break;
- }
-
- case 6: {
- player.addLife();
- break;
- }
-
- case 7: {
- player.addProtection();
- break;
}
+ case 6 -> player.addLife();
+ case 7 -> player.addProtection();
}
}
@@ -265,7 +241,7 @@ public class FreezeGame extends Game {
}
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -318,13 +294,10 @@ public class FreezeGame extends Game {
}
public void setFreezeTileState(String state) {
- this.room.getRoomSpecialTypes().getFreezeExitTiles().forEachValue(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionFreezeExitTile object) {
- object.setExtradata(state);
- FreezeGame.this.room.updateItemState(object);
- return true;
- }
+ this.room.getRoomSpecialTypes().getFreezeExitTiles().forEachValue(object -> {
+ object.setExtradata(state);
+ FreezeGame.this.room.updateItemState(object);
+ return true;
});
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGamePlayer.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGamePlayer.java
index 3b8964c2..7c14d9cb 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGamePlayer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGamePlayer.java
@@ -6,12 +6,14 @@ import com.eu.habbo.habbohotel.games.GamePlayer;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.GamePlayerValueMessageComposer;
+import lombok.Getter;
public class FreezeGamePlayer extends GamePlayer {
public boolean nextDiagonal;
public boolean nextHorizontal;
public boolean tempMassiveExplosion;
public boolean dead;
+ @Getter
private int lives;
private int snowBalls;
private int explosionBoost;
@@ -69,10 +71,6 @@ public class FreezeGamePlayer extends GamePlayer {
}
}
- public int getLives() {
- return this.lives;
- }
-
public boolean canPickupLife() {
return this.lives < 3;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java
index dea71694..845a9bb6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java
@@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
@@ -29,7 +28,7 @@ public class FreezeGameTeam extends GameTeam {
Room room = roomUnit.getRoom();
if(room == null) return;
- HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
+ HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().getX(), roomUnit.getCurrentLocation().getY());
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java b/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java
index 68955a6e..f9ccdb67 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java
@@ -176,7 +176,7 @@ public abstract class TagGame extends Game {
Room room = roomUnit.getRoom();
if (room == null) return;
- HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
+ HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().getX(), roomUnit.getCurrentLocation().getY());
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java b/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java
index f17de53a..9cb2a072 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java
@@ -45,7 +45,7 @@ public class WiredGame extends Game {
Room room = this.room;
if (room == null) return;
- HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
+ HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().getX(), roomUnit.getCurrentLocation().getY());
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
diff --git a/src/main/java/com/eu/habbo/habbohotel/guides/GuardianTicket.java b/src/main/java/com/eu/habbo/habbohotel/guides/GuardianTicket.java
index 4e2caa19..c9d578ad 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guides/GuardianTicket.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guides/GuardianTicket.java
@@ -11,6 +11,7 @@ import com.eu.habbo.messages.outgoing.guides.GuideTicketResolutionMessageCompose
import com.eu.habbo.threading.runnables.GuardianNotAccepted;
import com.eu.habbo.threading.runnables.GuardianVotingFinish;
import gnu.trove.map.hash.THashMap;
+import lombok.Getter;
import java.util.ArrayList;
import java.util.Collections;
@@ -18,16 +19,26 @@ import java.util.Date;
import java.util.Map;
public class GuardianTicket {
+ @Getter
private final THashMap votes = new THashMap<>();
+ @Getter
private final Habbo reporter;
+ @Getter
private final Habbo reported;
+ @Getter
private final Date date;
+ @Getter
private final ArrayList chatLogs;
+ @Getter
private GuardianVoteType verdict;
+ @Getter
private int timeLeft = 120;
+ @Getter
private int resendCount = 0;
- private int checkSum = 0;
- private int guardianCount = 0; //TODO: Figure out what this was supposed to do.
+ @Getter
+ private final int checkSum = 0;
+ @Getter
+ private final int guardianCount = 0; //TODO: Figure out what this was supposed to do.
public GuardianTicket(Habbo reporter, Habbo reported, ArrayList chatLogs) {
this.chatLogs = chatLogs;
@@ -185,46 +196,6 @@ public class GuardianTicket {
return this.votes.get(guardian);
}
- public THashMap getVotes() {
- return this.votes;
- }
-
- public int getTimeLeft() {
- return this.timeLeft;
- }
-
- public GuardianVoteType getVerdict() {
- return this.verdict;
- }
-
- public ArrayList getChatLogs() {
- return this.chatLogs;
- }
-
- public int getResendCount() {
- return this.resendCount;
- }
-
- public int getCheckSum() {
- return this.checkSum;
- }
-
- public Habbo getReporter() {
- return this.reporter;
- }
-
- public Habbo getReported() {
- return this.reported;
- }
-
- public Date getDate() {
- return this.date;
- }
-
- public int getGuardianCount() {
- return this.guardianCount;
- }
-
public ArrayList getSortedVotes(Habbo guardian) {
synchronized (this.votes) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/guides/GuardianVoteType.java b/src/main/java/com/eu/habbo/habbohotel/guides/GuardianVoteType.java
index 68d93ae3..f005c0f2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guides/GuardianVoteType.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guides/GuardianVoteType.java
@@ -1,5 +1,9 @@
package com.eu.habbo.habbohotel.guides;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
public enum GuardianVoteType {
FORWARDED(-1),
WAITING(0),
@@ -9,14 +13,7 @@ public enum GuardianVoteType {
NOT_VOTED(4),
SEARCHING(5);
+ @Getter
private final int type;
- GuardianVoteType(int type) {
- this.type = type;
- }
-
- public int getType() {
- return this.type;
- }
-
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guides/GuideChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/guides/GuideChatMessage.java
index 8011fdca..9dd21138 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guides/GuideChatMessage.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guides/GuideChatMessage.java
@@ -1,13 +1,12 @@
package com.eu.habbo.habbohotel.guides;
-public class GuideChatMessage {
- public final int userId;
- public final String message;
- public final int timestamp;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
- public GuideChatMessage(int userId, String message, int timestamp) {
- this.userId = userId;
- this.message = message;
- this.timestamp = timestamp;
- }
+@Getter
+@AllArgsConstructor
+public class GuideChatMessage {
+ private final int userId;
+ private final String message;
+ private final int timestamp;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guides/GuideTour.java b/src/main/java/com/eu/habbo/habbohotel/guides/GuideTour.java
index 8e52be22..2ef42c45 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guides/GuideTour.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guides/GuideTour.java
@@ -4,17 +4,28 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.set.hash.THashSet;
+import lombok.Getter;
+import lombok.Setter;
public class GuideTour {
+ @Getter
private final Habbo noob;
+ @Getter
private final String helpRequest;
private final THashSet sendMessages = new THashSet<>();
private final THashSet declinedHelpers = new THashSet<>();
public int checkSum = 0;
+ @Setter
+ @Getter
private Habbo helper;
+ @Setter
+ @Getter
private int startTime;
+ @Getter
private int endTime;
+ @Getter
private boolean ended;
+ @Getter
private GuideRecommendStatus wouldRecommend = GuideRecommendStatus.UNKNOWN;
public GuideTour(Habbo noob, String helpRequest) {
@@ -29,30 +40,10 @@ public class GuideTour {
//TODO Query messages.
}
- public Habbo getNoob() {
- return this.noob;
- }
-
- public String getHelpRequest() {
- return this.helpRequest;
- }
-
- public Habbo getHelper() {
- return this.helper;
- }
-
- public void setHelper(Habbo helper) {
- this.helper = helper;
- }
-
public void addMessage(GuideChatMessage message) {
this.sendMessages.add(message);
}
- public GuideRecommendStatus getWouldRecommend() {
- return this.wouldRecommend;
- }
-
public void setWouldRecommend(GuideRecommendStatus wouldRecommend) {
this.wouldRecommend = wouldRecommend;
@@ -78,19 +69,4 @@ public class GuideTour {
AchievementManager.progressAchievement(this.noob, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GuideRequester"));
}
- public boolean isEnded() {
- return this.ended;
- }
-
- public int getStartTime() {
- return this.startTime;
- }
-
- public void setStartTime(int startTime) {
- this.startTime = startTime;
- }
-
- public int getEndTime() {
- return this.endTime;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
index d77f6773..4a8d7cf9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/Guild.java
@@ -1,36 +1,65 @@
package com.eu.habbo.habbohotel.guilds;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class Guild implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(Guild.class);
public boolean needsUpdate;
public int lastRequested = Emulator.getIntUnixTimestamp();
+ @Setter
+ @Getter
private int id;
- private int ownerId;
- private String ownerName;
+ @Getter
+ private final int ownerId;
+ @Getter
+ private final String ownerName;
+ @Setter
+ @Getter
private String name;
+ @Setter
+ @Getter
private String description;
- private int roomId;
+ @Getter
+ private final int roomId;
+ @Setter
+ @Getter
private String roomName;
+ @Setter
+ @Getter
private GuildState state;
+ @Setter
+ @Getter
private boolean rights;
+ @Setter
+ @Getter
private int colorOne;
+ @Setter
+ @Getter
private int colorTwo;
+ @Setter
+ @Getter
private String badge;
- private int dateCreated;
+ @Getter
+ private final int dateCreated;
+ @Getter
private int memberCount;
+ @Getter
private int requestCount;
- private boolean forum = false;
+ @Setter
+ private boolean hasForum = false;
+ @Setter
private SettingsState readForum = SettingsState.ADMINS;
+ @Setter
private SettingsState postMessages = SettingsState.ADMINS;
+ @Setter
private SettingsState postThreads = SettingsState.ADMINS;
private SettingsState modForum = SettingsState.ADMINS;
@@ -48,7 +77,7 @@ public class Guild implements Runnable {
this.colorTwo = set.getInt("color_two");
this.badge = set.getString("badge");
this.dateCreated = set.getInt("date_created");
- this.forum = set.getString("forum").equalsIgnoreCase("1");
+ this.hasForum = set.getString("forum").equalsIgnoreCase("1");
this.readForum = SettingsState.valueOf(set.getString("read_forum"));
this.postMessages = SettingsState.valueOf(set.getString("post_messages"));
this.postThreads = SettingsState.valueOf(set.getString("post_threads"));
@@ -94,7 +123,7 @@ public class Guild implements Runnable {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -104,7 +133,7 @@ public class Guild implements Runnable {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE guilds SET name = ?, description = ?, state = ?, rights = ?, color_one = ?, color_two = ?, badge = ?, read_forum = ?, post_messages = ?, post_threads = ?, mod_forum = ?, forum = ? WHERE id = ?")) {
statement.setString(1, this.name);
statement.setString(2, this.description);
- statement.setInt(3, this.state.state);
+ statement.setInt(3, this.state.getState());
statement.setString(4, this.rights ? "1" : "0");
statement.setInt(5, this.colorOne);
statement.setInt(6, this.colorTwo);
@@ -113,109 +142,17 @@ public class Guild implements Runnable {
statement.setString(9, this.postMessages.name());
statement.setString(10, this.postThreads.name());
statement.setString(11, this.modForum.name());
- statement.setString(12, this.forum ? "1" : "0");
+ statement.setString(12, this.hasForum ? "1" : "0");
statement.setInt(13, this.id);
statement.execute();
this.needsUpdate = false;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
- public int getId() {
- return this.id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getOwnerName() {
- return this.ownerName;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public int getRoomId() {
- return this.roomId;
- }
-
- public String getRoomName() {
- return this.roomName;
- }
-
- public void setRoomName(String roomName) {
- this.roomName = roomName;
- }
-
- public GuildState getState() {
- return this.state;
- }
-
- public void setState(GuildState state) {
- this.state = state;
- }
-
- public boolean getRights() {
- return this.rights;
- }
-
- public void setRights(boolean rights) {
- this.rights = rights;
- }
-
- public int getColorOne() {
- return this.colorOne;
- }
-
- public void setColorOne(int colorOne) {
- this.colorOne = colorOne;
- }
-
- public int getColorTwo() {
- return this.colorTwo;
- }
-
- public void setColorTwo(int colorTwo) {
- this.colorTwo = colorTwo;
- }
-
- public String getBadge() {
- return this.badge;
- }
-
- public void setBadge(String badge) {
- this.badge = badge;
- }
-
- public int getOwnerId() {
- return this.ownerId;
- }
-
- public int getDateCreated() {
- return dateCreated;
- }
-
- public int getMemberCount() {
- return this.memberCount;
- }
-
public void increaseMemberCount() {
this.memberCount++;
}
@@ -224,10 +161,6 @@ public class Guild implements Runnable {
this.memberCount--;
}
- public int getRequestCount() {
- return this.requestCount;
- }
-
public void increaseRequestCount() {
this.requestCount++;
}
@@ -237,37 +170,21 @@ public class Guild implements Runnable {
}
public boolean hasForum() {
- return this.forum;
- }
-
- public void setForum(boolean forum) {
- this.forum = forum;
+ return this.hasForum;
}
public SettingsState canReadForum() {
return this.readForum;
}
- public void setReadForum(SettingsState readForum) {
- this.readForum = readForum;
- }
-
public SettingsState canPostMessages() {
return this.postMessages;
}
- public void setPostMessages(SettingsState postMessages) {
- this.postMessages = postMessages;
- }
-
public SettingsState canPostThreads() {
return this.postThreads;
}
- public void setPostThreads(SettingsState postThreads) {
- this.postThreads = postThreads;
- }
-
public SettingsState canModForum() {
return this.modForum;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
index b93c75de..d23dfc5b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java
@@ -13,17 +13,15 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
+@Slf4j
public class GuildManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(GuildManager.class);
-
private final THashMap> guildParts;
private final TIntObjectMap guilds;
@@ -32,13 +30,13 @@ public class GuildManager {
public GuildManager() {
long millis = System.currentTimeMillis();
- this.guildParts = new THashMap>();
- this.guilds = TCollections.synchronizedMap(new TIntObjectHashMap());
+ this.guildParts = new THashMap<>();
+ this.guilds = TCollections.synchronizedMap(new TIntObjectHashMap<>());
this.loadGuildParts();
this.loadGuildViews();
- LOGGER.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ log.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
@@ -56,7 +54,7 @@ public class GuildManager {
this.guildParts.get(GuildPartType.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new GuildPart(set));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -70,7 +68,7 @@ public class GuildManager {
this.views.add(new ForumView(set));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -111,7 +109,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
habbo.getHabboStats().addGuild(guild.getId());
@@ -129,8 +127,8 @@ public class GuildManager {
if (habbo != null) {
habbo.getHabboStats().removeGuild(guild.getId());
- if (habbo.getHabboStats().guild == guild.getId()) {
- habbo.getHabboStats().guild = 0;
+ if (habbo.getHabboStats().getGuild() == guild.getId()) {
+ habbo.getHabboStats().setGuild(0);
}
}
}
@@ -156,16 +154,16 @@ public class GuildManager {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(guild.getRoomId());
if (room != null) {
- room.setGuild(0);
+ room.setGuildId(0);
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
public void clearInactiveGuilds() {
- List toRemove = new ArrayList();
+ List toRemove = new ArrayList<>();
TIntObjectIterator guilds = this.guilds.iterator();
for (int i = this.guilds.size(); i-- > 0; ) {
try {
@@ -256,13 +254,13 @@ public class GuildManager {
statement.setInt(1, guild.getId());
statement.setInt(2, client.getHabbo().getHabboInfo().getId());
statement.setInt(3, Emulator.getIntUnixTimestamp());
- statement.setInt(4, guild.getState() == GuildState.EXCLUSIVE ? GuildRank.REQUESTED.type : GuildRank.MEMBER.type);
+ statement.setInt(4, guild.getState() == GuildState.EXCLUSIVE ? GuildRank.REQUESTED.getType() : GuildRank.MEMBER.getType());
statement.execute();
}
}
} else if (!error) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE guilds_members SET level_id = ?, member_since = ? WHERE user_id = ? AND guild_id = ?")) {
- statement.setInt(1, GuildRank.MEMBER.type);
+ statement.setInt(1, GuildRank.MEMBER.getType());
statement.setInt(2, Emulator.getIntUnixTimestamp());
statement.setInt(3, userId);
statement.setInt(4, guild.getId());
@@ -280,7 +278,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return !error;
@@ -294,7 +292,7 @@ public class GuildManager {
statement.setInt(3, guild.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -309,7 +307,7 @@ public class GuildManager {
statement.setInt(3, guild.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -320,9 +318,9 @@ public class GuildManager {
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
- if (habbo != null && habbo.getHabboStats().guild == guild.getId()) {
+ if (habbo != null && habbo.getHabboStats().getGuild() == guild.getId()) {
habbo.getHabboStats().removeGuild(guild.getId());
- habbo.getHabboStats().guild = 0;
+ habbo.getHabboStats().setGuild(0);
habbo.getHabboStats().run();
}
@@ -331,7 +329,7 @@ public class GuildManager {
statement.setInt(2, guild.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -358,7 +356,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return member;
@@ -371,7 +369,7 @@ public class GuildManager {
THashSet getGuildMembers(Guild guild) {
- THashSet guildMembers = new THashSet();
+ THashSet guildMembers = new THashSet<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.look, guilds_members.* FROM guilds_members INNER JOIN users ON guilds_members.user_id = users.id WHERE guilds_members.guild_id = ?")) {
statement.setInt(1, guild.getId());
@@ -381,7 +379,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return guildMembers;
@@ -389,7 +387,7 @@ public class GuildManager {
public ArrayList getGuildMembers(Guild guild, int page, int levelId, String query) {
- ArrayList guildMembers = new ArrayList();
+ ArrayList guildMembers = new ArrayList<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.look, guilds_members.* FROM guilds_members INNER JOIN users ON guilds_members.user_id = users.id WHERE guilds_members.guild_id = ? " + (rankQuery(levelId)) + " AND users.username LIKE ? ORDER BY level_id, member_since ASC LIMIT ?, ?")) {
statement.setInt(1, guild.getId());
@@ -403,14 +401,13 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return guildMembers;
}
- public int getGuildMembersCount(Guild guild, int page, int levelId, String query) {
- ArrayList guildMembers = new ArrayList();
+ public int getGuildMembersCount(Guild guild, int levelId, String query) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) FROM guilds_members INNER JOIN users ON guilds_members.user_id = users.id WHERE guilds_members.guild_id = ? " + (rankQuery(levelId)) + " AND users.username LIKE ? ORDER BY level_id, member_since ASC")) {
statement.setInt(1, guild.getId());
@@ -422,7 +419,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return 0;
@@ -430,7 +427,7 @@ public class GuildManager {
public THashMap getOnlyAdmins(Guild guild) {
- THashMap guildAdmins = new THashMap();
+ THashMap guildAdmins = new THashMap<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.look, guilds_members.* FROM guilds_members INNER JOIN users ON guilds_members.user_id = users.id WHERE guilds_members.guild_id = ? " + (rankQuery(1)))) {
statement.setInt(1, guild.getId());
@@ -440,21 +437,18 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return guildAdmins;
}
private String rankQuery(int level) {
- switch (level) {
- case 2:
- return "AND guilds_members.level_id = 3";
- case 1:
- return "AND (guilds_members.level_id = 0 OR guilds_members.level_id = 1)";
- default:
- return "AND guilds_members.level_id >= 0 AND guilds_members.level_id <= 2";
- }
+ return switch (level) {
+ case 2 -> "AND guilds_members.level_id = 3";
+ case 1 -> "AND (guilds_members.level_id = 0 OR guilds_members.level_id = 1)";
+ default -> "AND guilds_members.level_id >= 0 AND guilds_members.level_id <= 2";
+ };
}
@@ -472,7 +466,7 @@ public class GuildManager {
if (g != null)
g.loadMemberCount();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -486,7 +480,7 @@ public class GuildManager {
}
public List getGuilds(int userId) {
- List guilds = new ArrayList();
+ List guilds = new ArrayList<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT guild_id FROM guilds_members WHERE user_id = ? AND level_id <= 2 ORDER BY member_since ASC")) {
statement.setInt(1, userId);
@@ -500,14 +494,14 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return guilds;
}
public List getAllGuilds() {
- List guilds = new ArrayList();
+ List guilds = new ArrayList<>();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT id FROM guilds ORDER BY id DESC LIMIT 20")) {
try (ResultSet set = statement.executeQuery()) {
@@ -520,7 +514,7 @@ public class GuildManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return guilds;
@@ -528,7 +522,7 @@ public class GuildManager {
public boolean symbolColor(int colorId) {
for (GuildPart part : this.getSymbolColors()) {
- if (part.id == colorId)
+ if (part.getId() == colorId)
return true;
}
@@ -537,7 +531,7 @@ public class GuildManager {
public boolean backgroundColor(int colorId) {
for (GuildPart part : this.getBackgroundColors()) {
- if (part.id == colorId)
+ if (part.getId() == colorId)
return true;
}
return false;
@@ -599,7 +593,7 @@ public class GuildManager {
statement.setInt(2, furni.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -614,7 +608,7 @@ public class GuildManager {
guildIterator.remove();
}
- LOGGER.info("Guild Manager -> Disposed!");
+ log.info("Guild Manager -> Disposed!");
}
public boolean hasViewedForum(int userId, int guildId) {
@@ -634,7 +628,7 @@ public class GuildManager {
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java
index 5b0d9ee3..143aaa6a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMember.java
@@ -1,13 +1,24 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.Getter;
+import lombok.Setter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
public class GuildMember implements Comparable {
+ @Getter
private final int userId;
+ @Getter
private final String username;
+ @Getter
+ @Setter
private String look;
+ @Getter
+ @Setter
private int joinDate;
+ @Setter
+ @Getter
private GuildRank rank;
public GuildMember(ResultSet set) throws SQLException {
@@ -26,38 +37,6 @@ public class GuildMember implements Comparable {
this.rank = GuildRank.values()[guildRank];
}
- public int getUserId() {
- return userId;
- }
-
- public String getUsername() {
- return username;
- }
-
- public String getLook() {
- return look;
- }
-
- public void setLook(String look) {
- this.look = look;
- }
-
- public int getJoinDate() {
- return joinDate;
- }
-
- public void setJoinDate(int joinDate) {
- this.joinDate = joinDate;
- }
-
- public GuildRank getRank() {
- return rank;
- }
-
- public void setRank(GuildRank rank) {
- this.rank = rank;
- }
-
@Override
public int compareTo(GuildMember o) {
return this.userId - o.userId;
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMembershipStatus.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMembershipStatus.java
index e6cb38f7..8dff47de 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMembershipStatus.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildMembershipStatus.java
@@ -1,17 +1,15 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
public enum GuildMembershipStatus {
NOT_MEMBER(0),
MEMBER(1),
PENDING(2);
- private int status;
+ @Getter
+ private final int status;
- GuildMembershipStatus(int status) {
- this.status = status;
- }
-
- public int getStatus() {
- return status;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildPart.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildPart.java
index 2595c37d..270edd75 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildPart.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildPart.java
@@ -1,17 +1,17 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
+@Getter
public class GuildPart {
+ private final int id;
- public final int id;
+ private final String valueA;
-
- public final String valueA;
-
-
- public final String valueB;
+ private final String valueB;
public GuildPart(ResultSet set) throws SQLException {
this.id = set.getInt("id");
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java
index a7afa1b1..127e7752 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java
@@ -1,5 +1,10 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum GuildRank {
OWNER(0),
ADMIN(1),
@@ -7,11 +12,7 @@ public enum GuildRank {
REQUESTED(3),
DELETED(4);
- public final int type;
-
- GuildRank(int type) {
- this.type = type;
- }
+ private final int type;
public static GuildRank getRank(int type) {
try {
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildState.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildState.java
index 7fcd74eb..f28fc87f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildState.java
@@ -1,5 +1,10 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum GuildState {
OPEN(0),
EXCLUSIVE(1),
@@ -7,11 +12,8 @@ public enum GuildState {
LARGE(3),
LARGE_CLOSED(4);
- public final int state;
+ private final int state;
- GuildState(int state) {
- this.state = state;
- }
public static GuildState valueOf(int state) {
try {
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/SettingsState.java b/src/main/java/com/eu/habbo/habbohotel/guilds/SettingsState.java
index 146606d3..0582eeed 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/SettingsState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/SettingsState.java
@@ -1,16 +1,17 @@
package com.eu.habbo.habbohotel.guilds;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum SettingsState {
EVERYONE(0),
MEMBERS(1),
ADMINS(2),
OWNER(3);
- public final int state;
-
- SettingsState(int state) {
- this.state = state;
- }
+ private final int state;
public static SettingsState fromValue(int state) {
try {
@@ -24,7 +25,7 @@ public enum SettingsState {
case 3:
return OWNER;
}
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
return EVERYONE;
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
index a65eb87b..64eb975a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThread.java
@@ -9,33 +9,48 @@ import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCreated;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.*;
+@Slf4j
+
public class ForumThread implements Runnable, ISerialize {
- private static final Logger LOGGER = LoggerFactory.getLogger(ForumThread.class);
private final static THashMap> guildThreadsCache = new THashMap<>();
private final static THashMap forumThreadsCache = new THashMap<>();
+ @Getter
private final int threadId;
+ @Getter
private final int guildId;
+ @Getter
private final int openerId;
+ @Getter
private final String subject;
+ @Getter
private final int createdAt;
private final THashMap comments;
+ @Getter
private int postsCount;
+ @Getter
private int updatedAt;
+ @Getter
private ForumThreadState state;
+ @Getter
private boolean pinned;
+ @Getter
private boolean locked;
+ @Getter
private int adminId;
private boolean needsUpdate;
private boolean hasCommentsLoaded;
private int commentIndex;
+ @Setter
+ @Getter
private ForumThreadComment lastComment;
public ForumThread(int threadId, int guildId, int openerId, String subject, int postsCount, int createdAt, int updatedAt, ForumThreadState state, boolean pinned, boolean locked, int adminId, ForumThreadComment lastComment) {
@@ -74,7 +89,7 @@ public class ForumThread implements Runnable, ISerialize {
try {
this.lastComment = ForumThreadComment.getById(set.getInt("last_comment_id"));
} catch (SQLException e) {
- LOGGER.error("ForumThread last_comment_id exception", e);
+ log.error("ForumThread last_comment_id exception", e);
}
this.comments = new THashMap<>();
@@ -113,7 +128,7 @@ public class ForumThread implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCreated(createdThread));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return createdThread;
@@ -159,7 +174,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return threads;
@@ -184,7 +199,7 @@ public class ForumThread implements Runnable, ISerialize {
"ORDER BY B.`id` " +
") " +
"ORDER BY `id` DESC " +
- ") B ON A.`id` = B.`thread_id` " +
+ ") B ON A.`iód` = B.`thread_id` " +
"WHERE A.`id` = ? " +
"ORDER BY A.`pinned` DESC, B.`created_at` DESC " +
"LIMIT 1"
@@ -198,7 +213,7 @@ public class ForumThread implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return foundThread;
@@ -236,88 +251,36 @@ public class ForumThread implements Runnable, ISerialize {
}
}
- public int getThreadId() {
- return threadId;
- }
-
- public int getGuildId() {
- return guildId;
- }
-
- public int getOpenerId() {
- return openerId;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public int getCreatedAt() {
- return createdAt;
- }
-
- public int getPostsCount() {
- return postsCount;
- }
-
public void setPostsCount(int postsCount) {
this.postsCount = postsCount;
this.needsUpdate = true;
}
- public int getUpdatedAt() {
- return updatedAt;
- }
-
public void setUpdatedAt(int updatedAt) {
this.updatedAt = updatedAt;
this.needsUpdate = true;
}
- public ForumThreadState getState() {
- return state;
- }
-
public void setState(ForumThreadState state) {
this.state = state;
this.needsUpdate = true;
}
- public boolean isPinned() {
- return pinned;
- }
-
public void setPinned(boolean pinned) {
this.pinned = pinned;
this.needsUpdate = true;
}
- public boolean isLocked() {
- return locked;
- }
-
public void setLocked(boolean locked) {
this.locked = locked;
this.needsUpdate = true;
}
- public int getAdminId() {
- return adminId;
- }
-
public void setAdminId(int adminId) {
this.adminId = adminId;
this.needsUpdate = true;
}
- public ForumThreadComment getLastComment() {
- return lastComment;
- }
-
- public void setLastComment(ForumThreadComment lastComment) {
- this.lastComment = lastComment;
- }
-
private void loadComments() {
if (this.hasCommentsLoaded)
return;
@@ -337,7 +300,7 @@ public class ForumThread implements Runnable, ISerialize {
addComment(comment);
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
@@ -461,7 +424,7 @@ public class ForumThread implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
index 1be9631a..507ad8ef 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadComment.java
@@ -8,24 +8,34 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentBeforeCreated;
import com.eu.habbo.plugin.events.guilds.forums.GuildForumThreadCommentCreated;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.*;
+@Slf4j
public class ForumThreadComment implements Runnable, ISerialize {
- private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class);
- private static THashMap forumCommentsCache = new THashMap<>();
+ private static final THashMap forumCommentsCache = new THashMap<>();
+ @Getter
private final int commentId;
+ @Getter
private final int threadId;
+ @Getter
private final int userId;
+ @Getter
private final String message;
+ @Getter
private final int createdAt;
+ @Getter
private ForumThreadState state;
+ @Getter
private int adminId;
- private int index;
- private boolean needsUpdate;
+ @Setter
+ @Getter
+ private int index = -1;
+ private boolean needsUpdate = false;
public ForumThreadComment(int commentId, int threadId, int userId, String message, int createdAt, ForumThreadState state, int adminId) {
this.commentId = commentId;
@@ -35,8 +45,6 @@ public class ForumThreadComment implements Runnable, ISerialize {
this.createdAt = createdAt;
this.state = state;
this.adminId = adminId;
- this.index = -1;
- this.needsUpdate = false;
}
public ForumThreadComment(ResultSet set) throws SQLException {
@@ -67,7 +75,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return foundComment;
@@ -106,58 +114,22 @@ public class ForumThreadComment implements Runnable, ISerialize {
Emulator.getPluginManager().fireEvent(new GuildForumThreadCommentCreated(createdComment));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return createdComment;
}
- public int getCommentId() {
- return commentId;
- }
-
- public int getThreadId() {
- return threadId;
- }
-
- public int getUserId() {
- return userId;
- }
-
- public String getMessage() {
- return message;
- }
-
- public int getCreatedAt() {
- return createdAt;
- }
-
- public ForumThreadState getState() {
- return state;
- }
-
public void setState(ForumThreadState state) {
this.state = state;
this.needsUpdate = true;
}
- public int getAdminId() {
- return adminId;
- }
-
public void setAdminId(int adminId) {
this.adminId = adminId;
this.needsUpdate = true;
}
- public int getIndex() {
- return index;
- }
-
- public void setIndex(int index) {
- this.index = index;
- }
-
public Habbo getHabbo() {
return Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId);
}
@@ -187,7 +159,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
message.appendInt(this.adminId);
message.appendString(admin != null ? admin.getUsername() : "");
message.appendInt(0); // admin action time ago?
- message.appendInt(habbo != null ? habbo.getHabboStats().forumPostsCount : 0);
+ message.appendInt(habbo != null ? habbo.getHabboStats().getForumPostsCount() : 0);
}
@Override
@@ -203,7 +175,7 @@ public class ForumThreadComment implements Runnable, ISerialize {
this.needsUpdate = false;
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadState.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadState.java
index 2e57039e..a089209f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumThreadState.java
@@ -1,16 +1,18 @@
package com.eu.habbo.habbohotel.guilds.forums;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
public enum ForumThreadState {
OPEN(0),
CLOSED(1),
HIDDEN_BY_STAFF_MEMBER(10),
HIDDEN_BY_GUILD_ADMIN(20);
+ @Getter
private int stateId;
- ForumThreadState(int stateId) {
- this.stateId = stateId;
- }
public static ForumThreadState fromValue(int value) {
for (ForumThreadState state : ForumThreadState.values()) {
@@ -22,7 +24,4 @@ public enum ForumThreadState {
return CLOSED;
}
- public int getStateId() {
- return this.stateId;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumView.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumView.java
index c1b2569e..66dba2ef 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumView.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/ForumView.java
@@ -1,34 +1,24 @@
package com.eu.habbo.habbohotel.guilds.forums;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
+@AllArgsConstructor
public class ForumView {
+ @Getter
private final int userId;
+ @Getter
private final int guildId;
+ @Getter
private final int timestamp;
- public ForumView(int userId, int guildId, int timestamp) {
- this.userId = userId;
- this.guildId = guildId;
- this.timestamp = timestamp;
- }
-
public ForumView(ResultSet set) throws SQLException {
this.userId = set.getInt("user_id");
this.guildId = set.getInt("guild_id");
this.timestamp = set.getInt("timestamp");
}
- public int getUserId() {
- return userId;
- }
-
- public int getGuildId() {
- return guildId;
- }
-
- public int getTimestamp() {
- return timestamp;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
index a4c398b8..81b5d187 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFame.java
@@ -2,20 +2,23 @@ package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+@Slf4j
public class HallOfFame {
- private static final Logger LOGGER = LoggerFactory.getLogger(HallOfFame.class);
-
+ @Getter
private final THashMap winners = new THashMap<>();
+ @Getter
+ @Setter
private String competitionName;
public HallOfFame() {
@@ -35,20 +38,9 @@ public class HallOfFame {
this.winners.put(winner.getId(), winner);
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
- public THashMap getWinners() {
- return this.winners;
- }
-
- public String getCompetitionName() {
- return this.competitionName;
- }
-
- void setCompetitionName(String name) {
- this.competitionName = name;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
index 998de6f2..6b6568bf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HallOfFameWinner.java
@@ -1,20 +1,19 @@
package com.eu.habbo.habbohotel.hotelview;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
public class HallOfFameWinner implements Comparable {
-
- private int id;
-
-
- private String username;
-
-
- private String look;
-
-
- private int points;
+ @Getter
+ private final int id;
+ @Getter
+ private final String username;
+ @Getter
+ private final String look;
+ @Getter
+ private final int points;
public HallOfFameWinner(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -24,25 +23,6 @@ public class HallOfFameWinner implements Comparable {
}
- public int getId() {
- return this.id;
- }
-
-
- public String getUsername() {
- return this.username;
- }
-
-
- public String getLook() {
- return this.look;
- }
-
-
- public int getPoints() {
- return this.points;
- }
-
@Override
public int compareTo(HallOfFameWinner o) {
return o.getPoints() - this.points;
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
index 81048f3b..94414cfd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/HotelViewManager.java
@@ -1,13 +1,14 @@
package com.eu.habbo.habbohotel.hotelview;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class HotelViewManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(HotelViewManager.class);
-
+ @Getter
private final HallOfFame hallOfFame;
+ @Getter
private final NewsList newsList;
public HotelViewManager() {
@@ -15,19 +16,11 @@ public class HotelViewManager {
this.hallOfFame = new HallOfFame();
this.newsList = new NewsList();
- LOGGER.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
- }
-
- public HallOfFame getHallOfFame() {
- return this.hallOfFame;
- }
-
- public NewsList getNewsList() {
- return this.newsList;
+ log.info("Hotelview Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public void dispose() {
- LOGGER.info("HotelView Manager -> Disposed!");
+ log.info("HotelView Manager -> Disposed!");
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
index b3bebc4f..6a2bfa35 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
@@ -1,18 +1,15 @@
package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
-
+@Slf4j
public class NewsList {
- private static final Logger LOGGER = LoggerFactory.getLogger(NewsList.class);
-
private final ArrayList newsWidgets;
public NewsList() {
@@ -29,7 +26,7 @@ public class NewsList {
this.newsWidgets.add(new NewsWidget(set));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsWidget.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsWidget.java
index bb309763..17e353b6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsWidget.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsWidget.java
@@ -1,29 +1,31 @@
package com.eu.habbo.habbohotel.hotelview;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
public class NewsWidget {
+ @Getter
+ private final int id;
- private int id;
+ @Getter
+ private final String title;
+ @Getter
+ private final String message;
- private String title;
+ @Getter
+ private final String buttonMessage;
+ @Getter
+ private final int type;
- private String message;
+ @Getter
+ private final String link;
-
- private String buttonMessage;
-
-
- private int type;
-
-
- private String link;
-
-
- private String image;
+ @Getter
+ private final String image;
public NewsWidget(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -34,39 +36,4 @@ public class NewsWidget {
this.link = set.getString("button_link");
this.image = set.getString("image");
}
-
-
- public int getId() {
- return this.id;
- }
-
-
- public String getTitle() {
- return this.title;
- }
-
-
- public String getMessage() {
- return this.message;
- }
-
-
- public String getButtonMessage() {
- return this.buttonMessage;
- }
-
-
- public int getType() {
- return this.type;
- }
-
-
- public String getLink() {
- return this.link;
- }
-
-
- public String getImage() {
- return this.image;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
index 60497794..ae983cb2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java
@@ -1,8 +1,8 @@
package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -10,18 +10,18 @@ import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
+@Slf4j
+@Getter
public class CrackableReward {
- private static final Logger LOGGER = LoggerFactory.getLogger(CrackableReward.class);
-
- public final int itemId;
- public final int count;
- public final Map> prizes;
- public final String achievementTick;
- public final String achievementCracked;
- public final int requiredEffect;
- public final int subscriptionDuration;
- public final RedeemableSubscriptionType subscriptionType;
- public int totalChance;
+ private final int itemId;
+ private final int count;
+ private final Map> prizes;
+ private final String achievementTick;
+ private final String achievementCracked;
+ private final int requiredEffect;
+ private final int subscriptionDuration;
+ private final RedeemableSubscriptionType subscriptionType;
+ private int totalChance;
public CrackableReward(ResultSet set) throws SQLException {
this.itemId = set.getInt("item_id");
@@ -45,18 +45,18 @@ public class CrackableReward {
int chance = 100;
if (prize.contains(":") && prize.split(":").length == 2) {
- itemId = Integer.valueOf(prize.split(":")[0]);
- chance = Integer.valueOf(prize.split(":")[1]);
+ itemId = Integer.parseInt(prize.split(":")[0]);
+ chance = Integer.parseInt(prize.split(":")[1]);
} else if (prize.contains(":")) {
- LOGGER.error("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
+ log.error("Invalid configuration of crackable prizes (item id: " + this.itemId + "). '" + prize + "' format should be itemId:chance.");
} else {
- itemId = Integer.valueOf(prize.replace(":", ""));
+ itemId = Integer.parseInt(prize.replace(":", ""));
}
this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));
this.totalChance += chance;
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/FurnitureType.java b/src/main/java/com/eu/habbo/habbohotel/items/FurnitureType.java
index f22fc5bf..0a74151a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/FurnitureType.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/FurnitureType.java
@@ -1,5 +1,10 @@
package com.eu.habbo.habbohotel.items;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum FurnitureType {
FLOOR("S"),
WALL("I"),
@@ -11,29 +16,17 @@ public enum FurnitureType {
public final String code;
- FurnitureType(String code) {
- this.code = code;
- }
-
public static FurnitureType fromString(String code) {
- switch (code.toUpperCase()) {
- case "S":
- return FLOOR;
- case "I":
- return WALL;
- case "E":
- return EFFECT;
- case "B":
- return BADGE;
- case "R":
- return ROBOT;
- case "H":
- return HABBO_CLUB;
- case "P":
- return PET;
- default:
- return FLOOR;
- }
+ return switch (code.toUpperCase()) {
+ case "S" -> FLOOR;
+ case "I" -> WALL;
+ case "E" -> EFFECT;
+ case "B" -> BADGE;
+ case "R" -> ROBOT;
+ case "H" -> HABBO_CLUB;
+ case "P" -> PET;
+ default -> FLOOR;
+ };
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/Item.java b/src/main/java/com/eu/habbo/habbohotel/items/Item.java
index 11d19294..bfb3c6a7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/Item.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/Item.java
@@ -6,19 +6,28 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.list.array.TIntArrayList;
+import lombok.Getter;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Item implements ISerialize {
+ @Getter
private int id;
+ @Getter
private int spriteId;
+ @Getter
private String name;
+ @Getter
private String fullName;
+ @Getter
private FurnitureType type;
+ @Getter
private short width;
+ @Getter
private short length;
+ @Getter
private double height;
private boolean allowStack;
private boolean allowWalk;
@@ -29,15 +38,24 @@ public class Item implements ISerialize {
private boolean allowMarketplace;
private boolean allowGift;
private boolean allowInventoryStack;
+ @Getter
private short stateCount;
+ @Getter
private short effectM;
+ @Getter
private short effectF;
+ @Getter
private TIntArrayList vendingItems;
+ @Getter
private double[] multiHeights;
+ @Getter
private String customParams;
+ @Getter
private String clothingOnWalk;
+ @Getter
private ItemInteraction interactionType;
+ @Getter
private int rotations;
public Item(ResultSet set) throws SQLException {
@@ -55,9 +73,9 @@ public class Item implements ISerialize {
}
try {
- int index = Integer.valueOf(item.getExtradata()) % (item.getBaseItem().getMultiHeights().length);
+ int index = Integer.parseInt(item.getExtradata()) % (item.getBaseItem().getMultiHeights().length);
return item.getBaseItem().getMultiHeights()[(item.getExtradata().isEmpty() ? 0 : index)];
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException ignored) {
}
}
@@ -103,7 +121,7 @@ public class Item implements ISerialize {
this.vendingItems = new TIntArrayList();
String[] vendingIds = set.getString("vending_ids").replace(";", ",").split(",");
for (String s : vendingIds) {
- this.vendingItems.add(Integer.valueOf(s.replace(" ", "")));
+ this.vendingItems.add(Integer.parseInt(s.replace(" ", "")));
}
}
@@ -129,38 +147,6 @@ public class Item implements ISerialize {
catch (SQLException ignored) { }
}
- public int getId() {
- return this.id;
- }
-
- public int getSpriteId() {
- return this.spriteId;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getFullName() {
- return this.fullName;
- }
-
- public FurnitureType getType() {
- return this.type;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getLength() {
- return this.length;
- }
-
- public double getHeight() {
- return this.height;
- }
-
public boolean allowStack() {
return this.allowStack;
}
@@ -197,44 +183,10 @@ public class Item implements ISerialize {
return this.allowInventoryStack;
}
- public int getStateCount() {
- return this.stateCount;
- }
-
- public int getEffectM() {
- return this.effectM;
- }
-
- public int getEffectF() {
- return this.effectF;
- }
-
- public ItemInteraction getInteractionType() {
- return this.interactionType;
- }
-
- public TIntArrayList getVendingItems() {
- return this.vendingItems;
- }
-
public int getRandomVendingItem() {
return this.vendingItems.get(Emulator.getRandom().nextInt(this.vendingItems.size()));
}
- public double[] getMultiHeights() {
- return this.multiHeights;
- }
-
- public String getCustomParams() {
- return customParams;
- }
-
- public String getClothingOnWalk() { return clothingOnWalk; }
-
- public int getRotations() {
- return rotations;
- }
-
@Override
public void serialize(ServerMessage message) {
message.appendString(this.type.code.toLowerCase());
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemInteraction.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemInteraction.java
index 2e07ba22..fd32de85 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/ItemInteraction.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemInteraction.java
@@ -1,24 +1,13 @@
package com.eu.habbo.habbohotel.items;
import com.eu.habbo.habbohotel.users.HabboItem;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+@AllArgsConstructor
public class ItemInteraction {
+ @Getter
private final String name;
+ @Getter
private final Class extends HabboItem> type;
-
-
- public ItemInteraction(String name, Class extends HabboItem> type) {
- this.name = name;
- this.type = type;
- }
-
-
- public Class extends HabboItem> getType() {
- return this.type;
- }
-
-
- public String getName() {
- return this.name;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
index 52d85647..01eb1c77 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java
@@ -3,7 +3,10 @@ package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
-import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.*;
+import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiPuck;
+import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiSphere;
+import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTeleporter;
+import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTile;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateBlue;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateGreen;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateRed;
@@ -47,10 +50,10 @@ import com.eu.habbo.habbohotel.items.interactions.wired.effects.*;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraRandom;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraUnseen;
-import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager;
import com.eu.habbo.habbohotel.items.interactions.wired.triggers.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
+import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
@@ -60,20 +63,20 @@ import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Constructor;
import java.sql.*;
import java.util.*;
+@Slf4j
public class ItemManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(ItemManager.class);
-
//Configuration. Loaded from database & updated accordingly.
public static boolean RECYCLER_ENABLED = true;
+ @Getter
private final TIntObjectMap
- items;
private final TIntObjectHashMap crackableRewards;
private final THashSet interactionsList;
@@ -105,7 +108,7 @@ public class ItemManager {
this.highscoreManager.load();
this.loadNewUserGifts();
- LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ log.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
protected void loadItemInteractions() {
@@ -364,7 +367,7 @@ public class ItemManager {
return interaction;
}
- LOGGER.debug("Can't find interaction class: {}", type.getName());
+ log.debug("Can't find interaction class: {}", type.getName());
return this.getItemInteraction(InteractionDefault.class);
}
@@ -394,12 +397,12 @@ public class ItemManager {
else
this.items.get(id).update(set);
} catch (Exception e) {
- LOGGER.error("Failed to load Item ({})", set.getInt("id"));
- LOGGER.error("Caught exception", e);
+ log.error("Failed to load Item ({})", set.getInt("id"));
+ log.error("Caught exception", e);
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -412,23 +415,23 @@ public class ItemManager {
try {
reward = new CrackableReward(set);
} catch (Exception e) {
- LOGGER.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
- LOGGER.error("Caught exception", e);
+ log.error("Failed to load items_crackable item_id = {}", set.getInt("item_id"));
+ log.error("Caught exception", e);
continue;
}
this.crackableRewards.put(set.getInt("item_id"), reward);
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
public int getCrackableCount(int itemId) {
if (this.crackableRewards.containsKey(itemId))
- return this.crackableRewards.get(itemId).count;
+ return this.crackableRewards.get(itemId).getCount();
else
return 0;
}
@@ -455,7 +458,7 @@ public class ItemManager {
this.soundTracks.put(set.getString("code"), new SoundTrack(set));
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -488,16 +491,16 @@ public class ItemManager {
try {
return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
}
}
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return null;
}
@@ -512,7 +515,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -537,7 +540,7 @@ public class ItemManager {
statement.setInt(1, item.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -555,7 +558,7 @@ public class ItemManager {
try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO items_presents VALUES (?, ?)")) {
while (set.next() && item == null) {
preparedStatement.setInt(1, set.getInt(1));
- preparedStatement.setInt(2, Integer.valueOf(itemId));
+ preparedStatement.setInt(2, Integer.parseInt(itemId));
preparedStatement.addBatch();
item = new InteractionDefault(set.getInt(1), habbo.getHabboInfo().getId(), Emulator.getGameEnvironment().getCatalogManager().ecotronItem, extradata, 0, 0);
}
@@ -564,7 +567,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return item;
@@ -604,9 +607,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return item;
@@ -618,7 +621,7 @@ public class ItemManager {
statement.setInt(2, itemTwoId);
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -628,7 +631,7 @@ public class ItemManager {
statement.setInt(2, hopper.getBaseItem().getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -643,7 +646,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
return a;
@@ -659,9 +662,9 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
return item;
@@ -677,12 +680,12 @@ public class ItemManager {
if (itemClass != null) {
try {
- Constructor c = itemClass.getConstructor(ResultSet.class, Item.class);
+ Constructor extends HabboItem> c = itemClass.getConstructor(ResultSet.class, Item.class);
c.setAccessible(true);
return (HabboItem) c.newInstance(set, baseItem);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -706,7 +709,7 @@ public class ItemManager {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -722,7 +725,7 @@ public class ItemManager {
return null;
if (extraData.length() > 1000) {
- LOGGER.error("Extradata exceeds maximum length of 1000 characters: {}", extraData);
+ log.error("Extradata exceeds maximum length of 1000 characters: {}", extraData);
extraData = extraData.substring(0, 1000);
}
@@ -746,17 +749,13 @@ public class ItemManager {
return this.items.get(itemId);
}
- public TIntObjectMap
- getItems() {
- return this.items;
- }
-
public Item getItem(String itemName) {
TIntObjectIterator
- item = this.items.iterator();
for (int i = this.items.size(); i-- > 0; ) {
try {
item.advance();
- if (item.value().getName().toLowerCase().equals(itemName.toLowerCase())) {
+ if (item.value().getName().equalsIgnoreCase(itemName)) {
return item.value();
}
} catch (NoSuchElementException e) {
@@ -779,7 +778,7 @@ public class ItemManager {
this.items.clear();
this.highscoreManager.dispose();
- LOGGER.info("Item Manager -> Disposed!");
+ log.info("Item Manager -> Disposed!");
}
public List getInteractionList() {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/NewUserGift.java b/src/main/java/com/eu/habbo/habbohotel/items/NewUserGift.java
index 90aff433..eda6da13 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/NewUserGift.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/NewUserGift.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
+import lombok.Getter;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -12,9 +13,13 @@ import java.util.HashMap;
import java.util.Map;
public class NewUserGift implements ISerialize {
+ @Getter
private final int id;
+ @Getter
private final Type type;
+ @Getter
private final String imageUrl;
+ @Getter
private Map items = new HashMap<>();
public NewUserGift(ResultSet set) throws SQLException {
@@ -59,22 +64,6 @@ public class NewUserGift implements ISerialize {
}
}
- public int getId() {
- return this.id;
- }
-
- public Type getType() {
- return this.type;
- }
-
- public String getImageUrl() {
- return this.imageUrl;
- }
-
- public Map getItems() {
- return this.items;
- }
-
public enum Type {
ITEM,
ROOM
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java b/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
index 4822d78b..9e1e335e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/PostItColor.java
@@ -1,26 +1,19 @@
package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+@Getter
+@AllArgsConstructor
public enum PostItColor {
-
BLUE("9CCEFF"),
-
-
GREEN("9CFF9C"),
-
-
PINK("FF9CFF"),
-
-
YELLOW("FFFF33");
public final String hexColor;
- PostItColor(String hexColor) {
- this.hexColor = hexColor;
- }
-
public static boolean isCustomColor(String color) {
for (PostItColor postItColor : PostItColor.values()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java b/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
index bc9662a3..c6a92d37 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/RandomStateParams.java
@@ -1,14 +1,15 @@
package com.eu.habbo.habbohotel.items;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
+@Slf4j
public class RandomStateParams {
- private static final Logger LOGGER = LoggerFactory.getLogger(RandomStateParams.class);
-
+ @Getter
private int states = -1;
+ @Getter
private int delay = -1;
public RandomStateParams(String customparams) throws Exception {
@@ -18,15 +19,9 @@ public class RandomStateParams {
if (keyValue.length != 2) return;
switch (keyValue[0]) {
- case "states":
- this.states = Integer.parseInt(keyValue[1]);
- break;
- case "delay":
- this.delay = Integer.parseInt(keyValue[1]);
- break;
- default:
- LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]);
- break;
+ case "states" -> this.states = Integer.parseInt(keyValue[1]);
+ case "delay" -> this.delay = Integer.parseInt(keyValue[1]);
+ default -> log.warn("RandomStateParams: unknown key: " + keyValue[0]);
}
});
@@ -34,11 +29,4 @@ public class RandomStateParams {
if (this.delay < 0) throw new Exception("RandomStateParams: states not defined");
}
- public int getStates() {
- return states;
- }
-
- public int getDelay() {
- return delay;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/RedeemableSubscriptionType.java b/src/main/java/com/eu/habbo/habbohotel/items/RedeemableSubscriptionType.java
index 6747e7bb..1a416e0b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/RedeemableSubscriptionType.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/RedeemableSubscriptionType.java
@@ -1,25 +1,23 @@
package com.eu.habbo.habbohotel.items;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum RedeemableSubscriptionType {
HABBO_CLUB("hc"),
BUILDERS_CLUB("bc");
-
public final String subscriptionType;
- RedeemableSubscriptionType(String subscriptionType) {
- this.subscriptionType = subscriptionType;
- }
-
public static RedeemableSubscriptionType fromString(String subscriptionType) {
if (subscriptionType == null) return null;
- switch (subscriptionType) {
- case "hc":
- return HABBO_CLUB;
- case "bc":
- return BUILDERS_CLUB;
- }
+ return switch (subscriptionType) {
+ case "hc" -> HABBO_CLUB;
+ case "bc" -> BUILDERS_CLUB;
+ default -> null;
+ };
- return null;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/SoundTrack.java b/src/main/java/com/eu/habbo/habbohotel/items/SoundTrack.java
index 53430c13..d65deb1b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/SoundTrack.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/SoundTrack.java
@@ -1,15 +1,18 @@
package com.eu.habbo.habbohotel.items;
+import lombok.Getter;
+
import java.sql.ResultSet;
import java.sql.SQLException;
+@Getter
public class SoundTrack {
- private int id;
- private String name;
- private String author;
- private String code;
- private String data;
- private int length;
+ private final int id;
+ private final String name;
+ private final String author;
+ private final String code;
+ private final String data;
+ private final int length;
public SoundTrack(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -20,27 +23,5 @@ public class SoundTrack {
this.length = set.getInt("length");
}
- public int getId() {
- return this.id;
- }
- public String getName() {
- return this.name;
- }
-
- public String getAuthor() {
- return this.author;
- }
-
- public String getCode() {
- return this.code;
- }
-
- public String getData() {
- return this.data;
- }
-
- public int getLength() {
- return this.length;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
index 1352f763..02f0308c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/YoutubeManager.java
@@ -6,8 +6,9 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import gnu.trove.map.hash.THashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
@@ -24,56 +25,24 @@ import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-
+@Slf4j
public class YoutubeManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(YoutubeManager.class);
+ @Getter
+ @AllArgsConstructor
public static class YoutubeVideo {
private final String id;
private final int duration;
-
- YoutubeVideo(String id, int duration) {
- this.id = id;
- this.duration = duration;
- }
-
- public String getId() {
- return id;
- }
-
- public int getDuration() {
- return duration;
- }
}
+ @Getter
+ @AllArgsConstructor
public static class YoutubePlaylist {
private final String id;
private final String name;
private final String description;
private final ArrayList videos;
- YoutubePlaylist(String id, String name, String description, ArrayList videos) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.videos = videos;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public ArrayList getVideos() {
- return videos;
- }
}
private final THashMap> playlists = new THashMap<>();
@@ -89,7 +58,7 @@ public class YoutubeManager {
Emulator.getThreading().run(() -> {
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
- LOGGER.info("YouTube Manager -> Loading...");
+ log.info("YouTube Manager -> Loading...");
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
try (ResultSet set = statement.executeQuery()) {
@@ -108,25 +77,25 @@ public class YoutubeManager {
this.addPlaylistToItem(itemId, playlist);
}
} catch (IOException e) {
- LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
+ log.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, e);
}
});
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
youtubeDataLoaderPool.shutdown();
try {
if(!youtubeDataLoaderPool.awaitTermination(60, TimeUnit.SECONDS))
- LOGGER.error("Youtube Manager -> Failed, timeout elapsed before termination!");
+ log.error("Youtube Manager -> Failed, timeout elapsed before termination!");
} catch (InterruptedException e) {
- LOGGER.error("Caught Exception", e);
+ log.error("Caught Exception", e);
Thread.currentThread().interrupt();
- } finally {
- LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
+ }finally {
+ log.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
});
}
@@ -143,7 +112,7 @@ public class YoutubeManager {
BufferedReader playlistBR = new BufferedReader(playlistISR);
JsonObject errorObj = JsonParser.parseReader(playlistBR).getAsJsonObject();
String message = errorObj.get("error").getAsJsonObject().get("message").getAsString();
- LOGGER.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, message);
+ log.error("Failed to load YouTube playlist {} ERROR: {}", playlistId, message);
return null;
}
InputStream playlistInputStream = playlistCon.getInputStream();
@@ -154,7 +123,7 @@ public class YoutubeManager {
JsonArray playlists = playlistData.get("items").getAsJsonArray();
if (playlists.size() == 0) {
- LOGGER.error("Playlist {} not found!", playlistId);
+ log.error("Playlist {} not found!", playlistId);
return null;
}
JsonObject playlistItem = playlists.get(0).getAsJsonObject().get("snippet").getAsJsonObject();
@@ -217,7 +186,7 @@ public class YoutubeManager {
} while (nextPageToken != null);
if (videos.isEmpty()) {
- LOGGER.warn("Playlist {} has no videos!", playlistId);
+ log.warn("Playlist {} has no videos!", playlistId);
return null;
}
playlist = new YoutubePlaylist(playlistId, name, description, videos);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java
index ab6bf36e..072eb40b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java
@@ -28,10 +28,10 @@ public class InteractionBackgroundToner extends HabboItem {
serverMessage.appendInt(4);
if (this.getExtradata().split(":").length == 4) {
String[] colorData = this.getExtradata().split(":");
- serverMessage.appendInt(Integer.valueOf(colorData[0]));
- serverMessage.appendInt(Integer.valueOf(colorData[1]));
- serverMessage.appendInt(Integer.valueOf(colorData[2]));
- serverMessage.appendInt(Integer.valueOf(colorData[3]));
+ serverMessage.appendInt(Integer.parseInt(colorData[0]));
+ serverMessage.appendInt(Integer.parseInt(colorData[1]));
+ serverMessage.appendInt(Integer.parseInt(colorData[2]));
+ serverMessage.appendInt(Integer.parseInt(colorData[3]));
} else {
serverMessage.appendInt(0);
serverMessage.appendInt(126);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java
index a67103b8..020c43df 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java
@@ -113,15 +113,15 @@ public class InteractionBuildArea extends InteractionCustomValues {
THashSet oldTiles = this.tiles;
THashSet newTiles = new THashSet<>();
- int minX = Math.max(0, newLocation.x - Integer.parseInt(this.values.get("tilesBack")));
- int minY = Math.max(0, newLocation.y - Integer.parseInt(this.values.get("tilesRight")));
- int maxX = Math.min(room.getLayout().getMapSizeX(), newLocation.x + Integer.parseInt(this.values.get("tilesFront")));
- int maxY = Math.min(room.getLayout().getMapSizeY(), newLocation.y + Integer.parseInt(this.values.get("tilesLeft")));
+ int minX = Math.max(0, newLocation.getX() - Integer.parseInt(this.values.get("tilesBack")));
+ int minY = Math.max(0, newLocation.getY() - Integer.parseInt(this.values.get("tilesRight")));
+ int maxX = Math.min(room.getLayout().getMapSizeX(), newLocation.getX() + Integer.parseInt(this.values.get("tilesFront")));
+ int maxY = Math.min(room.getLayout().getMapSizeY(), newLocation.getY() + Integer.parseInt(this.values.get("tilesLeft")));
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
- if (tile != null && tile.state != RoomTileState.INVALID)
+ if (tile != null && tile.getState() != RoomTileState.INVALID)
newTiles.add(tile);
}
}
@@ -162,7 +162,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
- if (tile != null && tile.state != RoomTileState.INVALID)
+ if (tile != null && tile.getState() != RoomTileState.INVALID)
this.tiles.add(tile);
}
}
@@ -197,7 +197,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
- if (tile != null && tile.state != RoomTileState.INVALID && !this.tiles.contains(tile))
+ if (tile != null && tile.getState() != RoomTileState.INVALID && !this.tiles.contains(tile))
oldTiles.add(tile);
}
}
@@ -224,8 +224,8 @@ public class InteractionBuildArea extends InteractionCustomValues {
for (RoomTile tile : this.tiles) {
id--;
HabboItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0);
- item.setX(tile.x);
- item.setY(tile.y);
+ item.setX(tile.getX());
+ item.setY(tile.getY());
item.setZ(tile.relativeHeight());
items.add(item);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
index 133e83c9..9d181a92 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java
@@ -3,14 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class InteractionColorPlate extends InteractionDefault {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionColorPlate.class);
public InteractionColorPlate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -42,9 +41,9 @@ public class InteractionColorPlate extends InteractionDefault {
}
try {
- state = Integer.valueOf(this.getExtradata());
+ state = Integer.parseInt(this.getExtradata());
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
state += amount;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java
index c40d27c4..1be2594c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java
@@ -38,8 +38,8 @@ public class InteractionCrackable extends HabboItem {
serverMessage.appendInt(7 + (this.isLimited() ? 256 : 0));
- serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.valueOf(this.getExtradata()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + "");
- serverMessage.appendInt(Integer.valueOf(this.getExtradata()));
+ serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtradata()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + "");
+ serverMessage.appendInt(Integer.parseInt(this.getExtradata()));
serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()));
super.serializeExtradata(serverMessage);
@@ -96,7 +96,7 @@ public class InteractionCrackable extends HabboItem {
CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId());
if (rewardData != null) {
- if (rewardData.requiredEffect > 0 && habbo.getRoomUnit().getEffectId() != rewardData.requiredEffect)
+ if (rewardData.getRequiredEffect() > 0 && habbo.getRoomUnit().getEffectId() != rewardData.getRequiredEffect())
return;
if(this.ticks < 1)
@@ -109,26 +109,24 @@ public class InteractionCrackable extends HabboItem {
this.needsUpdate(true);
room.updateItem(this);
- if (!rewardData.achievementTick.isEmpty()) {
- AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementTick));
+ if (!rewardData.getAchievementTick().isEmpty()) {
+ AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementTick()));
}
if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) {
this.cracked = true;
Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getX(), this.getY()), 1500);
- if (!rewardData.achievementCracked.isEmpty()) {
- AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementCracked));
+ if (!rewardData.getAchievementCracked().isEmpty()) {
+ AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementCracked()));
}
- if (rewardData.subscriptionType != null && rewardData.subscriptionDuration > 0) {
+ if (rewardData.getSubscriptionType() != null && rewardData.getSubscriptionDuration() > 0) {
// subscriptions are given immediately upon cracking
- switch (rewardData.subscriptionType) {
- case HABBO_CLUB:
- habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, rewardData.subscriptionDuration * 86400);
- break;
- case BUILDERS_CLUB:
- habbo.getHabboStats().createSubscription("BUILDERS_CLUB", rewardData.subscriptionDuration * 86400);
- break;
+ switch (rewardData.getSubscriptionType()) {
+ case HABBO_CLUB ->
+ habbo.getHabboStats().createSubscription(SubscriptionHabboClub.HABBO_CLUB, rewardData.getSubscriptionDuration() * 86400);
+ case BUILDERS_CLUB ->
+ habbo.getHabboStats().createSubscription("BUILDERS_CLUB", rewardData.getSubscriptionDuration() * 86400);
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
index 6161d131..255054ba 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java
@@ -9,14 +9,13 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class InteractionDefault extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionDefault.class);
public InteractionDefault(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -77,9 +76,9 @@ public class InteractionDefault extends HabboItem {
int currentState = 0;
try {
- currentState = Integer.valueOf(this.getExtradata());
+ currentState = Integer.parseInt(this.getExtradata());
} catch (NumberFormatException e) {
- LOGGER.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
+ log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
@@ -150,9 +149,8 @@ public class InteractionDefault extends HabboItem {
int nextEffectDuration = -1;
if (objects != null && objects.length == 2) {
- if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
- RoomTile goalTile = (RoomTile) objects[0];
- HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y, (objects[0] != objects[1]) ? this : null);
+ if (objects[0] instanceof RoomTile goalTile && objects[1] instanceof RoomTile) {
+ HabboItem topItem = room.getTopItemAt(goalTile.getX(), goalTile.getY(), (objects[0] != objects[1]) ? this : null);
if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
return;
@@ -206,7 +204,7 @@ public class InteractionDefault extends HabboItem {
if (!habbo.getHabboStats().isRentingSpace()) return false;
- HabboItem rentSpace = room.getHabboItem(habbo.getHabboStats().rentedItemId);
+ HabboItem rentSpace = room.getHabboItem(habbo.getHabboStats().getRentedItemId());
return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java
index 0e6ad5d7..eb0e8b19 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java
@@ -50,7 +50,7 @@ public class InteractionEffectGate extends InteractionDefault implements Conditi
if (!customparams.isEmpty()) {
return Arrays.asList(customparams.split(";"))
- .contains(Integer.valueOf(roomUnit.getEffectId()).toString());
+ .contains(String.valueOf(roomUnit.getEffectId()));
}
return defaultAllowedEnables.contains(roomUnit.getEffectId());
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java
index 99df17f1..4d8d011a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java
@@ -27,7 +27,7 @@ public class InteractionEffectGiver extends InteractionDefault {
super.onClick(client, room, objects);
if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())) ||
- (client.getHabbo().getRoomUnit().getCurrentLocation().x == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().y == this.getY())) {
+ (client.getHabbo().getRoomUnit().getCurrentLocation().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().getY() == this.getY())) {
this.handle(room, client.getHabbo().getRoomUnit());
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java
index feb63992..3084f3e4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java
@@ -25,7 +25,7 @@ public class InteractionEffectToggle extends InteractionDefault {
if (client != null) {
if (room.hasRights(client.getHabbo())) {
- if (Integer.valueOf(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) {
+ if (Integer.parseInt(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) {
if ((client.getHabbo().getHabboInfo().getGender() == HabboGender.M && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) ||
(client.getHabbo().getHabboInfo().getGender() == HabboGender.F && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectF())) {
super.onClick(client, room, objects);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java
index ba49ed7a..49261af4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java
@@ -1,7 +1,8 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.rooms.*;
+import com.eu.habbo.habbohotel.rooms.Room;
+import com.eu.habbo.habbohotel.rooms.RoomUnit;
import java.sql.ResultSet;
import java.sql.SQLException;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java
index 799c2116..84f91edc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java
@@ -28,7 +28,7 @@ public class InteractionEffectVendingMachineNoSides extends InteractionVendingMa
@Override
public THashSet getActivatorTiles(Room room) {
- THashSet tiles = new THashSet();
+ THashSet tiles = new THashSet<>();
for(int x = -1; x <= 1; x++) {
for(int y = -1; y <= 1; y++) {
RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y));
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java
index ca92ccf4..1da31022 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java
@@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
-import com.eu.habbo.habbohotel.users.inventory.EffectsComponent;
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
@@ -50,7 +49,7 @@ public class InteractionFXBox extends InteractionDefault {
if(client.getHabbo().getInventory().getEffectsComponent().ownsEffect(effectId))
return;
- EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0);
+ client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0);
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
this.setExtradata("1");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
index b2255e2f..22f4071d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java
@@ -11,17 +11,16 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+@Slf4j
public class InteractionFireworks extends InteractionDefault {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionFireworks.class);
private static final String STATE_EMPTY = "0"; // Not used since the removal of pixels
private static final String STATE_CHARGED = "1";
@@ -129,7 +128,7 @@ public class InteractionFireworks extends InteractionDefault {
try {
explodeDuration = Integer.parseInt(this.getBaseItem().getCustomParams());
} catch (NumberFormatException e) {
- LOGGER.error("Incorrect customparams (" + this.getBaseItem().getCustomParams() + ") for base item ID (" + this.getBaseItem().getId() + ") of type (" + this.getBaseItem().getName() + ")");
+ log.error("Incorrect customparams (" + this.getBaseItem().getCustomParams() + ") for base item ID (" + this.getBaseItem().getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java
index f7ceb0e3..9646940b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java
@@ -46,7 +46,7 @@ public class InteractionGate extends HabboItem {
// If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close
for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))
- if (room.hasHabbosAt(tile.x, tile.y))
+ if (room.hasHabbosAt(tile.getX(), tile.getY()))
return;
// Gate closed = 0, open = 1
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
index 41fb4dc1..62f2a19e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
@@ -8,18 +8,19 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class InteractionGift extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGift.class);
-
public boolean explode = false;
private int[] itemId;
+ @Getter
private int colorId = 0;
+ @Getter
private int ribbonId = 0;
private boolean showSender = false;
private String message = "";
@@ -32,7 +33,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
- LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
+ log.warn("Incorrect extradata for gift with ID " + this.getId());
}
}
@@ -42,7 +43,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
- LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
+ log.warn("Incorrect extradata for gift with ID " + this.getId());
}
}
@@ -94,16 +95,16 @@ public class InteractionGift extends HabboItem {
data = this.getExtradata().split("\t");
if (data != null && data.length >= 5) {
- int count = Integer.valueOf(data[0]);
+ int count = Integer.parseInt(data[0]);
this.itemId = new int[count];
for (int i = 0; i < count; i++) {
- this.itemId[i] = Integer.valueOf(data[i + 1]);
+ this.itemId[i] = Integer.parseInt(data[i + 1]);
}
- this.colorId = Integer.valueOf(data[count + 1]);
- this.ribbonId = Integer.valueOf(data[count + 2]);
+ this.colorId = Integer.parseInt(data[count + 1]);
+ this.ribbonId = Integer.parseInt(data[count + 2]);
this.showSender = data[count + 3].equalsIgnoreCase("1");
this.message = data[count + 4];
@@ -120,14 +121,6 @@ public class InteractionGift extends HabboItem {
}
}
- public int getColorId() {
- return this.colorId;
- }
-
- public int getRibbonId() {
- return this.ribbonId;
- }
-
public THashSet loadItems() {
THashSet items = new THashSet<>();
for (int anItemId : this.itemId) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java
index b4374f86..067405a6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java
@@ -13,7 +13,7 @@ import java.sql.SQLException;
public class InteractionGuildFurni extends InteractionDefault {
private int guildId;
- private static final THashSet ROTATION_8_ITEMS = new THashSet() {
+ private static final THashSet ROTATION_8_ITEMS = new THashSet<>() {
{
this.add("gld_wall_tall");
}
@@ -47,8 +47,8 @@ public class InteractionGuildFurni extends InteractionDefault {
serverMessage.appendString(this.getExtradata());
serverMessage.appendString(guild.getId() + "");
serverMessage.appendString(guild.getBadge());
- serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getSymbolColor(guild.getColorOne()).valueA);
- serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getBackgroundColor(guild.getColorTwo()).valueA);
+ serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getSymbolColor(guild.getColorOne()).getValueA());
+ serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getBackgroundColor(guild.getColorTwo()).getValueA());
} else {
serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata());
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java
index 0de6806b..a5e106c8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java
@@ -64,7 +64,7 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
if (roomUnit != null) {
Habbo habbo = room.getHabbo(roomUnit);
- HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
+ HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().getX(), roomUnit.getCurrentLocation().getY());
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java
index 7782736b..7c7599f0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java
@@ -25,7 +25,7 @@ public class InteractionHanditem extends InteractionDefault {
super.onClick(client, room, objects);
if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())) ||
- (client.getHabbo().getRoomUnit().getCurrentLocation().x == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().y == this.getY())) {
+ (client.getHabbo().getRoomUnit().getCurrentLocation().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().getY() == this.getY())) {
this.handle(room, client.getHabbo().getRoomUnit());
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java
index 786e369f..286aa9f9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java
@@ -21,7 +21,7 @@ public class InteractionHanditemTile extends InteractionHanditem {
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
InteractionHanditemTile instance = this;
Emulator.getThreading().run(() -> {
- if (roomUnit.getCurrentLocation().x == instance.getX() && roomUnit.getCurrentLocation().y == instance.getY()) {
+ if (roomUnit.getCurrentLocation().getX() == instance.getX() && roomUnit.getCurrentLocation().getY() == instance.getY()) {
instance.handle(room, roomUnit);
}
}, 3000);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java
index fa0d2571..aea5acbf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java
@@ -86,10 +86,10 @@ public class InteractionHopper extends HabboItem {
}
protected boolean canUseTeleport(GameClient client, RoomTile front, Room room) {
- if (client.getHabbo().getRoomUnit().getX() != front.x)
+ if (client.getHabbo().getRoomUnit().getX() != front.getX())
return false;
- if (client.getHabbo().getRoomUnit().getY() != front.y)
+ if (client.getHabbo().getRoomUnit().getY() != front.getY())
return false;
if (client.getHabbo().getRoomUnit().isTeleporting)
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java
index 41bcdf9b..86b73483 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java
@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionInformationTerminal extends InteractionCustomValues {
- public static final THashMap defaultValues = new THashMap() {
+ public static final THashMap defaultValues = new THashMap<>() {
{
this.put("internalLink", "habbopages/chat/commands");
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java
index fcb41753..e6a813c5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java
@@ -77,11 +77,11 @@ public class InteractionMannequin extends HabboItem {
if (gender.isEmpty() || figure.isEmpty() || (!gender.equalsIgnoreCase("m") && !gender.equalsIgnoreCase("f")) || !client.getHabbo().getHabboInfo().getGender().name().equalsIgnoreCase(gender))
return;
- String newFigure = "";
+ StringBuilder newFigure = new StringBuilder();
for (String playerFigurePart : client.getHabbo().getHabboInfo().getLook().split("\\.")) {
if (!playerFigurePart.startsWith("ch") && !playerFigurePart.startsWith("lg"))
- newFigure += playerFigurePart + ".";
+ newFigure.append(playerFigurePart).append(".");
}
String newFigureParts = figure;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java
index 51e47e6c..44f024db 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java
@@ -46,9 +46,9 @@ public class InteractionMonsterCrackable extends InteractionCrackable implements
@Override
public void reset(Room room) {
RoomTile tile = room.getRandomWalkableTile();
- this.setX(tile.x);
- this.setY(tile.y);
- this.setZ(room.getStackHeight(tile.x, tile.y, false));
+ this.setX(tile.getX());
+ this.setY(tile.getY());
+ this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false));
super.reset(room);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
index e2c9e571..04cadffc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
@@ -67,7 +67,7 @@ public class InteractionMultiHeight extends HabboItem {
this.needsUpdate(true);
room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
room.updateItemState(this);
- //room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.valueOf(this.getExtradata())] * 256.0D).compose());
+ //room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.parseInt(this.getExtradata())] * 256.0D).compose());
}
}
}
@@ -77,9 +77,8 @@ public class InteractionMultiHeight extends HabboItem {
THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation());
for(RoomTile tile : occupiedTiles) {
- Collection unitsOnItem = room.getRoomUnitsAt(room.getLayout().getTile(tile.x, tile.y));
+ Collection unitsOnItem = room.getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY()));
- THashSet updatedUnits = new THashSet<>();
for (RoomUnit unit : unitsOnItem) {
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoal() != tile)
continue;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
index f001fc20..ef9914a0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java
@@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class InteractionMusicDisc extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionMusicDisc.class);
private int songId;
@@ -23,9 +22,9 @@ public class InteractionMusicDisc extends HabboItem {
if (stuff.length >= 7 && !stuff[6].isEmpty()) {
try {
- this.songId = Integer.valueOf(stuff[6]);
+ this.songId = Integer.parseInt(stuff[6]);
} catch (Exception e) {
- LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
+ log.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
}
}
}
@@ -37,9 +36,9 @@ public class InteractionMusicDisc extends HabboItem {
if (stuff.length >= 7 && !stuff[6].isEmpty()) {
try {
- this.songId = Integer.valueOf(stuff[6]);
+ this.songId = Integer.parseInt(stuff[6]);
} catch (Exception e) {
- LOGGER.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
+ log.error("Warning: Item " + this.getId() + " has an invalid song id set for its music disk!");
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java
index b2597681..b8b1ac03 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java
@@ -9,8 +9,8 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.outgoing.rooms.items.ObjectDataUpdateMessageComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.messages.outgoing.rooms.items.ObjectsMessageComposer;
+import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import gnu.trove.TCollections;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
@@ -21,7 +21,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionMuteArea extends InteractionCustomValues {
- public static THashMap defaultValues = new THashMap() {
+ public static THashMap defaultValues = new THashMap<>() {
{
this.put("tilesLeft", "0");
}
@@ -43,7 +43,7 @@ public class InteractionMuteArea extends InteractionCustomValues {
}
};
- private THashSet tiles;
+ private final THashSet tiles;
public InteractionMuteArea(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem, defaultValues);
@@ -98,9 +98,9 @@ public class InteractionMuteArea extends InteractionCustomValues {
/*try {
return new Rectangle(
this.getX() - Integer.parseInt(this.values.get("tilesBack")),
- this.getY() + Integer.valueOf(this.values.get("tilesLeft")) - (Integer.valueOf(this.values.get("tilesLeft")) + Integer.valueOf(this.values.get("tilesRight"))),
- Integer.valueOf(this.values.get("tilesLeft")) + Integer.valueOf(this.values.get("tilesRight")) + 1,
- Integer.valueOf(this.values.get("tilesFront")) + Integer.valueOf(this.values.get("tilesBack")) + 1).contains(location.x, location.y);
+ this.getY() + Integer.parseInt(this.values.get("tilesLeft")) - (Integer.parseInt(this.values.get("tilesLeft")) + Integer.parseInt(this.values.get("tilesRight"))),
+ Integer.parseInt(this.values.get("tilesLeft")) + Integer.parseInt(this.values.get("tilesRight")) + 1,
+ Integer.parseInt(this.values.get("tilesFront")) + Integer.parseInt(this.values.get("tilesBack")) + 1).contains(location.x, location.y);
} catch (Exception e) {
return false;
}*/
@@ -117,7 +117,7 @@ public class InteractionMuteArea extends InteractionCustomValues {
for(int x = minX; x <= maxX; x++) {
for(int y = minY; y <= maxY; y++) {
RoomTile tile = room.getLayout().getTile((short)x, (short)y);
- if(tile != null && tile.state != RoomTileState.INVALID)
+ if(tile != null && tile.getState() != RoomTileState.INVALID)
this.tiles.add(tile);
}
}
@@ -141,8 +141,8 @@ public class InteractionMuteArea extends InteractionCustomValues {
for(RoomTile tile : this.tiles) {
id--;
HabboItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0);
- item.setX(tile.x);
- item.setY(tile.y);
+ item.setX(tile.getX());
+ item.setY(tile.getY());
item.setZ(tile.relativeHeight());
items.add(item);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java
index f2463700..f31560db 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java
@@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
-import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -21,7 +20,7 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine
@Override
public THashSet getActivatorTiles(Room room) {
- THashSet tiles = new THashSet();
+ THashSet tiles = new THashSet<>();
for(int x = -1; x <= 1; x++) {
for(int y = -1; y <= 1; y++) {
RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y));
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
index a63dcad8..e6b008d5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java
@@ -17,7 +17,7 @@ import java.util.Objects;
public class InteractionObstacle extends HabboItem implements ICycleable {
- private THashSet middleTiles;
+ private final THashSet middleTiles;
public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -180,12 +180,12 @@ public class InteractionObstacle extends HabboItem implements ICycleable {
continue;
RoomTile tileInfront = room.getLayout().getTileInFront(unit.getCurrentLocation(), unit.getBodyRotation().getValue());
- if(tileInfront.state != RoomTileState.INVALID && tileInfront.state != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileInfront).size() == 0) {
+ if(tileInfront.getState() != RoomTileState.INVALID && tileInfront.getState() != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileInfront).size() == 0) {
unit.setGoalLocation(tileInfront);
}
else {
RoomTile tileBehind = room.getLayout().getTileInFront(unit.getCurrentLocation(), Objects.requireNonNull(unit.getBodyRotation().getOpposite()).getValue());
- if(tileBehind.state != RoomTileState.INVALID && tileBehind.state != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileBehind).size() == 0) {
+ if(tileBehind.getState() != RoomTileState.INVALID && tileBehind.getState() != RoomTileState.BLOCKED && room.getRoomUnitsAt(tileBehind).size() == 0) {
unit.setGoalLocation(tileBehind);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
index 55e6ca99..22c822aa 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
@@ -12,8 +12,6 @@ import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.DiceValueMessageComposer;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -21,8 +19,6 @@ import java.util.ArrayList;
import java.util.List;
public class InteractionOneWayGate extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionOneWayGate.class);
-
private boolean walkable = false;
public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException {
@@ -80,10 +76,10 @@ public class InteractionOneWayGate extends HabboItem {
if (unit == null)
return;
- if (tileInfront.x == unit.getX() && tileInfront.y == unit.getY()) {
+ if (tileInfront.getX() == unit.getX() && tileInfront.getY() == unit.getY()) {
if (!currentLocation.hasUnits()) {
- List onSuccess = new ArrayList();
- List onFail = new ArrayList();
+ List onSuccess = new ArrayList<>();
+ List onFail = new ArrayList<>();
onSuccess.add(() -> {
unit.setCanLeaveRoomByDoor(false);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java
index a1cef49e..9176cecf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java
@@ -82,7 +82,7 @@ public class InteractionPressurePlate extends InteractionDefault {
if (tiles == null) return;
for (RoomTile tile : tiles) {
- boolean hasHabbos = room.hasHabbosAt(tile.x, tile.y);
+ boolean hasHabbos = room.hasHabbosAt(tile.getX(), tile.getY());
if (!hasHabbos && this.requiresAllTilesOccupied()) {
occupied = false;
break;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java
index a8d0db0e..1a894f80 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java
@@ -83,7 +83,7 @@ public abstract class InteractionPushable extends InteractionDefault {
boolean isDrag = false;
RoomUserRotation direction;
- if (this.getX() == roomUnit.getGoal().x && this.getY() == roomUnit.getGoal().y) //User clicked on the tile the ball is on, they want to kick it
+ if (this.getX() == roomUnit.getGoal().getX() && this.getY() == roomUnit.getGoal().getY()) //User clicked on the tile the ball is on, they want to kick it
{
velocity = this.getWalkOnVelocity(roomUnit, room);
direction = this.getWalkOnDirection(roomUnit, room);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
index a23586ba..3de816b5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
@@ -49,18 +49,18 @@ public class InteractionPuzzleBox extends HabboItem {
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), rotation.getValue());
- if (tile == null || tile.getState() == RoomTileState.INVALID || room.hasHabbosAt(tile.x, tile.y)) {
+ if (tile == null || tile.getState() == RoomTileState.INVALID || room.hasHabbosAt(tile.getX(), tile.getY())) {
return;
}
if (!boxLocation.equals(room.getLayout().getTileInFront(client.getHabbo().getRoomUnit().getCurrentLocation(), rotation.getValue())))
return;
- HabboItem item = room.getTopItemAt(tile.x, tile.y);
+ HabboItem item = room.getTopItemAt(tile.getX(), tile.getY());
- if (item != null && !room.getTopItemAt(tile.x, tile.y).getBaseItem().allowStack()) return;
+ if (item != null && !room.getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack()) return;
- this.setZ(room.getStackHeight(tile.x, tile.y, false));
+ this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false));
this.needsUpdate(true);
room.updateItem(this);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java
index 1ddc2be9..2055b38b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java
@@ -25,7 +25,7 @@ public class InteractionPyramid extends InteractionGate {
if (room != null) {
if (room.getHabbosAt(this.getX(), this.getY()).isEmpty()) {
- int state = Integer.valueOf(this.getExtradata());
+ int state = Integer.parseInt(this.getExtradata());
state = Math.abs(state - 1);
this.setExtradata(state + "");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java
index c28ee163..2178ccef 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java
@@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.RandomStateParams;
import com.eu.habbo.habbohotel.rooms.Room;
@@ -26,7 +25,7 @@ public class InteractionRandomState extends InteractionDefault {
room.updateItemState(this);
}
- public void onRandomStateClick(GameClient client, Room room) throws Exception {
+ public void onRandomStateClick(Room room) throws Exception {
RandomStateParams params = new RandomStateParams(this.getBaseItem().getCustomParams());
this.setExtradata("");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
index 87e9e1af..feb28cab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java
@@ -12,8 +12,7 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceStatusMessageComposer;
import com.eu.habbo.threading.runnables.ClearRentedSpace;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.awt.*;
import java.sql.Connection;
@@ -21,8 +20,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class InteractionRentableSpace extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionRentableSpace.class);
private int renterId;
private String renterName;
@@ -36,8 +35,8 @@ public class InteractionRentableSpace extends HabboItem {
this.renterName = "Unknown";
if (data.length == 2) {
- this.renterId = Integer.valueOf(data[0]);
- this.endTimestamp = Integer.valueOf(data[1]);
+ this.renterId = Integer.parseInt(data[0]);
+ this.endTimestamp = Integer.parseInt(data[1]);
if (this.renterId > 0) {
if (this.isRented()) {
@@ -54,7 +53,7 @@ public class InteractionRentableSpace extends HabboItem {
}
}
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
} else {
@@ -184,7 +183,7 @@ public class InteractionRentableSpace extends HabboItem {
statement.setInt(1, zero);
statement.setInt(2, zero);
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
@@ -233,8 +232,8 @@ public class InteractionRentableSpace extends HabboItem {
String[] data = this.getBaseItem().getName().replace("hblooza_spacerent", "").split("x");
if (data.length == 2) {
- int x = Integer.valueOf(data[0]);
- int y = Integer.valueOf(data[1]);
+ int x = Integer.parseInt(data[0]);
+ int y = Integer.parseInt(data[1]);
return 10 * (x * y);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java
index d37dea17..688d6fdc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java
@@ -9,7 +9,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionRoomAds extends InteractionCustomValues {
- public final static THashMap defaultValues = new THashMap() {
+ public final static THashMap defaultValues = new THashMap<>() {
{
this.put("imageUrl", "");
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java
index 3a6bf457..09b3292b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java
@@ -76,10 +76,10 @@ public class InteractionSnowboardSlope extends InteractionMultiHeight {
@Override
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
- Rectangle newRect = RoomLayout.getRectangle(newLocation.x, newLocation.y, this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation());
+ Rectangle newRect = RoomLayout.getRectangle(newLocation.getX(), newLocation.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation());
for (Habbo habbo : room.getHabbosOnItem(this)) {
- if (habbo.getRoomUnit().getEffectId() == 97 && !newRect.contains(habbo.getRoomUnit().getCurrentLocation().x, habbo.getRoomUnit().getCurrentLocation().y)) {
+ if (habbo.getRoomUnit().getEffectId() == 97 && !newRect.contains(habbo.getRoomUnit().getCurrentLocation().getX(), habbo.getRoomUnit().getCurrentLocation().getY())) {
room.giveEffect(habbo, 0, -1);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
index 42813714..64af3bfa 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
@@ -96,8 +96,8 @@ public class InteractionTeleport extends HabboItem {
room.updateItemState(this);
unit.setGoalLocation(infrontTile);
- List onSuccess = new ArrayList();
- List onFail = new ArrayList();
+ List onSuccess = new ArrayList<>();
+ List onFail = new ArrayList<>();
onSuccess.add(() -> {
room.updateTile(currentLocation);
@@ -125,8 +125,8 @@ public class InteractionTeleport extends HabboItem {
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, currentLocation, room, onSuccess, onFail));
} else {
// walk to teleport and interact
- List onSuccess = new ArrayList();
- List onFail = new ArrayList();
+ List onSuccess = new ArrayList<>();
+ List onFail = new ArrayList<>();
onSuccess.add(() -> {
tryTeleport(client, room);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java
index c58f6193..bda95b66 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java
@@ -10,7 +10,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionTileEffectProvider extends InteractionCustomValues {
- public static THashMap defaultValues = new THashMap() {
+ public static THashMap defaultValues = new THashMap<>() {
{
this.put("effectId", "0");
}
@@ -38,7 +38,7 @@ public class InteractionTileEffectProvider extends InteractionCustomValues {
public void onWalkOn(RoomUnit roomUnit, final Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
- int effectId = Integer.valueOf(this.values.get("effectId"));
+ int effectId = Integer.parseInt(this.values.get("effectId"));
if (roomUnit.getEffectId() == effectId) {
effectId = 0;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
index 68dd0eec..cf1a3782 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
@@ -22,44 +22,45 @@ public class InteractionTrap extends InteractionDefault {
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
- if (this.getExtradata().equals("0") || roomUnit == null || room.getHabbo(roomUnit) == null) return;
+ if (this.getExtradata().equals("0") || roomUnit == null || room.getHabbo(roomUnit) == null) return;
- Habbo habbo = room.getHabbo(roomUnit);
- int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
- roomUnit.stopWalking();
- super.onWalkOn(roomUnit, room, objects);
- int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
- if (delay == 0) {
- Emulator.getConfig().register("hotel.item.trap." + this.getBaseItem().getName(), "3000");
- delay = 3000;
- }
+ Habbo habbo = room.getHabbo(roomUnit);
+ int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();
+ roomUnit.stopWalking();
+ super.onWalkOn(roomUnit, room, objects);
+ int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
+ if (delay == 0) {
+ Emulator.getConfig().register("hotel.item.trap." + this.getBaseItem().getName(), "3000");
+ delay = 3000;
+ }
- if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
- if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
+ if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
+ if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
- if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
- room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
- return;
- }
-
- if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
- room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
- return;
- }
-
-
- roomUnit.setCanWalk(false);
- Emulator.getThreading().run(() -> {
- room.giveEffect(roomUnit, 0, -1);
- roomUnit.setCanWalk(true);
- room.giveEffect(roomUnit, effect, -1);
- }, delay);
-
- }
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
+ room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
+ return;
}
+
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
+ room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
+ return;
+ }
+
+
+ roomUnit.setCanWalk(false);
+ Emulator.getThreading().run(() -> {
+ room.giveEffect(roomUnit, 0, -1);
+ roomUnit.setCanWalk(true);
+ room.giveEffect(roomUnit, effect, -1);
+ }, delay);
+ }
+ }
+
}
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
}
+
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java
index 817e6039..f6e272b1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java
@@ -55,7 +55,7 @@ public class InteractionVendingMachine extends HabboItem {
boolean inActivatorSpace = false;
- for(RoomTile tile : activatorTiles) {
+ for(RoomTile ignored : activatorTiles) {
if(unit.getCurrentLocation().is(unit.getX(), unit.getY())) {
inActivatorSpace = true;
}
@@ -77,7 +77,7 @@ public class InteractionVendingMachine extends HabboItem {
}
if(!unit.isWalking() && !unit.hasStatus(RoomUnitStatus.SIT) && !unit.hasStatus(RoomUnitStatus.LAY)) {
- this.rotateToMachine(room, unit);
+ this.rotateToMachine(unit);
}
Emulator.getThreading().run(() -> {
@@ -113,7 +113,7 @@ public class InteractionVendingMachine extends HabboItem {
boolean inActivatorSpace = false;
for(RoomTile tile : activatorTiles) {
- if(unit.getCurrentLocation().is(tile.x, tile.y)) {
+ if(unit.getCurrentLocation().is(tile.getX(), tile.getY())) {
inActivatorSpace = true;
}
}
@@ -121,18 +121,16 @@ public class InteractionVendingMachine extends HabboItem {
if(!inActivatorSpace) {
RoomTile tileToWalkTo = null;
for(RoomTile tile : activatorTiles) {
- if((tile.state == RoomTileState.OPEN || tile.state == RoomTileState.SIT) && (tileToWalkTo == null || tileToWalkTo.distance(unit.getCurrentLocation()) > tile.distance(unit.getCurrentLocation()))) {
+ if((tile.getState() == RoomTileState.OPEN || tile.getState() == RoomTileState.SIT) && (tileToWalkTo == null || tileToWalkTo.distance(unit.getCurrentLocation()) > tile.distance(unit.getCurrentLocation()))) {
tileToWalkTo = tile;
}
}
if(tileToWalkTo != null) {
- List onSuccess = new ArrayList();
- List onFail = new ArrayList();
+ List onSuccess = new ArrayList<>();
+ List onFail = new ArrayList<>();
- onSuccess.add(() -> {
- tryInteract(client, room, unit);
- });
+ onSuccess.add(() -> tryInteract(client, room, unit));
unit.setGoalLocation(tileToWalkTo);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tileToWalkTo, room, onSuccess, onFail));
@@ -175,7 +173,7 @@ public class InteractionVendingMachine extends HabboItem {
return true;
}
- private void rotateToMachine(Room room, RoomUnit unit) {
+ private void rotateToMachine(RoomUnit unit) {
RoomUserRotation rotation = RoomUserRotation.values()[Rotation.Calculate(unit.getX(), unit.getY(), this.getX(), this.getY())];
if(Math.abs(unit.getBodyRotation().getValue() - rotation.getValue()) > 1) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java
index c8fa52b4..1df011f5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java
@@ -26,7 +26,7 @@ public class InteractionVikingCotie extends InteractionDefault {
if (client != null && client.getHabbo().getHabboInfo().getId() == this.getUserId()) {
if (client.getHabbo().getRoomUnit().getEffectId() == 172 || client.getHabbo().getRoomUnit().getEffectId() == 173) {
- int state = Integer.valueOf(this.getExtradata());
+ int state = Integer.parseInt(this.getExtradata());
if (state < 5) {
state++;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java
index d2b0f6d2..368eb5c8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java
@@ -83,7 +83,7 @@ public class InteractionWater extends InteractionDefault {
if (pet == null)
return;
- if (!pet.getRoomUnit().hasStatus(RoomUnitStatus.SWIM) && pet.getPetData().canSwim) {
+ if (!pet.getRoomUnit().hasStatus(RoomUnitStatus.SWIM) && pet.getPetData().isCanSwim()) {
pet.getRoomUnit().setStatus(RoomUnitStatus.SWIM, "");
}
}
@@ -130,7 +130,7 @@ public class InteractionWater extends InteractionDefault {
Pet pet = room.getPet(roomUnit);
- return pet == null || pet.getPetData().canSwim;
+ return pet == null || pet.getPetData().isCanSwim();
}
private void updateWaters(Room room, RoomTile oldLocation) {
@@ -143,8 +143,8 @@ public class InteractionWater extends InteractionDefault {
if (oldLocation != null) {
targetOld = RoomLayout.getRectangle(
- oldLocation.x - 1,
- oldLocation.y - 1,
+ oldLocation.getX() - 1,
+ oldLocation.getY() - 1,
this.getBaseItem().getWidth() + 2,
this.getBaseItem().getLength() + 2,
this.getRotation());
@@ -281,8 +281,7 @@ public class InteractionWater extends InteractionDefault {
private boolean isValidForMask(Room room, int x, int y, double z, boolean corner) {
for (HabboItem item : room.getItemsAt(x, y, z)) {
- if (item instanceof InteractionWater) {
- InteractionWater water = (InteractionWater) item;
+ if (item instanceof InteractionWater water) {
// Take out picked up water from the recalculation.
if (!water.isInRoom) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java
index 4b283da1..404e1f32 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java
@@ -4,9 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile;
-import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import gnu.trove.set.hash.THashSet;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
index 7a11d10a..84838123 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
@@ -9,18 +9,17 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.OneWayDoorStatusMessageComposer;
import gnu.trove.map.hash.TLongLongHashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public abstract class InteractionWired extends InteractionDefault {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
private long cooldown;
- private TLongLongHashMap userExecutionCache = new TLongLongHashMap(3);
+ private final TLongLongHashMap userExecutionCache = new TLongLongHashMap(3);
InteractionWired(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -58,7 +57,7 @@ public abstract class InteractionWired extends InteractionDefault {
statement.setInt(2, this.getId());
statement.execute();
} catch (SQLException e) {
- LOGGER.error("Caught SQL exception", e);
+ log.error("Caught SQL exception", e);
}
}
super.run();
@@ -72,7 +71,7 @@ public abstract class InteractionWired extends InteractionDefault {
public abstract void onPickUp();
public void activateBox(Room room) {
- this.activateBox(room, (RoomUnit)null, 0L);
+ this.activateBox(room, null, 0L);
}
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
@@ -107,18 +106,14 @@ public abstract class InteractionWired extends InteractionDefault {
}
public boolean userCanExecute(int roomUnitId, long timestamp) {
- if (roomUnitId == -1) {
- return true;
- } else {
- if (this.userExecutionCache.containsKey((long)roomUnitId)) {
- long lastTimestamp = this.userExecutionCache.get((long)roomUnitId);
- if (timestamp - lastTimestamp < 100L) {
- return false;
- }
+ if (roomUnitId != -1) {
+ if (this.userExecutionCache.containsKey(roomUnitId)) {
+ long lastTimestamp = this.userExecutionCache.get(roomUnitId);
+ return timestamp - lastTimestamp >= 100L;
}
- return true;
}
+ return true;
}
public void clearUserExecutionCache() {
@@ -126,7 +121,7 @@ public abstract class InteractionWired extends InteractionDefault {
}
public void addUserExecutionCache(int roomUnitId, long timestamp) {
- this.userExecutionCache.put((long)roomUnitId, timestamp);
+ this.userExecutionCache.put(roomUnitId, timestamp);
}
public static WiredSettings readSettings(ClientMessage packet, boolean isEffect)
@@ -159,4 +154,5 @@ public abstract class InteractionWired extends InteractionDefault {
settings.setStuffTypeSelectionCode(packet.readInt());
return settings;
}
+
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
index b8a638b2..3162ddb3 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java
@@ -13,15 +13,15 @@ import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreClearType;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreRow;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreScoreType;
import com.eu.habbo.messages.ServerMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
+@Slf4j
public class InteractionWiredHighscore extends HabboItem {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWiredHighscore.class);
+
public WiredHighscoreScoreType scoreType;
public WiredHighscoreClearType clearType;
@@ -40,7 +40,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
this.reloadData();
@@ -58,7 +58,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
this.reloadData();
@@ -93,7 +93,7 @@ public class InteractionWiredHighscore extends HabboItem {
this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
if(client != null && !(objects.length >= 2 && objects[1] instanceof WiredEffectType)) {
@@ -106,8 +106,8 @@ public class InteractionWiredHighscore extends HabboItem {
public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt(6);
serverMessage.appendString(this.getExtradata());
- serverMessage.appendInt(this.scoreType.type);
- serverMessage.appendInt(this.clearType.type);
+ serverMessage.appendInt(this.scoreType.getType());
+ serverMessage.appendInt(this.clearType.getType());
if (this.data != null) {
int size = this.data.size();
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
index 91fb8c08..528c6b80 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
@@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.wired.WiredTriggerDataComposer;
import java.sql.ResultSet;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
index bb868c6d..ee0085f8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
@@ -15,29 +15,36 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.games.GameTimer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
+@Slf4j
public class InteractionGameTimer extends HabboItem implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGameTimer.class);
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
private int baseTime = 0;
+ @Getter
+ @Setter
private int timeNow = 0;
+ @Getter
+ @Setter
private boolean isRunning = false;
+ @Getter
private boolean isPaused = false;
+ @Setter
private boolean threadActive = false;
public enum InteractionGameTimerAction {
START_STOP(1),
INCREASE_TIME(2);
- private int action;
+ private final int action;
InteractionGameTimerAction(int action) {
this.action = action;
@@ -95,7 +102,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
}
}).toArray();
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -127,7 +134,7 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
room.addGame(game);
game.initialise();
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
}
@@ -323,31 +330,8 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
return true;
}
- public boolean isRunning() {
- return this.isRunning;
- }
-
- public void setRunning(boolean running) {
- this.isRunning = running;
- }
-
- public void setThreadActive(boolean threadActive) {
- this.threadActive = threadActive;
- }
-
- public boolean isPaused() {
- return this.isPaused;
- }
-
public void reduceTime() {
this.timeNow--;
}
- public int getTimeNow() {
- return this.timeNow;
- }
-
- public void setTimeNow(int timeNow) {
- this.timeNow = timeNow;
- }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
index da8ccf7d..0882cb0b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
@@ -124,8 +124,8 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable {
@Override
public boolean validMove(Room room, RoomTile from, RoomTile to) {
if (to == null) return false;
- HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
- return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
+ HabboItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
+ return !(!room.getLayout().tileWalkable(to.getX(), to.getY()) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
//return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().setAllowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
}
@@ -154,7 +154,7 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable {
if (game != null) {
GameTeam team = game.getTeamForHabbo(habbo);
if (team != null) {
- HabboItem item = room.getTopItemAt(to.x, to.y);
+ HabboItem item = room.getTopItemAt(to.getX(), to.getY());
try {
item.onWalkOn(kicker, room, null);
} catch (Exception e) {
@@ -180,6 +180,6 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable {
@Override
public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) {
- return to.state == RoomTileState.OPEN && to.isWalkable();
+ return to.getState() == RoomTileState.OPEN && to.isWalkable();
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java
index 8e364615..7eda506b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java
@@ -57,7 +57,7 @@ public class InteractionBattleBanzaiTile extends HabboItem {
if (this.getExtradata().isEmpty())
this.setExtradata("0");
- int state = Integer.valueOf(this.getExtradata());
+ int state = Integer.parseInt(this.getExtradata());
if (state % 3 == 2)
return;
@@ -88,7 +88,7 @@ public class InteractionBattleBanzaiTile extends HabboItem {
if (this.getExtradata().isEmpty())
return false;
- return Integer.valueOf(this.getExtradata()) % 3 == 2;
+ return Integer.parseInt(this.getExtradata()) % 3 == 2;
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java
index 04def885..b846acf4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java
@@ -25,7 +25,7 @@ public class InteractionBattleBanzaiGate extends InteractionGameGate {
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
- return room.getGame(BattleBanzaiGame.class) == null || ((BattleBanzaiGame) room.getGame(BattleBanzaiGame.class)).state.equals(GameState.IDLE);
+ return room.getGame(BattleBanzaiGame.class) == null || room.getGame(BattleBanzaiGame.class).state.equals(GameState.IDLE);
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
index 225ed808..cd80544e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
@@ -69,8 +69,8 @@ public class InteractionFootball extends InteractionPushable {
@Override
public RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room) {
RoomTile peek = roomUnit.getPath().peek();
- RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.x, peek.y) : roomUnit.getGoal();
- return RoomUserRotation.values()[(RoomUserRotation.values().length + Rotation.Calculate(roomUnit.getX(), roomUnit.getY(), nextWalkTile.x, nextWalkTile.y) + 4) % 8];
+ RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.getX(), peek.getY()) : roomUnit.getGoal();
+ return RoomUserRotation.values()[(RoomUserRotation.values().length + Rotation.Calculate(roomUnit.getX(), roomUnit.getY(), nextWalkTile.getX(), nextWalkTile.getY()) + 4) % 8];
}
public RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room) {
@@ -150,8 +150,8 @@ public class InteractionFootball extends InteractionPushable {
@Override
public boolean validMove(Room room, RoomTile from, RoomTile to) {
- if (to == null || to.state == RoomTileState.INVALID) return false;
- HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
+ if (to == null || to.getState() == RoomTileState.INVALID) return false;
+ HabboItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
// Move is valid if there isnt any furni yet
if (topItem == null) {
@@ -174,7 +174,7 @@ public class InteractionFootball extends InteractionPushable {
// If top item is a football goal, the move is only valid if ball is coming from the front side
// Ball shouldn't come from the back or from the sides (tested on 22-03-2022)
if (topItem instanceof InteractionFootballGoal) {
- int ballDirection = Rotation.Calculate(from.x, from.y, to.x, to.y);
+ int ballDirection = Rotation.Calculate(from.getX(), from.getY(), to.getX(), to.getY());
int goalRotation = topItem.getRotation();
switch (goalRotation) {
@@ -220,8 +220,8 @@ public class InteractionFootball extends InteractionPushable {
return;
}
}
- HabboItem currentTopItem = room.getTopItemAt(from.x, from.y, this);
- HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
+ HabboItem currentTopItem = room.getTopItemAt(from.getX(), from.getY(), this);
+ HabboItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
if ((topItem != null) && ((currentTopItem == null) || (currentTopItem.getId() != topItem.getId())) && ((topItem instanceof InteractionFootballGoal))) {
GameTeamColors color = ((InteractionGameTeamItem) topItem).teamColor;
game.onScore(kicker, color);
@@ -247,8 +247,8 @@ public class InteractionFootball extends InteractionPushable {
@Override
public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) {
- HabboItem topItem = room.getTopItemAt(from.x, from.y, this);
- return !((Emulator.getRandom().nextInt(10) >= 3 && room.hasHabbosAt(to.x, to.y)) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1));
+ HabboItem topItem = room.getTopItemAt(from.getX(), from.getY(), this);
+ return !((Emulator.getRandom().nextInt(10) >= 3 && room.hasHabbosAt(to.getX(), to.getY())) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1));
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java
index 0c9dd2f5..b033118b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java
@@ -63,9 +63,9 @@ public class InteractionFootballGate extends HabboItem {
}
private static void removeLook(Habbo habbo) {
- if (habbo.getHabboStats().cache.containsKey(CACHE_KEY)) {
- habbo.getHabboInfo().setLook((String) habbo.getHabboStats().cache.get(CACHE_KEY));
- habbo.getHabboStats().cache.remove(CACHE_KEY);
+ if (habbo.getHabboStats().getCache().containsKey(CACHE_KEY)) {
+ habbo.getHabboInfo().setLook((String) habbo.getHabboStats().getCache().get(CACHE_KEY));
+ habbo.getHabboStats().getCache().remove(CACHE_KEY);
habbo.getClient().sendResponse(new FigureUpdateComposer(habbo));
if (habbo.getHabboInfo().getCurrentRoom() != null) {
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserChangeMessageComposer(habbo).compose());
@@ -115,8 +115,8 @@ public class InteractionFootballGate extends HabboItem {
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null) {
- if (habbo.getHabboStats().cache.containsKey(CACHE_KEY)) {
- String oldlook = (String) habbo.getHabboStats().cache.get(CACHE_KEY);
+ if (habbo.getHabboStats().getCache().containsKey(CACHE_KEY)) {
+ String oldlook = (String) habbo.getHabboStats().getCache().get(CACHE_KEY);
UserSavedLookEvent lookEvent = new UserSavedLookEvent(habbo, habbo.getHabboInfo().getGender(), oldlook);
Emulator.getPluginManager().fireEvent(lookEvent);
@@ -127,14 +127,14 @@ public class InteractionFootballGate extends HabboItem {
room.sendComposer(new UserChangeMessageComposer(habbo).compose());
}
- habbo.getHabboStats().cache.remove(CACHE_KEY);
+ habbo.getHabboStats().getCache().remove(CACHE_KEY);
} else {
String finalLook = FigureUtil.mergeFigures(habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getGender() == HabboGender.F ? this.figureF : this.figureM, new String[]{"hd", "hr", "ha", "he", "ea", "fa"}, new String[]{"ch", "ca", "cc", "cp", "lg", "wa", "sh"});
UserSavedLookEvent lookEvent = new UserSavedLookEvent(habbo, habbo.getHabboInfo().getGender(), finalLook);
Emulator.getPluginManager().fireEvent(lookEvent);
if (!lookEvent.isCancelled()) {
- habbo.getHabboStats().cache.put(CACHE_KEY, habbo.getHabboInfo().getLook());
+ habbo.getHabboStats().getCache().put(CACHE_KEY, habbo.getHabboInfo().getLook());
habbo.getHabboInfo().setLook(ClothingValidationManager.VALIDATE_ON_FBALLGATE ? ClothingValidationManager.validateLook(habbo, lookEvent.newLook, lookEvent.gender.name()) : lookEvent.newLook);
Emulator.getThreading().run(habbo.getHabboInfo());
habbo.getClient().sendResponse(new FigureUpdateComposer(habbo));
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java
index 2ef7f309..e142f113 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java
@@ -101,19 +101,9 @@ public class InteractionFootballScoreboard extends InteractionGameScoreboard {
int state = (Integer) objects[0];
switch (state) {
- case 1: {
- this.changeScore(1);
- }
- break;
-
- case 2: {
- this.changeScore(-1);
- }
- break;
-
- default:
- this.setScore(0);
- break;
+ case 1 -> this.changeScore(1);
+ case 2 -> this.changeScore(-1);
+ default -> this.setScore(0);
}
} else {
this.changeScore(1);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java
index 84ed5552..abbd2f3a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java
@@ -103,7 +103,7 @@ public class InteractionFreezeBlock extends HabboItem {
int powerUp;
try {
- powerUp = Integer.valueOf(this.getExtradata()) / 1000;
+ powerUp = Integer.parseInt(this.getExtradata()) / 1000;
} catch (NumberFormatException e) {
powerUp = 0;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java
index 5b98b827..678afd3d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java
@@ -41,7 +41,7 @@ public class InteractionFreezeTile extends HabboItem {
if (client == null)
return;
- if (client.getHabbo().getRoomUnit().getCurrentLocation().x == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().y == this.getY()) {
+ if (client.getHabbo().getRoomUnit().getCurrentLocation().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().getY() == this.getY()) {
FreezeGame game = (FreezeGame) room.getGame(FreezeGame.class);
if (game != null)
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java
index ec583fde..b2d75882 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java
@@ -25,7 +25,7 @@ public class InteractionFreezeGate extends InteractionGameGate {
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
- return room.getGame(FreezeGame.class) == null || ((FreezeGame) room.getGame(FreezeGame.class)).state.equals(GameState.IDLE);
+ return room.getGame(FreezeGame.class) == null || room.getGame(FreezeGame.class).state.equals(GameState.IDLE);
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java
index ac996a8b..df20b8d3 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java
@@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.items.interactions.games.tag.bunnyrun;
import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.achievements.Achievement;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.games.tag.BunnyrunGame;
import com.eu.habbo.habbohotel.items.Item;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java
index f83c64fa..75d25b2b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java
@@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.items.interactions.games.tag.icetag;
import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.achievements.Achievement;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.games.tag.IceTagGame;
import com.eu.habbo.habbohotel.items.Item;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java
index 087082e7..c29af75c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java
@@ -12,8 +12,8 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.pets.PerkAllowancesComposer;
-import com.eu.habbo.messages.outgoing.rooms.pets.breeding.NestBreedingSuccessComposer;
import com.eu.habbo.messages.outgoing.rooms.pets.breeding.ConfirmBreedingRequestComposer;
+import com.eu.habbo.messages.outgoing.rooms.pets.breeding.NestBreedingSuccessComposer;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
import java.sql.ResultSet;
@@ -141,7 +141,7 @@ public class InteractionPetBreedingNest extends HabboItem {
}
}
- public void breed(Habbo habbo, String name, int petOneId, int petTwoId) {
+ public void breed(Habbo habbo, String name) {
Emulator.getThreading().run(new QueryDeleteHabboItem(this.getId()));
this.setExtradata("2");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java
index 0a140f9e..e667e4fd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java
@@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
import com.eu.habbo.habbohotel.pets.Pet;
-import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java
index 9cb0c9c1..f427e465 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java
@@ -65,7 +65,7 @@ public class InteractionPetToy extends InteractionDefault {
pet.packetUpdate = true;
HabboItem item = this;
Emulator.getThreading().run(() -> {
- pet.addHappyness(25);
+ pet.addHappiness(25);
item.setExtradata("0");
room.updateItem(item);
pet.getRoomUnit().clearStatus();
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java
index 9b21744d..122ba764 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.*;
-import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.threading.runnables.PetClearPosture;
import java.sql.ResultSet;
@@ -68,7 +67,7 @@ public class InteractionPetTrampoline extends InteractionDefault {
this.setExtradata("0");
room.updateItemState(this);
}, 4000);
- pet.addHappyness(25);
+ pet.addHappiness(25);
this.setExtradata("1");
room.updateItemState(this);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java
index 35965fe6..5e5aa06c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java
@@ -55,7 +55,7 @@ public class InteractionPetTree extends InteractionDefault {
pet.packetUpdate = true;
RoomUnitStatus finalTask = task;
Emulator.getThreading().run(() -> {
- pet.addHappyness(25);
+ pet.addHappiness(25);
pet.getRoomUnit().clearStatus();
new PetClearPosture(pet, finalTask, null, true);
if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getCurrentLocation())) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java
index aa9dcb62..c54cd768 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java
@@ -44,7 +44,7 @@ public class InteractionTotemHead extends InteractionDefault {
if(extraData < 3) {
return TotemColor.NONE;
}
- return TotemColor.fromInt(extraData - 3 - (4 * (getTotemType().type - 1)));
+ return TotemColor.fromInt(extraData - 3 - (4 * (getTotemType().getType() - 1)));
}
private void update(Room room, RoomTile tile) {
@@ -58,7 +58,7 @@ public class InteractionTotemHead extends InteractionDefault {
if(legs == null)
return;
- this.setExtradata(((4 * this.getTotemType().type) + legs.getTotemColor().color) - 1 + "");
+ this.setExtradata(((4 * this.getTotemType().getType()) + legs.getTotemColor().getColor()) - 1 + "");
}
public void updateTotemState(Room room) {
@@ -66,7 +66,7 @@ public class InteractionTotemHead extends InteractionDefault {
}
public void updateTotemState(Room room, RoomTile tile) {
- this.setExtradata(getTotemType().type - 1 + "");
+ this.setExtradata(getTotemType().getType() - 1 + "");
update(room, tile);
this.needsUpdate(true);
room.updateItem(this);
@@ -77,12 +77,12 @@ public class InteractionTotemHead extends InteractionDefault {
if (!((client != null && room != null && room.hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType)))
return;
- TotemType newType = TotemType.fromInt(getTotemType().type + 1);
+ TotemType newType = TotemType.fromInt(getTotemType().getType() + 1);
if(newType == TotemType.NONE) {
newType = TotemType.TROLL;
}
- this.setExtradata(newType.type - 1 + "");
+ this.setExtradata(newType.getType() - 1 + "");
updateTotemState(room);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java
index 6ae0c802..f12a5193 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java
@@ -37,7 +37,7 @@ public class InteractionTotemLegs extends InteractionDefault {
} catch(NumberFormatException ex) {
extraData = 0;
}
- return TotemColor.fromInt(extraData - (4 * (getTotemType().type - 1)));
+ return TotemColor.fromInt(extraData - (4 * (getTotemType().getType() - 1)));
}
private void updateHead(Room room, RoomTile tile) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java
index e12cb1ed..6c9ddb3f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java
@@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem;
-import com.eu.habbo.habbohotel.users.inventory.EffectsComponent;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -83,7 +82,7 @@ public class InteractionTotemPlanet extends InteractionDefault {
return;
}
- EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId);
+ client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId);
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
return;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemColor.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemColor.java
index 340bb47f..1d2fd1b2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemColor.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemColor.java
@@ -1,5 +1,10 @@
package com.eu.habbo.habbohotel.items.interactions.totems;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum TotemColor {
NONE(0),
@@ -7,11 +12,8 @@ public enum TotemColor {
YELLOW(2),
BLUE(3);
- public final int color;
+ private final int color;
- TotemColor(int color) {
- this.color = color;
- }
public static TotemColor fromInt(int color) {
for(TotemColor totemColor : TotemColor.values()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemPlanetType.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemPlanetType.java
index bf8c7378..e737c195 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemPlanetType.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemPlanetType.java
@@ -1,15 +1,17 @@
package com.eu.habbo.habbohotel.items.interactions.totems;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum TotemPlanetType {
MOON(0),
SUN(1),
EARTH(2);
- public final int type;
+ private final int type;
- TotemPlanetType(int type) {
- this.type = type;
- }
public static TotemPlanetType fromInt(int type) {
for(TotemPlanetType planetType : TotemPlanetType.values()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemType.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemType.java
index b82d909b..a0eb82e2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemType.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/TotemType.java
@@ -1,5 +1,10 @@
package com.eu.habbo.habbohotel.items.interactions.totems;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
public enum TotemType {
NONE(0),
@@ -7,11 +12,9 @@ public enum TotemType {
SNAKE(2),
BIRD(3);
- public final int type;
+ private final int type;
+
- TotemType(int type) {
- this.type = type;
- }
public static TotemType fromInt(int type) {
for(TotemType totemType : TotemType.values()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
index 050a54c6..1774a6de 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ServerMessage;
-import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -73,7 +72,7 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
message.appendInt(this.startDate);
message.appendInt(this.endDate);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.startDate);
message.appendInt(this.endDate);
}
@@ -138,7 +137,7 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
try {
this.startDate = Integer.parseInt(data[0]);
this.endDate = Integer.parseInt(data[1]);
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
index 22ec093a..53b108ae 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
@@ -10,7 +10,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -23,7 +22,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.FURNI_HAS_FURNI;
private boolean all;
- private THashSet items;
+ private final THashSet items;
public WiredConditionFurniHaveFurni(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -131,7 +130,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
index 6a2a70a5..abae0d25 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
@@ -13,7 +13,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -122,7 +121,8 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(0);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
index 9330457c..83838e76 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -112,7 +111,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
index 5d4133d2..acab259f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -64,7 +63,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
index df8e2108..839b7db4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -81,7 +80,7 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
message.appendInt(this.lowerLimit);
message.appendInt(this.upperLimit);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
index 5f9f5b1a..52f951f7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -71,7 +70,7 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
message.appendString(this.effectId + "");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
index d60ddede..f56c0f5d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
@@ -7,16 +7,14 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredConditionHabboHasHandItem.class);
public static final WiredConditionType type = WiredConditionType.ACTOR_HAS_HANDITEM;
@@ -46,7 +44,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.handItem);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
@@ -84,7 +82,7 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
this.handItem = Integer.parseInt(wiredData);
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
index 8d2b3dbe..81831829 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -83,7 +82,7 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
message.appendString(this.badge);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
index f4db5bba..bd357437 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
@@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -76,7 +75,7 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.cycles);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
index cd185dab..e3a68648 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
@@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -23,7 +22,7 @@ import java.util.List;
public class WiredConditionMatchStatePosition extends InteractionWiredCondition implements InteractionWiredMatchFurniSettings {
public static final WiredConditionType type = WiredConditionType.MATCH_SSHOT;
- private THashSet settings;
+ private final THashSet settings;
private boolean state;
private boolean position;
@@ -53,7 +52,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
message.appendInt(this.settings.size());
for (WiredMatchFurniSetting item : this.settings)
- message.appendInt(item.item_id);
+ message.appendInt(item.getItem_id());
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
@@ -64,7 +63,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
message.appendInt(this.position ? 1 : 0);
message.appendInt(10);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
@@ -105,21 +104,21 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
THashSet s = new THashSet<>();
for (WiredMatchFurniSetting setting : this.settings) {
- HabboItem item = room.getHabboItem(setting.item_id);
+ HabboItem item = room.getHabboItem(setting.getItem_id());
if (item != null) {
if (this.state) {
- if (!item.getExtradata().equals(setting.state))
+ if (!item.getExtradata().equals(setting.getState()))
return false;
}
if (this.position) {
- if (!(setting.x == item.getX() && setting.y == item.getY()))
+ if (!(setting.getX() == item.getX() && setting.getY() == item.getY()))
return false;
}
if (this.direction) {
- if (setting.rotation != item.getRotation())
+ if (setting.getRotation() != item.getRotation())
return false;
}
} else {
@@ -191,7 +190,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
THashSet remove = new THashSet<>();
for (WiredMatchFurniSetting setting : this.settings) {
- HabboItem item = room.getHabboItem(setting.item_id);
+ HabboItem item = room.getHabboItem(setting.getItem_id());
if (item == null) {
remove.add(setting);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
index 83bd3004..f2473726 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
@@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -76,7 +75,7 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.cycles);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
index b09314c8..b0bf441a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
@@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -132,7 +131,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
index 9409ebe8..4410a39c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
@@ -13,7 +13,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -25,7 +24,7 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
-
+
protected THashSet items;
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@@ -122,7 +121,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(0);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
index 595eee3e..d2a09c8b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -112,7 +111,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
index 7f1d6cab..d9fe194c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -80,7 +79,7 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
message.appendInt(this.lowerLimit);
message.appendInt(this.upperLimit);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
index 3f1a733d..749245f8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -71,7 +70,7 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
message.appendString(this.effectId + "");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
index cf84c109..96d293ce 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -84,7 +83,7 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
message.appendString(this.badge);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
index d7dbfbcb..55d284ab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
@@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -64,7 +63,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
index 0f9d6c95..9795a9a4 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -84,7 +83,7 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.teamColor.type);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java
index bc29186d..d6b11988 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java
@@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
index b8376c01..751dd4d5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
@@ -86,7 +85,7 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
message.appendInt(1);
message.appendInt(this.teamColor.type);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
index 0afdf18c..a8d9aae7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
@@ -5,13 +5,11 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@@ -113,7 +111,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(0);
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
index 24a28885..b0e1ff48 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
@@ -42,7 +42,7 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
message.appendString(this.botName + ((char) 9) + "" + this.botLook);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -107,7 +107,7 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
String[] data = wiredData.split(((char) 9) + "");
if (data.length >= 3) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
this.botName = data[1];
this.botLook = data[2];
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
index b46d0417..5d8d17c9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
@@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -14,7 +13,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -46,19 +44,16 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.mode);
message.appendInt(1);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -138,7 +133,7 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
String[] data = wiredData.split(((char) 9) + "");
if (data.length == 3) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
this.mode = (data[1].equalsIgnoreCase("1") ? 1 : 0);
this.botName = data[2];
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
index 5b380d3c..c82b0eda 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
@@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -18,7 +17,6 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -50,19 +48,16 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.itemId);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -152,8 +147,8 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
String[] data = wiredData.split(((char) 9) + "");
if (data.length == 3) {
- this.setDelay(Integer.valueOf(data[0]));
- this.itemId = Integer.valueOf(data[1]);
+ this.setDelay(Integer.parseInt(data[0]));
+ this.itemId = Integer.parseInt(data[1]);
this.botName = data[2];
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
index 79fae2ca..11681d45 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
@@ -46,7 +46,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.mode);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -143,7 +143,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
String[] data = wiredData.split(((char) 9) + "");
if (data.length == 4) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
this.mode = data[1].equalsIgnoreCase("1") ? 1 : 0;
this.botName = data[2];
this.message = data[3];
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
index ad0c8764..2c3b0698 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
@@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -15,7 +14,6 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -49,19 +47,16 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.mode);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -166,7 +161,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
String[] data = wiredData.split(((char) 9) + "");
if (data.length == 4) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
this.mode = data[1].equalsIgnoreCase("1") ? 1 : 0;
this.botName = data[2];
this.message = data[3];
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
index 3374dc57..cea716c7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
@@ -62,13 +62,13 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
return;
}
- if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) {
+ if (tile.getState() == RoomTileState.INVALID || tile.getState() == RoomTileState.BLOCKED) {
RoomTile alternativeTile = null;
List optionalTiles = room.getLayout().getTilesAround(tile);
Collections.reverse(optionalTiles);
for (RoomTile optionalTile : optionalTiles) {
- if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) {
+ if (optionalTile.getState() != RoomTileState.INVALID && optionalTile.getState() != RoomTileState.BLOCKED) {
alternativeTile = optionalTile;
break;
}
@@ -80,7 +80,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
}
Emulator.getThreading().run(() -> { roomUnit.isWiredTeleporting = true; }, Math.max(0, WiredHandler.TELEPORT_DELAY - 500));
- Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.x, tile.y, tile.getStackHeight() + (tile.state == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY);
+ Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.getX(), tile.getY(), tile.getStackHeight() + (tile.getState() == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY);
}
@Override
@@ -107,7 +107,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
message.appendString(this.botName);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
index b4b9d262..c1b4da34 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
@@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.set.hash.THashSet;
@@ -62,7 +61,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
message.appendString(this.botName);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -171,14 +170,14 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
String[] wiredDataSplit = set.getString("wired_data").split("\t");
if (wiredDataSplit.length >= 2) {
- this.setDelay(Integer.valueOf(wiredDataSplit[0]));
+ this.setDelay(Integer.parseInt(wiredDataSplit[0]));
String[] data = wiredDataSplit[1].split(";");
if (data.length > 1) {
this.botName = data[0];
for (int i = 1; i < data.length; i++) {
- HabboItem item = room.getHabboItem(Integer.valueOf(data[i]));
+ HabboItem item = room.getHabboItem(Integer.parseInt(data[i]));
if (item != null)
this.items.add(item);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
index 7ee3859c..d3111df6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
@@ -7,8 +7,10 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
-import com.eu.habbo.habbohotel.wired.*;
-import com.eu.habbo.messages.ClientMessage;
+import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting;
+import com.eu.habbo.habbohotel.wired.WiredEffectType;
+import com.eu.habbo.habbohotel.wired.WiredHandler;
+import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@@ -61,14 +63,14 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
for (Map.Entry entry : this.items.entrySet()) {
HabboItem item = entry.getKey();
- RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), entry.getValue().direction.getValue());
+ RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), entry.getValue().getDirection().getValue());
int count = 1;
- while ((targetTile == null || targetTile.state == RoomTileState.INVALID || room.furnitureFitsAt(targetTile, item, item.getRotation(), false) != FurnitureMovementError.NONE) && count < 8) {
- entry.getValue().direction = this.nextRotation(entry.getValue().direction);
+ while ((targetTile == null || targetTile.getState() == RoomTileState.INVALID || room.furnitureFitsAt(targetTile, item, item.getRotation(), false) != FurnitureMovementError.NONE) && count < 8) {
+ entry.getValue().setDirection(this.nextRotation(entry.getValue().getDirection()));
- RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), entry.getValue().direction.getValue());
- if (tile != null && tile.state != RoomTileState.INVALID) {
+ RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), entry.getValue().getDirection().getValue());
+ if (tile != null && tile.getState() != RoomTileState.INVALID) {
targetTile = tile;
}
@@ -78,15 +80,15 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
for (Map.Entry entry : this.items.entrySet()) {
HabboItem item = entry.getKey();
- int newDirection = entry.getValue().direction.getValue();
+ int newDirection = entry.getValue().getDirection().getValue();
RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), newDirection);
- if(item.getRotation() != entry.getValue().rotation) {
- if(room.furnitureFitsAt(targetTile, item, entry.getValue().rotation, false) != FurnitureMovementError.NONE)
+ if(item.getRotation() != entry.getValue().getRotation()) {
+ if(room.furnitureFitsAt(targetTile, item, entry.getValue().getRotation(), false) != FurnitureMovementError.NONE)
continue;
- room.moveFurniTo(entry.getKey(), targetTile, entry.getValue().rotation, null, true);
+ room.moveFurniTo(entry.getKey(), targetTile, entry.getValue().getRotation(), null, true);
}
boolean hasRoomUnits = false;
@@ -101,7 +103,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
}
}
- if (targetTile != null && targetTile.state != RoomTileState.INVALID && room.furnitureFitsAt(targetTile, item, item.getRotation(), false) == FurnitureMovementError.NONE) {
+ if (targetTile != null && targetTile.getState() != RoomTileState.INVALID && room.furnitureFitsAt(targetTile, item, item.getRotation(), false) == FurnitureMovementError.NONE) {
if (!hasRoomUnits) {
RoomTile oldLocation = room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY());
double oldZ = entry.getKey().getZ();
@@ -135,7 +137,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
this.blockedAction = data.blocked_action;
for(WiredChangeDirectionSetting setting : data.items) {
- HabboItem item = room.getHabboItem(setting.item_id);
+ HabboItem item = room.getHabboItem(setting.getItem_id());
if (item != null) {
this.items.put(item, setting);
@@ -205,7 +207,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
message.appendInt(this.startRotation != null ? this.startRotation.getValue() : 0);
message.appendInt(this.blockedAction);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java
index 5b98543e..71345755 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java
@@ -21,7 +21,7 @@ public class WiredEffectGiveEffect extends WiredEffectWhisper {
int effectId;
try {
- effectId = Integer.valueOf(this.message);
+ effectId = Integer.parseInt(this.message);
} catch (Exception e) {
return false;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java
index ca39a49f..468cadaa 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java
@@ -20,7 +20,7 @@ public class WiredEffectGiveHandItem extends WiredEffectWhisper {
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
try {
- int itemId = Integer.valueOf(this.message);
+ int itemId = Integer.parseInt(this.message);
Habbo habbo = room.getHabbo(roomUnit);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
index 771e88b1..5903e1d3 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
@@ -43,7 +43,7 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
message.appendString(this.amount + "");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(type.code);
+ message.appendInt(type.getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
@@ -92,7 +92,7 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
return false;
if (this.amount > 0) {
- habbo.getHabboInfo().addCurrencyAmount(Emulator.getConfig().getInt("hotelview.promotional.points.type"), this.amount);
+ habbo.givePoints(Emulator.getConfig().getInt("hotelview.promotional.points.type"), this.amount);
habbo.getClient().sendResponse(new BonusRareInfoMessageComposer(habbo));
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
index d228c75e..f518cd0c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
@@ -4,16 +4,13 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -43,19 +40,16 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
message.appendString(this.amount + "");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(type.code);
+ message.appendInt(type.getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -117,11 +111,11 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
this.amount = 0;
if (wiredData.split("\t").length >= 2) {
- super.setDelay(Integer.valueOf(wiredData.split("\t")[0]));
+ super.setDelay(Integer.parseInt(wiredData.split("\t")[0]));
try {
- this.amount = Integer.valueOf(this.getWiredData().split("\t")[1]);
- } catch (Exception e) {
+ this.amount = Integer.parseInt(this.getWiredData().split("\t")[1]);
+ } catch (Exception ignored) {
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
index 91b78467..e25ab19a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
@@ -5,16 +5,13 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -44,19 +41,16 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
message.appendString(this.respects + "");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(type.code);
+ message.appendInt(type.getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -92,7 +86,7 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
if (habbo == null)
return false;
- habbo.getHabboStats().respectPointsReceived += this.respects;
+ habbo.getHabboStats().increaseRespectPointsReceived(respects);
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"), this.respects);
return true;
@@ -117,10 +111,10 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
this.respects = 0;
if (data.length >= 2) {
- super.setDelay(Integer.valueOf(data[0]));
+ super.setDelay(Integer.parseInt(data[0]));
try {
- this.respects = Integer.valueOf(data[1]);
+ this.respects = Integer.parseInt(data[1]);
} catch (Exception e) {
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
index 607aa57e..bfe6afdf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
@@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
@@ -17,7 +16,6 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.WiredValidationErrorComposer;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -80,12 +78,12 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
else {
String[] data = wiredData.split(":");
if (data.length > 0) {
- this.limit = Integer.valueOf(data[0]);
- this.given = Integer.valueOf(data[1]);
- this.rewardTime = Integer.valueOf(data[2]);
+ this.limit = Integer.parseInt(data[0]);
+ this.given = Integer.parseInt(data[1]);
+ this.rewardTime = Integer.parseInt(data[2]);
this.uniqueRewards = data[3].equals("1");
- this.limitationInterval = Integer.valueOf(data[4]);
- this.setDelay(Integer.valueOf(data[5]));
+ this.limitationInterval = Integer.parseInt(data[4]);
+ this.setDelay(Integer.parseInt(data[5]));
if (data.length > 6) {
if (!data[6].equalsIgnoreCase("\t")) {
@@ -96,7 +94,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
for (String s : items) {
try {
this.rewardItems.add(new WiredGiveRewardItem(s));
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
}
}
@@ -151,19 +149,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
message.appendInt(this.limit);
message.appendInt(this.limitationInterval);
message.appendInt(this.limit > 0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -196,7 +191,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
if (d.length == 3) {
if (!(d[1].contains(":") || d[1].contains(";"))) {
- this.rewardItems.add(new WiredGiveRewardItem(i, d[0].equalsIgnoreCase("0"), d[1], Integer.valueOf(d[2])));
+ this.rewardItems.add(new WiredGiveRewardItem(i, d[0].equalsIgnoreCase("0"), d[1], Integer.parseInt(d[2])));
continue;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
index 293515cc..ef253238 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
@@ -5,20 +5,17 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.iterator.TObjectIntIterator;
import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -33,7 +30,7 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
private int score;
private int count;
- private TObjectIntMap> data = new TObjectIntHashMap<>();
+ private final TObjectIntMap> data = new TObjectIntHashMap<>();
public WiredEffectGiveScore(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -82,7 +79,7 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
try {
this.data.put(new AbstractMap.SimpleEntry<>(gameStartTime, habbo.getHabboInfo().getId()), 1);
}
- catch(IllegalArgumentException e) {
+ catch(IllegalArgumentException ignored) {
}
@@ -116,9 +113,9 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
String[] data = wiredData.split(";");
if (data.length == 3) {
- this.score = Integer.valueOf(data[0]);
- this.count = Integer.valueOf(data[1]);
- this.setDelay(Integer.valueOf(data[2]));
+ this.score = Integer.parseInt(data[0]);
+ this.count = Integer.parseInt(data[1]);
+ this.setDelay(Integer.parseInt(data[2]));
}
this.needsUpdate(true);
@@ -149,19 +146,16 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
message.appendInt(this.score);
message.appendInt(this.count);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
index a439a668..b1d62b4e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
@@ -13,7 +13,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.map.hash.TIntIntHashMap;
@@ -79,10 +78,10 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
String[] data = set.getString("wired_data").split(";");
if (data.length == 4) {
- this.points = Integer.valueOf(data[0]);
- this.count = Integer.valueOf(data[1]);
- this.teamColor = GameTeamColors.values()[Integer.valueOf(data[2])];
- this.setDelay(Integer.valueOf(data[3]));
+ this.points = Integer.parseInt(data[0]);
+ this.count = Integer.parseInt(data[1]);
+ this.teamColor = GameTeamColors.values()[Integer.parseInt(data[2])];
+ this.setDelay(Integer.parseInt(data[3]));
}
this.needsUpdate(true);
@@ -116,7 +115,7 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
message.appendInt(this.count);
message.appendInt(this.teamColor.type);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
index 28bd7c49..e83fa361 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
@@ -7,17 +7,14 @@ import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -78,10 +75,10 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
String[] data = set.getString("wired_data").split("\t");
if (data.length >= 1) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
if (data.length >= 2) {
- this.teamColor = GameTeamColors.values()[Integer.valueOf(data[1])];
+ this.teamColor = GameTeamColors.values()[Integer.parseInt(data[1])];
}
}
@@ -111,19 +108,16 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.teamColor.type);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
index fa8f574f..09512ff8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
@@ -88,7 +88,7 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
String[] data = set.getString("wired_data").split("\t");
if (data.length >= 1) {
- this.setDelay(Integer.valueOf(data[0]));
+ this.setDelay(Integer.parseInt(data[0]));
if (data.length >= 2) {
this.message = data[1];
@@ -124,7 +124,7 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
message.appendString(this.message);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
index 74830cfa..9265a125 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
@@ -6,17 +6,14 @@ import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -69,7 +66,7 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
this.setDelay(data.delay);
}
else {
- this.setDelay(Integer.valueOf(wiredData));
+ this.setDelay(Integer.parseInt(wiredData));
}
}
@@ -93,19 +90,16 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
index 8d74e312..5d827ded 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
@@ -11,13 +11,11 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -25,12 +23,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
+@Slf4j
public class WiredEffectMatchFurni extends InteractionWiredEffect implements InteractionWiredMatchFurniSettings {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class);
private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT;
public boolean checkForWiredResetPermission = true;
- private THashSet settings;
+ private final THashSet settings;
private boolean state = false;
private boolean direction = false;
private boolean position = false;
@@ -52,11 +50,11 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
return true;
for (WiredMatchFurniSetting setting : this.settings) {
- HabboItem item = room.getHabboItem(setting.item_id);
+ HabboItem item = room.getHabboItem(setting.getItem_id());
if (item != null) {
if (this.state && (this.checkForWiredResetPermission && item.allowWiredResetState())) {
- if (!setting.state.equals(" ") && !item.getExtradata().equals(setting.state)) {
- item.setExtradata(setting.state);
+ if (!setting.getState().equals(" ") && !item.getExtradata().equals(setting.getState())) {
+ item.setExtradata(setting.getState());
room.updateItemState(item);
}
}
@@ -65,16 +63,16 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
double oldZ = item.getZ();
if(this.direction && !this.position) {
- if(item.getRotation() != setting.rotation && room.furnitureFitsAt(oldLocation, item, setting.rotation, false) == FurnitureMovementError.NONE) {
- room.moveFurniTo(item, oldLocation, setting.rotation, null, true);
+ if(item.getRotation() != setting.getRotation() && room.furnitureFitsAt(oldLocation, item, setting.getRotation(), false) == FurnitureMovementError.NONE) {
+ room.moveFurniTo(item, oldLocation, setting.getRotation(), null, true);
}
}
else if(this.position) {
- boolean slideAnimation = !this.direction || item.getRotation() == setting.rotation;
- RoomTile newLocation = room.getLayout().getTile((short) setting.x, (short) setting.y);
- int newRotation = this.direction ? setting.rotation : item.getRotation();
+ boolean slideAnimation = !this.direction || item.getRotation() == setting.getRotation();
+ RoomTile newLocation = room.getLayout().getTile((short) setting.getX(), (short) setting.getY());
+ int newRotation = this.direction ? setting.getRotation() : item.getRotation();
- if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && room.furnitureFitsAt(newLocation, item, newRotation, true) == FurnitureMovementError.NONE) {
+ if(newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && room.furnitureFitsAt(newLocation, item, newRotation, true) == FurnitureMovementError.NONE) {
if(room.moveFurniTo(item, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
if(slideAnimation) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
@@ -92,7 +90,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
@Override
public String getWiredData() {
this.refresh();
- return WiredHandler.getGsonBuilder().create().toJson(new JsonData(this.state, this.direction, this.position, new ArrayList(this.settings), this.getDelay()));
+ return WiredHandler.getGsonBuilder().create().toJson(new JsonData(this.state, this.direction, this.position, new ArrayList<>(this.settings), this.getDelay()));
}
@Override
@@ -115,17 +113,17 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
String[] items = data[1].split(Pattern.quote(";"));
- for (int i = 0; i < items.length; i++) {
+ for (String item : items) {
try {
- String[] stuff = items[i].split(Pattern.quote("-"));
+ String[] stuff = item.split(Pattern.quote("-"));
if (stuff.length >= 5) {
this.settings.add(new WiredMatchFurniSetting(Integer.parseInt(stuff[0]), stuff[1], Integer.parseInt(stuff[2]), Integer.parseInt(stuff[3]), Integer.parseInt(stuff[4])));
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
@@ -160,7 +158,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
message.appendInt(this.settings.size());
for (WiredMatchFurniSetting item : this.settings)
- message.appendInt(item.item_id);
+ message.appendInt(item.getItem_id());
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
@@ -170,7 +168,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
message.appendInt(this.direction ? 1 : 0);
message.appendInt(this.position ? 1 : 0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -227,7 +225,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
THashSet remove = new THashSet<>();
for (WiredMatchFurniSetting setting : this.settings) {
- HabboItem item = room.getHabboItem(setting.item_id);
+ HabboItem item = room.getHabboItem(setting.getItem_id());
if (item == null) {
remove.add(setting);
}
@@ -236,6 +234,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
for (WiredMatchFurniSetting setting : remove) {
this.settings.remove(setting);
}
+
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
index 9f016a9e..cec31bf6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
@@ -6,12 +6,10 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
-import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@@ -88,7 +86,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY());
double oldZ = item.getZ();
- if(newLocation != null && newLocation.state != RoomTileState.INVALID && newLocation != oldLocation && room.furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
+ if(newLocation != null && newLocation.getState() != RoomTileState.INVALID && newLocation != oldLocation && room.furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if(room.moveFurniTo(item, newLocation, item.getRotation(), null, false) == FurnitureMovementError.NONE) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
}
@@ -173,7 +171,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
index 4118fd05..6d0f8fd0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
@@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@@ -168,7 +167,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
message.appendInt(this.direction);
message.appendInt(this.spacing);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
index 89f56d3d..86400d3b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
@@ -6,11 +6,9 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
-import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@@ -62,16 +60,16 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
for (RoomUserRotation rot : rotations) {
RoomTile tile = layout.getTileInFront(currentTile, rot.getValue());
- if (tile == null || tile.state == RoomTileState.BLOCKED || tile.state == RoomTileState.INVALID)
+ if (tile == null || tile.getState() == RoomTileState.BLOCKED || tile.getState() == RoomTileState.INVALID)
continue;
- if (!layout.tileExists(tile.x, tile.y))
+ if (!layout.tileExists(tile.getX(), tile.getY()))
continue;
if (room.furnitureFitsAt(tile, item, item.getRotation()) == FurnitureMovementError.INVALID_MOVE)
continue;
- HabboItem topItem = room.getTopItemAt(tile.x, tile.y);
+ HabboItem topItem = room.getTopItemAt(tile.getX(), tile.getY());
if (topItem != null && !topItem.getBaseItem().allowStack())
continue;
@@ -131,7 +129,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
startTile = layout.getTileInFront(startTile, rot.getValue());
}
- if (startTile != null && layout.tileExists(startTile.x, startTile.y)) {
+ if (startTile != null && layout.tileExists(startTile.getX(), startTile.getY())) {
Collection roomUnitsAtTile = room.getRoomUnitsAt(startTile);
if (roomUnitsAtTile.size() > 0) {
target = roomUnitsAtTile.iterator().next();
@@ -222,7 +220,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
if(newTile != null) {
lastDirections.put(item.getId(), moveDirection);
- if(newTile.state != RoomTileState.INVALID && newTile != oldLocation && room.furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
+ if(newTile.getState() != RoomTileState.INVALID && newTile != oldLocation && room.furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if (room.moveFurniTo(item, newTile, item.getRotation(), null, false) == FurnitureMovementError.NONE) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getZ(), 0, room).compose());
}
@@ -309,7 +307,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
index fd24af08..6272bc69 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
@@ -10,13 +10,11 @@ import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -24,15 +22,14 @@ import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implements ICycleable {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMoveRotateFurni.class);
-
public static final WiredEffectType type = WiredEffectType.MOVE_ROTATE;
private final THashSet items = new THashSet<>(WiredHandler.MAXIMUM_FURNI_SELECTION / 2);
private int direction;
private int rotation;
- private THashSet itemCooldowns;
+ private final THashSet itemCooldowns;
public WiredEffectMoveRotateFurni(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -69,7 +66,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
boolean slideAnimation = item.getRotation() == newRotation;
FurnitureMovementError furniMoveTest = room.furnitureFitsAt(newLocation, item, newRotation, true);
- if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
+ if(newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
if(room.furnitureFitsAt(newLocation, item, newRotation, false) == FurnitureMovementError.NONE && room.moveFurniTo(item, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
this.itemCooldowns.add(item);
if(slideAnimation) {
@@ -181,7 +178,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
message.appendInt(this.direction);
message.appendInt(this.rotation);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -219,7 +216,6 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
* @return new rotation
*/
private int getNewRotation(HabboItem item) {
- int rotationToAdd = 0;
if(item.getMaximumRotations() == 2) {
return item.getRotation() == 0 ? 4 : 0;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
index 9497cf78..ba939604 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
@@ -44,7 +44,7 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.length);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
message.appendInt(0);
}
@@ -103,8 +103,8 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
if (data.length >= 3) {
try {
- this.setDelay(Integer.valueOf(data[0]));
- this.length = Integer.valueOf(data[1]);
+ this.setDelay(Integer.parseInt(data[0]));
+ this.length = Integer.parseInt(data[1]);
this.message = data[2];
} catch (Exception e) {
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
index 826b8d31..cef4072a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
@@ -10,7 +10,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.WiredResetTimers;
import gnu.trove.procedure.TObjectProcedure;
@@ -44,7 +43,7 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
message.appendInt(1);
message.appendInt(this.getDelay());
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
index 5fa59787..06be7702 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
@@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -18,7 +17,6 @@ import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.AvatarEffectMessageComposer;
import com.eu.habbo.threading.runnables.RoomUnitTeleport;
import com.eu.habbo.threading.runnables.SendRoomUnitEffectComposer;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -63,13 +61,13 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
return;
}
- if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) {
+ if (tile.getState() == RoomTileState.INVALID || tile.getState() == RoomTileState.BLOCKED) {
RoomTile alternativeTile = null;
List optionalTiles = room.getLayout().getTilesAround(tile);
Collections.reverse(optionalTiles);
for (RoomTile optionalTile : optionalTiles) {
- if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) {
+ if (optionalTile.getState() != RoomTileState.INVALID && optionalTile.getState() != RoomTileState.BLOCKED) {
alternativeTile = optionalTile;
break;
}
@@ -81,7 +79,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
}
Emulator.getThreading().run(() -> { roomUnit.isWiredTeleporting = true; }, Math.max(0, WiredHandler.TELEPORT_DELAY - 500));
- Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.x, tile.y, tile.getStackHeight() + (tile.state == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY);
+ Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.getX(), tile.getY(), tile.getStackHeight() + (tile.getState() == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY);
}
@Override
@@ -107,7 +105,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
index 7a3a0e16..e1589385 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
@@ -6,9 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard;
-import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
-import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiPuck;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTeleporter;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
@@ -24,13 +22,10 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -38,14 +33,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
public class WiredEffectToggleFurni extends InteractionWiredEffect {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleFurni.class);
public static final WiredEffectType type = WiredEffectType.TOGGLE_STATE;
private final THashSet items;
- private static final List> FORBIDDEN_TYPES = new ArrayList>() {
+ private static final List> FORBIDDEN_TYPES = new ArrayList<>() {
{
this.add(InteractionWired.class);
this.add(InteractionTeleport.class);
@@ -119,19 +114,16 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -178,8 +170,6 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
Habbo habbo = room.getHabbo(roomUnit);
- HabboItem triggerItem = null;
-
THashSet itemsToRemove = new THashSet<>();
for (HabboItem item : this.items) {
if (item == null || item.getRoomId() == 0 || FORBIDDEN_TYPES.stream().anyMatch(a -> a.isAssignableFrom(item.getClass()))) {
@@ -200,7 +190,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()});
}
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
index d5e60925..48c52c48 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
@@ -21,13 +21,10 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -35,14 +32,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
public class WiredEffectToggleRandom extends InteractionWiredEffect {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleRandom.class);
public static final WiredEffectType type = WiredEffectType.TOGGLE_RANDOM;
private final THashSet items = new THashSet<>();
- private static final List> FORBIDDEN_TYPES = new ArrayList>() {
+ private static final List> FORBIDDEN_TYPES = new ArrayList<>() {
{
this.add(InteractionWired.class);
this.add(InteractionTeleport.class);
@@ -114,19 +111,16 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -183,7 +177,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + "");
room.updateItem(item);
} catch (Exception e) {
- LOGGER.error("Caught exception", e);
+ log.error("Caught exception", e);
}
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
index c74f39ae..64939ddc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
@@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -12,10 +11,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -62,19 +59,16 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
message.appendString("");
message.appendInt(0);
message.appendInt(0);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredTrigger object) {
- if (!object.isTriggeredByRoomUnit()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
+ if (!object.isTriggeredByRoomUnit()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
@@ -133,7 +127,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
{
found = false;
for (RoomTile tile : usedTiles) {
- if (tile.x == item.getX() && tile.y == item.getY()) {
+ if (tile.getX() == item.getX() && tile.getY() == item.getY()) {
found = true;
break;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
index 42438dbf..7225fb29 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
@@ -7,7 +7,10 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
-import com.eu.habbo.habbohotel.rooms.*;
+import com.eu.habbo.habbohotel.rooms.Room;
+import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
+import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
+import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
@@ -45,7 +48,7 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
message.appendString(this.message);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(type.code);
+ message.appendInt(type.getCode());
message.appendInt(this.getDelay());
if (this.requiresTriggeringUser()) {
@@ -132,7 +135,7 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
this.message = "";
if (wiredData.split("\t").length >= 2) {
- super.setDelay(Integer.valueOf(wiredData.split("\t")[0]));
+ super.setDelay(Integer.parseInt(wiredData.split("\t")[0]));
this.message = wiredData.split("\t")[1];
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
index 8f859fd2..acf9fa33 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
@@ -10,27 +10,24 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
+@Slf4j
public class WiredBlob extends InteractionDefault {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredBlob.class);
+
+ @Getter
+ @AllArgsConstructor
enum WiredBlobState {
ACTIVE("0"),
USED("1");
- private String state;
- WiredBlobState(String state) {
- this.state = state;
- }
-
- public String getState() {
- return state;
- }
+ private final String state;
}
private int POINTS_REWARD = 0;
@@ -106,14 +103,14 @@ public class WiredBlob extends InteractionDefault {
String[] params = this.getBaseItem().getCustomParams().split(",");
if (params.length != 2) {
- LOGGER.error("Wired blobs should have customparams with two parameters (points,resetsWithGame)");
+ log.error("Wired blobs should have customparams with two parameters (points,resetsWithGame)");
return;
}
try {
this.POINTS_REWARD = Integer.parseInt(params[0]);
} catch (NumberFormatException e) {
- LOGGER.error("Wired blobs should have customparams with the first parameter being the amount of points (number)");
+ log.error("Wired blobs should have customparams with the first parameter being the amount of points (number)");
return;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
index 60756729..d9ce1284 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
@@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
@@ -10,10 +9,8 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.WiredExecuteTask;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -88,18 +85,15 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
message.appendInt(1);
message.appendInt(this.executeTime / 500);
message.appendInt(1);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
if (!this.isTriggeredByRoomUnit()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredEffect object) {
- if (object.requiresTriggeringUser()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(object -> {
+ if (object.requiresTriggeringUser()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
index 7fdf0a2a..bde10d78 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
@@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
@@ -10,10 +9,8 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.WiredExecuteTask;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -87,18 +84,15 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
message.appendInt(1);
message.appendInt(this.executeTime / 500);
message.appendInt(1);
- message.appendInt(this.getType().code);
+ message.appendInt(this.getType().getCode());
if (!this.isTriggeredByRoomUnit()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure() {
- @Override
- public boolean execute(InteractionWiredEffect object) {
- if (object.requiresTriggeringUser()) {
- invalidTriggers.add(object.getBaseItem().getSpriteId());
- }
- return true;
+ room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(object -> {
+ if (object.requiresTriggeringUser()) {
+ invalidTriggers.add(object.getBaseItem().getSpriteId());
}
+ return true;
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
index 3de2e345..c069c39d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
@@ -1,9 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
@@ -11,12 +9,9 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
-import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -24,12 +19,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
- private static final Logger LOGGER = LoggerFactory.getLogger(WiredTriggerBotReachedFurni.class);
+
public final static WiredTriggerType type = WiredTriggerType.WALKS_ON_FURNI;
- private THashSet items;
+ private final THashSet items;
private String botName = "";
public WiredTriggerBotReachedFurni(ResultSet set, Item baseItem) throws SQLException {
@@ -75,18 +71,15 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
message.appendString(this.botName);
message.appendInt(0);
message.appendInt(0);
- message.appendInt(WiredTriggerType.BOT_REACHED_STF.code);
+ message.appendInt(WiredTriggerType.BOT_REACHED_STF.getCode());
if (!this.isTriggeredByRoomUnit()) {
List invalidTriggers = new ArrayList<>();
- room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure