diff --git a/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java b/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java index 19b442f..3a6ba21 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java +++ b/Emulator/src/main/java/com/eu/habbo/core/ConfigurationManager.java @@ -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() { diff --git a/Emulator/src/main/java/com/eu/habbo/core/Scheduler.java b/Emulator/src/main/java/com/eu/habbo/core/Scheduler.java index 17fae17..de7f3df 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/Scheduler.java +++ b/Emulator/src/main/java/com/eu/habbo/core/Scheduler.java @@ -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); } } \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java b/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java index 4b0bf66..5c27eed 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java +++ b/Emulator/src/main/java/com/eu/habbo/core/TextsManager.java @@ -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(); } diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index ea10362..8bdccca 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -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); } } } @@ -61,5 +61,4 @@ public abstract class ConsoleCommand { } public abstract void handle(String[] args) throws Exception; - } \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java index db7c22b..ed6d901 100644 --- a/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java +++ b/Emulator/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java @@ -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)); } } \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java index 78304cd..ff3700c 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java @@ -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) { diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java index dca2ab9..b476d34 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java @@ -39,7 +39,7 @@ public class TalentTrackLevel { if (achievement != null) { 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); } } } @@ -50,7 +50,7 @@ public class TalentTrackLevel { 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); } } diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 50ffed1..ed91590 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -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 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()); } } } diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java index 46c9c42..fbb2f16 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java @@ -218,7 +218,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable 0) { @@ -265,7 +265,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + LOGGER.info("Catalog Manager -> Loaded! ({} MS)", System.currentTimeMillis() - millis); } @@ -280,7 +280,7 @@ public class CatalogManager { Class 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()); } diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java index 6c64497..8a1a486 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogPage.java @@ -74,7 +74,7 @@ public abstract class CatalogPage implements Comparable, ISerialize this.included.add(Integer.parseInt(id)); } catch (Exception e) { LOGGER.error("Caught exception", e); - LOGGER.error("Failed to parse includes column value of (" + id + ") for catalog page (" + this.id + ")"); + LOGGER.error("Failed to parse includes column value of ({}) for catalog page ({})", id, this.id); } } } diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java index 3be967b..b765441 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/ClubOffer.java @@ -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); diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java index 25f13ee..d4f6147 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/catalog/layouts/RoomBundleLayout.java @@ -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()); } }