Refactored string comparisons to use equalsIgnoreCase, replaced valueOf with...

This commit is contained in:
Yordi 2025-01-24 20:24:38 +00:00 committed by ArpyAge
parent 1b79b1c9a4
commit 5e5ded4398
137 changed files with 274 additions and 278 deletions

View File

@ -92,7 +92,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() + "`");
LOGGER.info("Cannot find environment-value for variable `{}`", entry.getValue());
} else {
this.properties.setProperty(entry.getKey(), envValue);
}
@ -127,7 +127,7 @@ public class ConfigurationManager {
LOGGER.error("Caught SQL exception", e);
}
LOGGER.info("Configuration -> loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Configuration -> loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public void saveToDatabase() {

View File

@ -31,6 +31,6 @@ public class Scheduler implements Runnable {
if (this.disposed)
return;
Emulator.getThreading().run(this, this.interval * 1000);
Emulator.getThreading().run(this, this.interval * 1000L);
}
}

View File

@ -21,7 +21,7 @@ public class TextsManager {
try {
this.reload();
LOGGER.info("Texts Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Texts Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -48,11 +48,11 @@ public abstract class ConsoleCommand {
LOGGER.error("Caught exception", e);
}
} else {
LOGGER.info("Unknown Console Command " + message[0]);
LOGGER.info("Commands Available (" + commands.size() + "): ");
LOGGER.info("Unknown Console Command {}", message[0]);
LOGGER.info("Commands Available ({}): ", commands.size());
for (ConsoleCommand c : commands.values()) {
LOGGER.info(c.key + " - " + c.usage);
LOGGER.info("{} - {}", c.key, c.usage);
}
}
}

View File

@ -18,25 +18,25 @@ public class ConsoleInfoCommand extends ConsoleCommand {
public void handle(String[] args) throws Exception {
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);
LOGGER.info("Emulator version: " + Emulator.version);
LOGGER.info("Emulator build: " + Emulator.build);
LOGGER.info("Emulator build: {}", Emulator.build);
LOGGER.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("- Users: {}", Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
LOGGER.info("- Rooms: {}", Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());
LOGGER.info("- Shop: {} pages and {} items.", Emulator.getGameEnvironment().getCatalogManager().catalogPages.size(), CatalogManager.catalogItemAmount);
LOGGER.info("- Furni: {} items.", Emulator.getGameEnvironment().getItemManager().getItems().size());
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");
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: {}/{}MB", (Emulator.getRuntime().totalMemory() - Emulator.getRuntime().freeMemory()) / (1024 * 1024), (Emulator.getRuntime().freeMemory()) / (1024 * 1024));
LOGGER.info("- CPU Cores: {}", Emulator.getRuntime().availableProcessors());
LOGGER.info("- Total Memory: {}MB", Emulator.getRuntime().maxMemory() / (1024 * 1024));
}
}

View File

@ -288,7 +288,7 @@ public class AchievementManager {
}
}
LOGGER.info("Achievement Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Achievement Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public Achievement getAchievement(String name) {

View File

@ -34,23 +34,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);
LOGGER.error("Could not find achievement with ID {} for talenttrack level {} of type {}", achievements[i], this.level, 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);
LOGGER.error("Incorrect reward furni (ID: {}) for talent track level {}", s, this.level);
}
}

View File

@ -45,7 +45,7 @@ public class BotManager {
this.reload();
LOGGER.info("Bot Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Bot Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public static void addBotDefinition(String type, Class<? extends Bot> botClazz) throws Exception {
@ -60,10 +60,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!");
LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '{}'. No Such Method!", set.getKey());
return false;
} catch (Exception e) {
LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
LOGGER.info("Bot Manager -> Failed to execute initialise method upon bot type '{}'. Error: {}", set.getKey(), e.getMessage());
return false;
}
}
@ -209,7 +209,7 @@ public class BotManager {
if (botClazz != null)
return botClazz.getDeclaredConstructor(ResultSet.class).newInstance(set);
else
LOGGER.error("Unknown Bot Type: " + type);
LOGGER.error("Unknown Bot Type: {}", type);
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
} catch (Exception e) {
@ -237,9 +237,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!");
LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '{}'. No Such Method!", set.getKey());
} catch (Exception e) {
LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '" + set.getKey() + "'. Error: " + e.getMessage());
LOGGER.info("Bot Manager -> Failed to execute dispose method upon bot type '{}'. Error: {}", set.getKey(), e.getMessage());
}
}
}

View File

