🆙 Initial Fix for IDE Warnings

This commit is contained in:
duckietm
2026-01-06 15:42:11 +01:00
parent d49919bed3
commit 984aea5284
296 changed files with 432 additions and 696 deletions
@@ -84,10 +84,10 @@ public final class Emulator {
Runtime.getRuntime().addShutdownHook(hook);
}
@SuppressWarnings("resource")
public static void main(String[] args) throws Exception {
try {
// Check if running on Windows and not in IntelliJ.
// If so, we need to reconfigure the console appender and enable Jansi for colors.
if (OS_NAME.startsWith("Windows") && !CLASS_PATH.contains("idea_rt.jar")) {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
ConsoleAppender<ILoggingEvent> appender = (ConsoleAppender<ILoggingEvent>) root.getAppender("Console");
@@ -105,10 +105,10 @@ public final class Emulator {
System.out.println(logo);
System.out.println("");
System.out.println();
LOGGER.warn("Arcturus Morningstar 3.x is no longer accepting merge requests. Please target MS4 branches if you wish to contribute.");
LOGGER.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community, ");
System.out.println("");
System.out.println();
LOGGER.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
LOGGER.info("Version: {}", version);
LOGGER.info("Build: {}", build);
@@ -205,15 +205,16 @@ public final class Emulator {
StringBuilder sb = new StringBuilder();
try {
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
FileInputStream fis = new FileInputStream(filepath);
byte[] dataBytes = new byte[1024];
int nread = 0;
while ((nread = fis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread);
byte[] mdbytes = md.digest();
for (int i = 0; i < mdbytes.length; i++)
sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16).substring(1));
MessageDigest md = MessageDigest.getInstance("MD5");
try (FileInputStream fis = new FileInputStream(filepath)) {
byte[] dataBytes = new byte[1024];
int nread = 0;
while ((nread = fis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread);
byte[] mdbytes = md.digest();
for (int i = 0; i < mdbytes.length; i++)
sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16).substring(1));
}
} catch (Exception e) {
build = "UNKNOWN";
return;
@@ -407,8 +408,6 @@ public final class Emulator {
}
public static Date modifyDate(Date date, String timeString) {
int totalSeconds = 0;
Calendar c = Calendar.getInstance();
c.setTime(date);
@@ -88,11 +88,11 @@ public class HabboDiffieHellman {
}
if (this.DHPrime.compareTo(BigInteger.valueOf(2)) < 1) {
throw new HabboCryptoException("Prime cannot be <= 2!\nPrime: " + this.DHPrime.toString());
throw new HabboCryptoException("Prime cannot be <= 2!\nPrime: " + this.DHPrime);
}
if (this.DHGenerator.compareTo(this.DHPrime) > -1) {
throw new HabboCryptoException("Generator cannot be >= Prime!\nPrime: " + this.DHPrime.toString() + "\nGenerator: " + this.DHGenerator.toString());
throw new HabboCryptoException("Generator cannot be >= Prime!\nPrime: " + this.DHPrime + "\nGenerator: " + this.DHGenerator.toString());
}
generateDHKeys();
@@ -20,8 +20,8 @@ class DatabasePool {
private static DatabasePool instance;
DatabasePool() {
// Private constructor for singleton pattern
}
public static synchronized DatabasePool getInstance() {
if (instance == null) {
instance = new DatabasePool();
@@ -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.calendar.CalendarManager;
@@ -57,7 +57,6 @@ public class Achievement {
public AchievementLevel getNextLevel(int currentLevel) {
AchievementLevel l = null;
for (AchievementLevel level : this.levels.values()) {
if (level.level == (currentLevel + 1))
@@ -50,8 +50,7 @@ public class AchievementManager {
progressAchievement(habbo, achievement, amount);
} else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("" +
"INSERT INTO users_achievements_queue (user_id, achievement_id, amount) VALUES (?, ?, ?) " +
PreparedStatement statement = connection.prepareStatement("INSERT INTO users_achievements_queue (user_id, achievement_id, amount) VALUES (?, ?, ?) " +
"ON DUPLICATE KEY UPDATE amount = amount + ?")) {
statement.setInt(1, habboId);
statement.setInt(2, achievement.id);
@@ -361,7 +360,7 @@ public class AchievementManager {
}
}
if (level.badges != null && level.badges.length > 0) {
if (level.badges != null) {
for (String badge : level.badges) {
if (!badge.isEmpty()) {
if (!habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
@@ -374,10 +373,11 @@ public class AchievementManager {
}
}
if (level.perks != null && level.perks.length > 0) {
if (level.perks != null) {
for (String perk : level.perks) {
if (perk.equalsIgnoreCase("TRADE")) {
habbo.getHabboStats().perkTrade = true;
break;
}
}
}
@@ -21,6 +21,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Bot implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Bot.class);
@@ -112,7 +113,7 @@ public class Bot implements Runnable {
this.chatRandom = false;
this.chatDelay = 10;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
this.chatLines = new ArrayList<>(List.of("Default Message :D"));
this.type = bot.getType();
this.effect = bot.getEffect();
this.bubble = bot.getBubbleId();
@@ -1,7 +1,6 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -4,7 +4,6 @@ import gnu.trove.map.hash.THashMap;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Map;
public class CalendarCampaign {
@@ -9,8 +9,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import static java.time.temporal.ChronoUnit.DAYS;
@@ -2,21 +2,16 @@ package com.eu.habbo.habbohotel.campaign.calendar;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
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.habbohotel.users.subscriptions.Subscription;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CalendarRewardObject {
private static final Logger LOGGER = LoggerFactory.getLogger(CalendarRewardObject.class);
private final int id;
private final String productName;
@@ -3,7 +3,6 @@ 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;
@@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.campaign.calendar.CalendarRewardObject;
import com.eu.habbo.habbohotel.catalog.layouts.*;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.guilds.Guild;
@@ -19,7 +18,6 @@ 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.events.calendar.AdventCalendarProductComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.inventory.AddBotComposer;
@@ -28,8 +26,6 @@ import com.eu.habbo.messages.outgoing.inventory.AddPetComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.modtool.ModToolIssueHandledComposer;
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
import com.eu.habbo.messages.outgoing.users.UserCreditsComposer;
import com.eu.habbo.messages.outgoing.users.UserPointsComposer;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadCatalogManagerEvent;
import com.eu.habbo.plugin.events.users.catalog.UserCatalogFurnitureBoughtEvent;
import com.eu.habbo.plugin.events.users.catalog.UserCatalogItemPurchasedEvent;
@@ -805,8 +801,6 @@ public class CatalogManager {
public void purchaseItem(CatalogPage page, CatalogItem item, Habbo habbo, int amount, String extradata, boolean free) {
Item cBaseItem = null;
if (item == null || habbo.getHabboStats().isPurchasingFurniture) {
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
@@ -2,15 +2,11 @@ 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 java.sql.PreparedStatement;
import java.sql.SQLException;
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;
@@ -11,7 +11,6 @@ import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceCancelSaleC
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer;
import com.eu.habbo.messages.outgoing.users.UserCreditsComposer;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemCancelledEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemOfferedEvent;
import com.eu.habbo.plugin.events.marketplace.MarketPlaceItemSoldEvent;
@@ -16,8 +16,8 @@ public class MarketPlaceOffer implements Runnable {
public int avarage;
public int count;
private int offerId;
private Item baseItem;
private int itemId;
private final Item baseItem;
private final int itemId;
private int price;
private int limitedStack;
private int limitedNumber;
@@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
import java.util.Collections;
@@ -16,7 +15,7 @@ public class AboutCommand extends Command {
}
public static String credits = "Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral \n" +
"The Following people have all contributed to this emulator:\n" +
" TheGeneral\n Beny\n Alejandro\n Capheus\n Skeletor\n Harmonic\n Mike\n Remco\n zGrav \n Quadral \n Harmony\n Swirny\n ArpyAge\n Mikkel\n Rodolfo\n Rasmus\n Kitt Mustang\n Snaiker\n nttzx\n necmi\n Dome\n Jose Flores\n Cam\n Oliver\n Narzo\n Tenshie\n MartenM\n Ridge\n SenpaiDipper\n Snaiker\n Thijmen";
" TheGeneral\n Beny\n Alejandro\n Capheus\n Skeletor\n Harmonic\n Mike\n Remco\n zGrav \n Quadral \n Harmony\n Swirny\n ArpyAge\n Mikkel\n Rodolfo\n Rasmus\n Kitt Mustang\n Snaiker\n nttzx\n necmi\n Dome\n Jose Flores\n Cam\n Oliver\n Narzo\n Tenshie\n MartenM\n Ridge\n SenpaiDipper\n Snaiker\n Thijmen\n DuckieTM";
@Override
public boolean handle(GameClient gameClient, String[] params) {
@@ -24,7 +23,7 @@ public class AboutCommand extends Command {
int seconds = Emulator.getIntUnixTimestamp() - Emulator.getTimeStarted();
int day = (int) TimeUnit.SECONDS.toDays(seconds);
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24);
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24L);
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
@@ -4,10 +4,8 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.campaign.calendar.CalendarCampaign;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer;
import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer;
import java.sql.Timestamp;
import java.time.Duration;
import java.util.Date;
import static java.time.temporal.ChronoUnit.DAYS;
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.inventory.InventoryBotsComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
public class EmptyBotsInventoryCommand extends Command {
public EmptyBotsInventoryCommand() {
@@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.inventory.InventoryPetsComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TObjectProcedure;
public class EmptyPetsInventoryCommand extends Command {
public EmptyPetsInventoryCommand() {
@@ -24,8 +24,7 @@ public class PetInfoCommand extends Command {
@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" +
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" +
@@ -38,7 +37,7 @@ public class PetInfoCommand extends Command {
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")) + ""
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no"))
);
}
@@ -85,7 +85,7 @@ public class RedeemCommand extends Command {
if (pixels > 0) {
message[0] += ", " + Emulator.getTexts().getValue("generic.pixels");
message[0] += ": " + pixels + "";
message[0] += ": " + pixels;
}
if (!points.isEmpty()) {
@@ -8,8 +8,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserShoutComposer;
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(";"));
}
@@ -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;
@@ -3,8 +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.messages.outgoing.catalog.*;
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigComposer;
public class UpdateCalendarCommand extends Command {
@@ -2,9 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.messages.outgoing.rooms.RoomRelativeMapComposer;
public class UpdateYoutubePlaylistsCommand extends Command {
public UpdateYoutubePlaylistsCommand() {
@@ -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.GuideSessionPartnerIsPlayingComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.games.GameHabboJoinEvent;
@@ -9,7 +9,7 @@ public class GamePlayer {
private final Habbo habbo;
private GameTeamColors teamColor;
private final GameTeamColors teamColor;
private int score;
@@ -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 {
@@ -15,7 +15,7 @@ import java.util.Map;
public class FootballGame extends Game {
private Room room;
private final Room room;
public FootballGame(Room room) {
super(null, null, room, true);
@@ -22,12 +22,12 @@ public class GuardianTicket {
private final Habbo reporter;
private final Habbo reported;
private final Date date;
private ArrayList<ModToolChatLog> chatLogs;
private final ArrayList<ModToolChatLog> chatLogs;
private GuardianVoteType verdict;
private int timeLeft = 120;
private int resendCount = 0;
private int checkSum = 0;
private int guardianCount = 0; //TODO: Figure out what this was supposed to do.
private final int checkSum = 0;
private final int guardianCount = 0; //TODO: Figure out what this was supposed to do.
public GuardianTicket(Habbo reporter, Habbo reported, ArrayList<ModToolChatLog> chatLogs) {
this.chatLogs = chatLogs;
@@ -155,29 +155,7 @@ public class GuardianTicket {
public GuardianVoteType calculateVerdict() {
int countAcceptably = 0;
int countBadly = 0;
int countAwfully = 0;
int total = 0;
synchronized (this.votes) {
for (Map.Entry<Habbo, GuardianVote> set : this.votes.entrySet()) {
GuardianVote vote = set.getValue();
if (vote.type == GuardianVoteType.ACCEPTABLY) {
countAcceptably++;
} else if (vote.type == GuardianVoteType.BADLY) {
countBadly++;
} else if (vote.type == GuardianVoteType.AWFULLY) {
countAwfully++;
}
}
}
total += countAcceptably;
total += countBadly;
// Vote counting logic placeholder - currently returns fixed verdict
return GuardianVoteType.BADLY;
}
@@ -14,18 +14,18 @@ public class Guild implements Runnable {
public boolean needsUpdate;
public int lastRequested = Emulator.getIntUnixTimestamp();
private int id;
private int ownerId;
private final int ownerId;
private String ownerName;
private String name;
private String description;
private int roomId;
private final int roomId;
private String roomName;
private GuildState state;
private boolean rights;
private int colorOne;
private int colorTwo;
private String badge;
private int dateCreated;
private final int dateCreated;
private int memberCount;
private int requestCount;
private boolean forum = false;
@@ -408,8 +408,6 @@ public class GuildManager {
}
public int getGuildMembersCount(Guild guild, int page, int levelId, String query) {
ArrayList<GuildMember> guildMembers = new ArrayList<GuildMember>();
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());
statement.setString(2, "%" + query + "%");
@@ -3,9 +3,9 @@ package com.eu.habbo.habbohotel.guilds;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GuildMember implements Comparable {
private int userId;
private String username;
public class GuildMember implements Comparable<GuildMember> {
private final int userId;
private final String username;
private String look;
private int joinDate;
private GuildRank rank;
@@ -59,7 +59,7 @@ public class GuildMember implements Comparable {
}
@Override
public int compareTo(Object o) {
public int compareTo(GuildMember o) {
return 0;
}
@@ -5,7 +5,7 @@ public enum GuildMembershipStatus {
MEMBER(1),
PENDING(2);
private int status;
private final int status;
GuildMembershipStatus(int status) {
this.status = status;
@@ -16,7 +16,7 @@ import java.sql.*;
public class ForumThreadComment implements Runnable, ISerialize {
private static final Logger LOGGER = LoggerFactory.getLogger(ForumThreadComment.class);
private static THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>();
private static final THashMap<Integer, ForumThreadComment> forumCommentsCache = new THashMap<>();
private final int commentId;
private final int threadId;
private final int userId;
@@ -6,7 +6,7 @@ public enum ForumThreadState {
HIDDEN_BY_STAFF_MEMBER(10),
HIDDEN_BY_GUILD_ADMIN(20);
private int stateId;
private final int stateId;
ForumThreadState(int stateId) {
this.stateId = stateId;
@@ -5,16 +5,16 @@ import java.sql.SQLException;
public class HallOfFameWinner implements Comparable<HallOfFameWinner> {
private int id;
private final int id;
private String username;
private final String username;
private String look;
private final String look;
private int points;
private final int points;
public HallOfFameWinner(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -5,25 +5,25 @@ import java.sql.SQLException;
public class NewsWidget {
private int id;
private final int id;
private String title;
private final String title;
private String message;
private final String message;
private String buttonMessage;
private final String buttonMessage;
private int type;
private final int type;
private String link;
private final String link;
private String image;
private final String image;
public NewsWidget(ResultSet set) throws SQLException {
this.id = set.getInt("id");
@@ -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.AddHabboItemComposer;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
@@ -691,7 +694,7 @@ public class ItemManager {
if (itemClass != null) {
try {
Constructor c = itemClass.getConstructor(ResultSet.class, Item.class);
Constructor<?> c = itemClass.getConstructor(ResultSet.class, Item.class);
c.setAccessible(true);
return (HabboItem) c.newInstance(set, baseItem);
@@ -4,12 +4,12 @@ import java.sql.ResultSet;
import java.sql.SQLException;
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");
@@ -15,7 +15,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
@@ -46,7 +46,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
}
};
private THashSet<RoomTile> tiles;
private final THashSet<RoomTile> tiles;
public InteractionBuildArea(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem, defaultValues);
@@ -12,8 +12,6 @@ import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.users.UserClubComposer;
import com.eu.habbo.messages.outgoing.users.UserPermissionsComposer;
import com.eu.habbo.threading.runnables.CrackableExplode;
import com.eu.habbo.util.pathfinding.Rotation;
@@ -143,8 +143,7 @@ public class InteractionDefault extends HabboItem {
int nextEffectF = 0;
if (objects != null && objects.length == 2) {
if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
RoomTile goalTile = (RoomTile) objects[0];
if (objects[0] instanceof RoomTile goalTile && objects[1] instanceof RoomTile) {
HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y, (objects[0] != objects[1]) ? this : null);
if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
@@ -48,7 +48,7 @@ public class InteractionDice extends HabboItem {
if (client != null) {
if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentLocation())) {
if (!this.getExtradata().equalsIgnoreCase("-1")) {
FurnitureDiceRolledEvent event = (FurnitureDiceRolledEvent) Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
if (event.isCancelled())
return;
@@ -1,21 +1,11 @@
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.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.threading.runnables.RoomUnitVendingMachineAction;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import com.eu.habbo.util.pathfinding.Rotation;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class InteractionEffectVendingMachine extends InteractionVendingMachine {
public InteractionEffectVendingMachine(ResultSet set, Item baseItem) throws SQLException {
@@ -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;
@@ -16,12 +15,12 @@ import java.sql.SQLException;
public class InteractionFXBox extends InteractionDefault {
public InteractionFXBox(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
// this.setExtradata("0");
// this.setExtradata("0");
}
public InteractionFXBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
// this.setExtradata("0");
// this.setExtradata("0");
}
@Override
@@ -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");
@@ -23,7 +23,6 @@ public class InteractionFireworks extends InteractionDefault {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionFireworks.class);
private static final String STATE_EMPTY = "0"; // Not used since the removal of pixels
private static final String STATE_CHARGED = "1";
private static final String STATE_EXPLOSION = "2";
@@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions;
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.rooms.*;
@@ -9,16 +8,11 @@ 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 com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class InteractionMultiHeight extends HabboItem {
public InteractionMultiHeight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
@@ -85,7 +79,6 @@ public class InteractionMultiHeight extends HabboItem {
for(RoomTile tile : occupiedTiles) {
Collection<RoomUnit> unitsOnItem = room.getRoomUnitsAt(room.getLayout().getTile(tile.x, tile.y));
THashSet<RoomUnit> updatedUnits = new THashSet<>();
for (RoomUnit unit : unitsOnItem) {
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoal() != tile)
continue;
@@ -43,7 +43,7 @@ public class InteractionMuteArea extends InteractionCustomValues {
}
};
private THashSet<RoomTile> tiles;
private final THashSet<RoomTile> tiles;
public InteractionMuteArea(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem, defaultValues);
@@ -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;
@@ -17,7 +17,7 @@ import java.util.Objects;
public class InteractionObstacle extends HabboItem implements ICycleable {
private THashSet<RoomTile> middleTiles;
private final THashSet<RoomTile> middleTiles;
public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -10,11 +10,8 @@ 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.ServerMessage;
import com.eu.habbo.messages.incoming.rooms.users.RoomUserWalkEvent;
import com.eu.habbo.messages.outgoing.rooms.items.ItemIntStateComposer;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -22,7 +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;
@@ -6,9 +6,6 @@ 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.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -4,14 +4,9 @@ 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.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
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.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import com.eu.habbo.util.pathfinding.Rotation;
@@ -21,8 +16,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledFuture;
public class InteractionVendingMachine extends HabboItem {
public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException {
@@ -34,7 +27,7 @@ public class InteractionVendingMachine extends HabboItem {
super(id, userId, item, extradata, limitedStack, limitedSells);
this.setExtradata("0");
}
public THashSet<RoomTile> getActivatorTiles(Room room) {
THashSet<RoomTile> tiles = new THashSet<>();
RoomTile tileInFront = getSquareInFront(room.getLayout(), this);
@@ -63,7 +56,7 @@ public class InteractionVendingMachine extends HabboItem {
boolean inActivatorSpace = false;
for(RoomTile tile : activatorTiles) {
if(unit.getCurrentLocation().is(unit.getX(), unit.getY())) {
if(unit.getCurrentLocation().is(tile.x, tile.y)) {
inActivatorSpace = true;
}
}
@@ -1,6 +1,5 @@
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.rooms.Room;
@@ -18,7 +17,7 @@ public class InteractionVoteCounter extends HabboItem {
private boolean frozen;
private int votes;
private List<Integer> votedUsers;
private final List<Integer> votedUsers;
public InteractionVoteCounter(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -274,8 +274,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) {
@@ -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;
@@ -72,7 +72,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) {
@@ -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;
@@ -20,7 +20,7 @@ public class InteractionYoutubeTV extends HabboItem {
public int startedWatchingAt = 0;
public int offset = 0;
public boolean playing = true;
public ScheduledFuture autoAdvance = null;
public ScheduledFuture<?> autoAdvance = null;
public InteractionYoutubeTV(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
public class InteractionGameTimer extends HabboItem implements Runnable {
public class InteractionGameTimer extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionGameTimer.class);
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
@@ -286,6 +286,48 @@ public class InteractionGameTimer extends HabboItem implements Runnable {
}
public void startTimer(Room room) {
if (!isRunning) {
isRunning = true;
isPaused = false;
if(timeNow <= 0) {
timeNow = baseTime;
room.updateItem(this);
}
this.createNewGame(room);
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[]{this});
if (!threadActive) {
threadActive = true;
Emulator.getThreading().run(new GameTimer(this), 1000);
}
}
}
public void pauseTimer(Room room) {
if (isRunning && !isPaused) {
isPaused = true;
pause(room);
}
}
public void resumeTimer(Room room) {
if (!this.isRunning) {
startTimer(room);
return;
}
if (this.isPaused) {
this.isPaused = false;
this.unpause(room);
if (!this.threadActive) {
this.threadActive = true;
Emulator.getThreading().run(new GameTimer(this), 1000);
}
}
}
private void increaseTimer(Room room) {
if (this.isRunning)
return;
@@ -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
@@ -167,7 +167,7 @@ public class InteractionFootball extends InteractionPushable {
BigDecimal topItemHeight = BigDecimal.valueOf(topItem.getZ() + topItem.getBaseItem().getHeight());
BigDecimal ballHeight = BigDecimal.valueOf(this.getZ());
if (topItemHeight.subtract(ballHeight).compareTo(new BigDecimal(1.65)) > 0) {
if (topItemHeight.subtract(ballHeight).compareTo(new BigDecimal("1.65")) > 0) {
return false;
}
@@ -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
@@ -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;
@@ -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;
@@ -4,5 +4,5 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
public interface ConditionalGate {
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects);
void onRejected(RoomUnit roomUnit, Room room, Object[] objects);
}
@@ -5,8 +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 com.eu.habbo.messages.outgoing.inventory.UserEffectsListComposer;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
@@ -84,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;
}
@@ -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;
@@ -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<HabboItem> items;
private final THashSet<HabboItem> items;
public WiredConditionFurniHaveFurni(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -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;
@@ -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;
@@ -21,7 +20,7 @@ import java.util.stream.Collectors;
public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.STUFF_IS;
private THashSet<HabboItem> items = new THashSet<>();
private final THashSet<HabboItem> items = new THashSet<>();
public WiredConditionFurniTypeMatch(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -45,8 +44,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
if (stuff != null) {
if (stuff.length >= 1) {
if (stuff[0] instanceof HabboItem) {
HabboItem triggeringItem = (HabboItem)stuff[0];
if (stuff[0] instanceof HabboItem triggeringItem) {
return this.items.stream().anyMatch(item -> item == triggeringItem);
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -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;
@@ -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;
@@ -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<WiredMatchFurniSetting> settings;
private final THashSet<WiredMatchFurniSetting> settings;
private boolean state;
private boolean position;
@@ -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;
@@ -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;
@@ -24,7 +23,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_FURNI;
private boolean all;
private THashSet<HabboItem> items;
private final THashSet<HabboItem> items;
public WiredConditionNotFurniHaveFurni(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -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;
@@ -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;
@@ -21,7 +20,7 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_STUFF_IS;
private THashSet<HabboItem> items = new THashSet<>();
private final THashSet<HabboItem> items = new THashSet<>();
public WiredConditionNotFurniTypeMatch(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
@@ -40,8 +39,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
if (stuff != null) {
if (stuff.length >= 1) {
if (stuff[0] instanceof HabboItem) {
HabboItem triggeringItem = (HabboItem)stuff[0];
if (stuff[0] instanceof HabboItem triggeringItem) {
return this.items.stream().noneMatch(item -> item == triggeringItem);
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -39,7 +39,7 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString(this.botName + ((char) 9) + "" + this.botLook);
message.appendString(this.botName + ((char) 9) + this.botLook);
message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getType().code);
@@ -42,7 +42,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString(this.botName + "" + ((char) 9) + "" + this.message);
message.appendString(this.botName + ((char) 9) + this.message);
message.appendInt(1);
message.appendInt(this.mode);
message.appendInt(0);
@@ -45,7 +45,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString(this.botName + "" + ((char) 9) + "" + this.message);
message.appendString(this.botName + ((char) 9) + this.message);
message.appendInt(1);
message.appendInt(this.mode);
message.appendInt(0);
@@ -13,7 +13,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.users.RoomUserEffectComposer;
@@ -26,7 +25,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class WiredEffectBotTeleport extends InteractionWiredEffect {
public static final WiredEffectType type = WiredEffectType.BOT_TELEPORT;
@@ -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;
@@ -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;
@@ -11,7 +11,6 @@ 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.outgoing.hotelview.BonusRareComposer;
import gnu.trove.procedure.TObjectProcedure;

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