🆙 Cleanup 1

This commit is contained in:
duckietm 2025-02-04 11:03:37 +01:00
parent 760a56745f
commit 9060541fab
13 changed files with 36 additions and 37 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);
}
}
}
@ -61,5 +61,4 @@ public abstract class ConsoleCommand {
}
public abstract void handle(String[] args) throws Exception;
}

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

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

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,7 +265,7 @@ 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 {

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.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);
}
}
}

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