@ -218,7 +218,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
identifier = Integer.parseInt(itemId);
} catch (Exception e) {
LOGGER.info("Invalid value (" + itemId + ") for items_base column for catalog_item id (" + this.id + "). Value must be integer or of the format of integer:amount;integer:amount");
LOGGER.info("Invalid value ({}) for items_base column for catalog_item id ({}). Value must be integer or of the format of integer:amount;integer:amount", itemId, this.id);
continue;
}
if (identifier > 0) {
@ -265,12 +265,12 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
}
} catch (Exception e) {
LOGGER.debug("Failed to load " + this.itemId);
LOGGER.debug("Failed to load {}", this.itemId);
LOGGER.error("Caught exception", e);
}
} else {
try {
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(this.itemId));
Item item = Emulator.getGameEnvironment().getItemManager().getItem(Integer.parseInt(this.itemId));
if (item != null) {
this.allowGift = item.allowGift();

View File

@ -221,7 +221,7 @@ public class CatalogManager {
this.ecotronItem = Emulator.getGameEnvironment().getItemManager().getItem("ecotron_box");
LOGGER.info("Catalog Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Catalog Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
@ -280,7 +280,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"));
LOGGER.info("Unknown Page Layout: {}", set.getString("page_layout"));
continue;
}
@ -305,7 +305,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 + ")");
LOGGER.info("Parent Page not found for {} (ID: {}, parent_id: {})", object.getPageName(), object.id, object.parentId);
}
}
return true;
@ -313,7 +313,7 @@ public class CatalogManager {
this.catalogPages.putAll(pages);
LOGGER.info("Loaded " + this.catalogPages.size() + " Catalog Pages!");
LOGGER.info("Loaded {} Catalog Pages!", this.catalogPages.size());
}

View File

@ -74,7 +74,7 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
this.included.add(Integer.valueOf(id));
} catch (Exception e) {
LOGGER.error("Caught exception", e);
LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")");
LOGGER.error("Failed to parse includes column value of ({}) for catalog page ({})", id, this.id);
}
}
}

View File

@ -20,7 +20,7 @@ public class ClothItem {
this.setId = new int[parts.length];
for (int i = 0; i < this.setId.length; i++) {
this.setId[i] = Integer.valueOf(parts[i]);
this.setId[i] = Integer.parseInt(parts[i]);
}
}
}

View File

@ -92,7 +92,7 @@ public class ClubOffer implements ISerialize {
message.appendInt(this.pointsType);
message.appendBoolean(this.vip);
long seconds = this.days * 86400;
long seconds = this.days * 86400L;
long secondsTotal = seconds;
@ -103,7 +103,7 @@ public class ClubOffer implements ISerialize {
seconds -= totalMonths * (86400 * 31);
int totalDays = (int) Math.floor((int) seconds / 86400.0);
seconds -= totalDays * 86400;
seconds -= totalDays * 86400L;
message.appendInt((int) secondsTotal / 86400 / 31);
message.appendInt((int) seconds);

View File

@ -48,7 +48,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() + ")");
LOGGER.error("No room id specified for room bundle {}({})", this.getPageName(), this.getId());
}
}
@ -96,7 +96,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();

View File

@ -36,8 +36,8 @@ 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) {

View File

@ -24,7 +24,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);

View File

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

View File

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

View File

@ -39,7 +39,7 @@ public class CommandHandler {
public CommandHandler() {
long millis = System.currentTimeMillis();
this.reloadCommands();
LOGGER.info("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Command Handler -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public static void addCommand(Command command) {
@ -71,7 +71,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 {

View File

@ -30,7 +30,7 @@ public class CoordsCommand extends Command {
"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" +

View File

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

View File

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

View File

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

View File

@ -18,7 +18,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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ public class PromoteTargetOfferCommand extends Command {
} else {
int offerId = 0;
try {
offerId = Integer.valueOf(offerKey);
offerId = Integer.parseInt(offerKey);
} catch (Exception e) {
}

View File

@ -35,21 +35,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]);
credits += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e) {
}
} else if (item.getBaseItem().getName().startsWith("PF_")) {
try {
pixels += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
pixels += Integer.parseInt(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e) {
}
} 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 +58,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);
}

View File

@ -36,10 +36,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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ public class SetPollCommand extends Command {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
int pollId = -1;
try {
pollId = Integer.valueOf(params[1]);
pollId = Integer.parseInt(params[1]);
} catch (Exception e) {
}

View File

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

View File

@ -25,7 +25,7 @@ public class ShutdownCommand extends Command {
} else {
if (params.length == 2) {
try {
minutes = Integer.valueOf(params[1]);
minutes = Integer.parseInt(params[1]);
} catch (Exception e) {
reason = new StringBuilder(params[1]);
}
@ -44,7 +44,7 @@ public class ShutdownCommand extends Command {
}
RoomTrade.TRADING_ENABLED = false;
ShutdownEmulator.timestamp = Emulator.getIntUnixTimestamp() + (60 * minutes);
Emulator.getThreading().run(new ShutdownEmulator(message), minutes * 60 * 1000);
Emulator.getThreading().run(new ShutdownEmulator(message), (long) minutes * 60 * 1000);
return true;
}
}

View File

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

View File

@ -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);
@ -35,7 +35,7 @@ public class TestCommand extends Command {
} else if (data[0].equalsIgnoreCase("by")) {
message.appendByte(Integer.valueOf(data[1]));
} else if (data[0].equalsIgnoreCase("sh")) {
message.appendShort(Integer.valueOf(data[1]));
message.appendShort(Integer.parseInt(data[1]));
}
}

