From 0e56cba7a1555eb820452bd1098b1c76a719834c Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 13 May 2019 13:56:47 -0400 Subject: [PATCH 1/4] Fix number formatting error in toggle furni effect --- .../wired/effects/WiredEffectToggleFurni.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 5da0bd05..1f2d95ad 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -146,7 +146,15 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer) { - item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{item.getExtradata().length() == 0 ? 0 : Integer.valueOf(item.getExtradata()), this.getType()}); + int state = 0; + if (!item.getExtradata().isEmpty()) { + try { + state = Integer.valueOf(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc. + } catch (NumberFormatException ignored) { + + } + } + item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()}); } } catch (Exception e) From 3b480db9f6ec3ef71a5d8461d617e1999fd39fce Mon Sep 17 00:00:00 2001 From: Harmony Date: Tue, 14 May 2019 20:14:15 +0100 Subject: [PATCH 2/4] Make plugins window style configurable between default and the old scrollable style --- sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql | 5 +++++ .../habbo/habbohotel/commands/PluginsCommand.java | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql diff --git a/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql b/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql new file mode 100644 index 00000000..568aeff0 --- /dev/null +++ b/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql @@ -0,0 +1,5 @@ +#DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 + +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('commands.plugins.oldstyle', '0'); + +#END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java index 26977aa6..cb129f1f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/PluginsCommand.java @@ -2,9 +2,11 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; -import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer; import com.eu.habbo.plugin.HabboPlugin; +import java.util.Collections; + public class PluginsCommand extends Command { public PluginsCommand() @@ -22,7 +24,14 @@ public class PluginsCommand extends Command message.append("\r").append(plugin.configuration.name).append(" By ").append(plugin.configuration.author); } - gameClient.getHabbo().alert(message.toString()); + + if (Emulator.getConfig().getBoolean("commands.plugins.oldstyle")) + { + gameClient.sendResponse(new MessagesForYouComposer(Collections.singletonList(message.toString()))); + } else + { + gameClient.getHabbo().alert(message.toString()); + } return true; } From b67fa1b27b55fc8e776cae2fca4dd3085fc07503 Mon Sep 17 00:00:00 2001 From: Harmony Date: Tue, 14 May 2019 20:39:35 +0100 Subject: [PATCH 3/4] Build Hash and Version for error logs in the database --- sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql | 4 ++++ src/main/java/com/eu/habbo/core/ErrorLog.java | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql b/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql index 568aeff0..7f2fe6d3 100644 --- a/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql +++ b/sqlupdates/2_0_0-RC-1_TO_2_0_0-RC-2.sql @@ -2,4 +2,8 @@ INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('commands.plugins.oldstyle', '0'); +ALTER TABLE `emulator_errors` +ADD COLUMN `version` varchar(64) NOT NULL AFTER `timestamp`, +ADD COLUMN `build_hash` varchar(64) NOT NULL AFTER `version`; + #END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/ErrorLog.java b/src/main/java/com/eu/habbo/core/ErrorLog.java index a9bf00ee..4afcf4b7 100644 --- a/src/main/java/com/eu/habbo/core/ErrorLog.java +++ b/src/main/java/com/eu/habbo/core/ErrorLog.java @@ -11,13 +11,20 @@ import java.sql.SQLException; public class ErrorLog implements Loggable { - public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, type, stacktrace) VALUES (?, ?, ?)"; + public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)"; + public final String version; + public final String buildHash; + public final int timeStamp; public final String type; public final String stackTrace; public ErrorLog(String type, Throwable e) { + + this.version = Emulator.version; + this.buildHash = Emulator.version; + this.timeStamp = Emulator.getIntUnixTimestamp(); this.type = type; @@ -38,6 +45,9 @@ public class ErrorLog implements Loggable public ErrorLog(String type, String message) { + this.version = Emulator.version; + this.buildHash = Emulator.build; + this.timeStamp = Emulator.getIntUnixTimestamp(); this.type = type; this.stackTrace = message; @@ -47,8 +57,10 @@ public class ErrorLog implements Loggable public void log(PreparedStatement statement) throws SQLException { statement.setInt(1, this.timeStamp); - statement.setString(2, this.type); - statement.setString(3, this.stackTrace); + statement.setString(2, this.version); + statement.setString(3, this.buildHash); + statement.setString(4, this.type); + statement.setString(5, this.stackTrace); statement.addBatch(); } } From 8547c452fa93ad6d50a1325a4bf875e0cdd95ed0 Mon Sep 17 00:00:00 2001 From: Harmony Date: Tue, 14 May 2019 20:44:41 +0100 Subject: [PATCH 4/4] Build Hash on the console info command --- .../com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java index 806b95d5..7c08d398 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java @@ -22,6 +22,10 @@ public class ConsoleInfoCommand extends ConsoleCommand long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); System.out.println("Emulator version: " + Emulator.version); + System.out.println("Emulator build: " + Emulator.build); + + System.out.println(""); + System.out.println("Hotel Statistics"); System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount()); System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());