View File

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

View File

@ -56,7 +56,7 @@ 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"));
LOGGER.error("Unknown ingredient item {}", set.getInt("crafting_recipes_ingredients.item_id"));
}
}
}

View File

@ -375,7 +375,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;

View File

@ -255,7 +255,7 @@ public class FreezeGame extends Game {
scoreboard.setExtradata("0");
}
int oldScore = Integer.valueOf(scoreboard.getExtradata());
int oldScore = Integer.parseInt(scoreboard.getExtradata());
if (oldScore == totalScore)
continue;

View File

@ -45,7 +45,7 @@ public class GuardianTicket {
this.votes.put(guardian, new GuardianVote(this.guardianCount, guardian));
Emulator.getThreading().run(new GuardianNotAccepted(this, guardian), Emulator.getConfig().getInt("guardians.accept.timer") * 1000);
Emulator.getThreading().run(new GuardianNotAccepted(this, guardian), Emulator.getConfig().getInt("guardians.accept.timer") * 1000L);
}

View File

@ -38,7 +38,7 @@ public class GuildManager {
this.loadGuildParts();
this.loadGuildViews();
LOGGER.info("Guild Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Guild Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}

View File

@ -45,12 +45,12 @@ 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.");
LOGGER.error("Invalid configuration of crackable prizes (item id: {}). '{}' format should be itemId:chance.", this.itemId, prize);
} else {
itemId = Integer.valueOf(prize.replace(":", ""));
itemId = Integer.parseInt(prize.replace(":", ""));
}
this.prizes.put(itemId, new AbstractMap.SimpleEntry<>(this.totalChance, this.totalChance + chance));

View File

@ -55,7 +55,7 @@ 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) {
@ -103,7 +103,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(" ", "")));
}
}

View File

@ -106,7 +106,7 @@ public class ItemManager {
this.highscoreManager.load();
this.loadNewUserGifts();
LOGGER.info("Item Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Item Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
protected void loadItemInteractions() {
@ -557,7 +557,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);
}
@ -758,7 +758,7 @@ public class ItemManager {
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) {

View File

@ -25,7 +25,7 @@ public class RandomStateParams {
this.delay = Integer.parseInt(keyValue[1]);
break;
default:
LOGGER.warn("RandomStateParams: unknown key: " + keyValue[0]);
LOGGER.warn("RandomStateParams: unknown key: {}", keyValue[0]);
break;
}
});

View File

@ -118,7 +118,7 @@ public class YoutubeManager {
e.printStackTrace();
}
LOGGER.info("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("YouTube Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
});
}

View File

@ -42,7 +42,7 @@ public class InteractionColorPlate extends InteractionDefault {
}
try {
state = Integer.valueOf(this.getExtradata());
state = Integer.parseInt(this.getExtradata());
} catch (Exception e) {
LOGGER.error("Caught exception", e);
}

View File

@ -40,7 +40,7 @@ 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.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtradata()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + "");
serverMessage.appendInt(Integer.valueOf(this.getExtradata()));
serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()));

View File

@ -77,9 +77,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() + ")");
LOGGER.error("Incorrect extradata ({}) for item ID ({}) of type ({})", this.getExtradata(), this.getId(), this.getBaseItem().getName());
}
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());

View File

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

View File

@ -129,7 +129,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() + ")");
LOGGER.error("Incorrect customparams ({}) for base item ID ({}) of type ({})", this.getBaseItem().getCustomParams(), this.getBaseItem().getId(), this.getBaseItem().getName());
}
}

View File

@ -32,7 +32,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
LOGGER.warn("Incorrect extradata for gift with ID {}", this.getId());
}
}
@ -42,7 +42,7 @@ public class InteractionGift extends HabboItem {
try {
this.loadData();
} catch (Exception e) {
LOGGER.warn("Incorrect extradata for gift with ID " + this.getId());
LOGGER.warn("Incorrect extradata for gift with ID {}", this.getId());
}
}
@ -94,16 +94,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];

View File

@ -23,9 +23,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!");
LOGGER.error("Warning: Item {} has an invalid song id set for its music disk!", this.getId());
}
}
}
@ -37,9 +37,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!");
LOGGER.error("Warning: Item {} has an invalid song id set for its music disk!", this.getId());
}
}
}

View File

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

View File

@ -36,8 +36,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()) {
@ -233,8 +233,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);
}

View File

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

View File

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

View File

@ -36,7 +36,7 @@ public class InteractionWiredHighscore extends HabboItem {
try {
String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0];
int ctype = Integer.valueOf(this.getBaseItem().getName().split("\\*")[1]) - 1;
int ctype = Integer.parseInt(this.getBaseItem().getName().split("\\*")[1]) - 1;
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
@ -54,7 +54,7 @@ public class InteractionWiredHighscore extends HabboItem {
try {
String name = this.getBaseItem().getName().split("_")[1].toUpperCase().split("\\*")[0];
int ctype = Integer.valueOf(this.getBaseItem().getName().split("\\*")[1]) - 1;
int ctype = Integer.parseInt(this.getBaseItem().getName().split("\\*")[1]) - 1;
this.scoreType = WiredHighscoreScoreType.valueOf(name);
this.clearType = WiredHighscoreClearType.values()[ctype];
} catch (Exception e) {
@ -89,7 +89,7 @@ public class InteractionWiredHighscore extends HabboItem {
}
try {
int state = Integer.valueOf(this.getExtradata());
int state = Integer.parseInt(this.getExtradata());
this.setExtradata(Math.abs(state - 1) + "");
room.updateItem(this);
} catch (Exception e) {

View File

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

View File

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

View File

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

View File

@ -138,7 +138,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];
}

View File

@ -152,8 +152,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];
}

View File

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

View File

@ -166,7 +166,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];

View File

@ -220,14 +220,14 @@ public class WiredEffectBotTeleport 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);

View File

@ -171,14 +171,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);

View File

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

View File

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

View File

@ -117,10 +117,10 @@ 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]);
this.amount = Integer.parseInt(this.getWiredData().split("\t")[1]);
} catch (Exception e) {
}
}

View File

@ -117,10 +117,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) {
}
}

View File

@ -81,12 +81,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")) {
@ -197,7 +197,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;
}
}

View File

@ -116,9 +116,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);

View File

@ -79,10 +79,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);

View File

@ -78,10 +78,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])];
}
}

View File

@ -89,7 +89,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];

View File

@ -69,7 +69,7 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
this.setDelay(data.delay);
}
else {
this.setDelay(Integer.valueOf(wiredData));
this.setDelay(Integer.parseInt(wiredData));
}
}

View File

@ -104,8 +104,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) {
}

View File

@ -132,7 +132,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];
}

View File

@ -56,7 +56,7 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
this.repeatTime = data.repeatTime;
} else {
if (wiredData.length() >= 1) {
this.repeatTime = (Integer.valueOf(wiredData));
this.repeatTime = (Integer.parseInt(wiredData));
}
}

View File

@ -55,7 +55,7 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
this.repeatTime = data.repeatTime;
} else {
if (wiredData.length() >= 1) {
this.repeatTime = (Integer.valueOf(wiredData));
this.repeatTime = (Integer.parseInt(wiredData));
}
}

View File

@ -45,7 +45,7 @@ public class ModToolManager {
this.tickets = new THashMap<>();
this.cfhCategories = new TIntObjectHashMap<>();
this.loadModTool();
LOGGER.info("ModTool Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("ModTool Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public static void requestUserInfo(GameClient client, ClientMessage packet) {

View File

@ -26,7 +26,7 @@ public class ModToolSanctions {
this.sanctionLevelsHashmap = new THashMap<>();
this.loadModSanctions();
LOGGER.info("Sanctions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Sanctions Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public synchronized void loadModSanctions() {

View File

@ -33,7 +33,7 @@ public class WordFilter {
public WordFilter() {
long start = System.currentTimeMillis();
this.reload();
LOGGER.info("WordFilter -> Loaded! (" + (System.currentTimeMillis() - start) + " MS)");
LOGGER.info("WordFilter -> Loaded! ({} MS)", System.currentTimeMillis() - start);
}
private static String stripDiacritics(String str) {

View File

@ -18,7 +18,7 @@ public class EventCategory {
if (parts.length != 3) throw new Exception("A serialized event category should contain 3 fields");
this.id = Integer.valueOf(parts[0]);
this.id = Integer.parseInt(parts[0]);
this.caption = parts[1];
this.visible = parts[2].equalsIgnoreCase("true");
}

View File

@ -38,7 +38,7 @@ public class NavigatorManager {
this.filters.put(NavigatorUserFilter.name, new NavigatorUserFilter());
this.filters.put(NavigatorFavoriteFilter.name, new NavigatorFavoriteFilter());
LOGGER.info("Navigator Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Navigator Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public void loadNavigator() {

View File

@ -29,7 +29,7 @@ public class PermissionsManager {
this.reload();
LOGGER.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Permissions Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public void reload() {

View File

@ -65,7 +65,7 @@ public class Pet implements ISerialize, Runnable {
this.name = set.getString("name");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type"));
if (this.petData == null) {
LOGGER.error("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!");
LOGGER.error("WARNING! Missing pet data for type: {}! Insert a new entry into the pet_actions table for this type!", set.getInt("type"));
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(0);
}
this.race = set.getInt("race");
@ -88,7 +88,7 @@ public class Pet implements ISerialize, Runnable {
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type);
if (this.petData == null) {
LOGGER.warn("Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!");
LOGGER.warn("Missing pet data for type: {}! Insert a new entry into the pet_actions table for this type!", type);
}
this.race = race;

View File

@ -83,7 +83,7 @@ public class PetManager {
reloadPetData();
LOGGER.info("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
LOGGER.info("Pet Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis);
}
public static int getLevel(int experience) {
@ -234,10 +234,10 @@ public class PetManager {
if (petVocalsType != null) {
this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message")));
} else {
LOGGER.error("Unknown pet vocal type " + set.getString("type"));
LOGGER.error("Unknown pet vocal type {}", set.getString("type"));
}
} else {
LOGGER.error("Missing pet_actions table entry for pet id " + set.getInt("pet_id"));
LOGGER.error("Missing pet_actions table entry for pet id {}", set.getInt("pet_id"));
}
} else {
if (!PetData.generalPetVocals.containsKey(PetVocalsType.valueOf(set.getString("type").toUpperCase())))
@ -303,12 +303,12 @@ public class PetManager {
public THashSet<PetRace> getBreeds(String petName) {
if (!petName.startsWith("a0 pet")) {
LOGGER.error("Pet " + petName + " not found. Make sure it matches the pattern \"a0 pet<pet_id>\"!");
LOGGER.error("Pet {} not found. Make sure it matches the pattern \"a0 pet<pet_id>\"!", petName);
return null;
}
try {
int petId = Integer.valueOf(petName.split("t")[1]);
int petId = Integer.parseInt(petName.split("t")[1]);
return this.petRaces.get(petId);
} catch (Exception e) {
LOGGER.error("Caught exception", e);
@ -349,7 +349,7 @@ public class PetManager {
return this.petData.get(type);
} else {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
LOGGER.error("Missing petdata for type " + type + ". Adding this to the database...");
LOGGER.error("Missing petdata for type {}. Adding this to the database...", type);
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO pet_actions (pet_type) VALUES (?)")) {
statement.setInt(1, type);
statement.execute();
@ -361,7 +361,7 @@ public class PetManager {
if (set.next()) {
PetData petData = new PetData(set);
this.petData.put(type, petData);
LOGGER.error("Missing petdata for type " + type + " added to the database!");
LOGGER.error("Missing petdata for type {} added to the database!", type);
return petData;
}
}
@ -392,17 +392,17 @@ public class PetManager {
}
public Pet createPet(Item item, String name, String race, String color, GameClient client) {
int type = Integer.valueOf(item.getName().toLowerCase().replace("a0 pet", ""));
int type = Integer.parseInt(item.getName().toLowerCase().replace("a0 pet", ""));
if (this.petData.containsKey(type)) {
Pet pet;
if (type == 15)
pet = new HorsePet(type, Integer.valueOf(race), color, name, client.getHabbo().getHabboInfo().getId());
pet = new HorsePet(type, Integer.parseInt(race), color, name, client.getHabbo().getHabboInfo().getId());
else if (type == 16)
pet = this.createMonsterplant(null, client.getHabbo(), false, null, 0);
else
pet = new Pet(type,
Integer.valueOf(race),
Integer.parseInt(race),
color,
name,
client.getHabbo().getHabboInfo().getId()

View File

@ -2254,7 +2254,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
game = gameType.getDeclaredConstructor(Room.class).newInstance(this);
this.addGame(game);
} catch (Exception e) {
LOGGER.error("Error getting game " + gameType.getName(), e);
LOGGER.error("Error getting game {}", gameType.getName(), e);
}
}

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