From 92636bbdc5661e6cfe3e24f2ee7235a55613cb60 Mon Sep 17 00:00:00 2001 From: duckietm Date: Thu, 9 Dec 2021 07:39:16 +0000 Subject: [PATCH 1/5] Update database to enable or disable TTY in console --- sqlupdates/3_0_BETA_1 to 3_0_0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlupdates/3_0_BETA_1 to 3_0_0.sql b/sqlupdates/3_0_BETA_1 to 3_0_0.sql index 31e6474c..b28d10ce 100644 --- a/sqlupdates/3_0_BETA_1 to 3_0_0.sql +++ b/sqlupdates/3_0_BETA_1 to 3_0_0.sql @@ -7,3 +7,6 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.item_count -- Enable bubble alerts INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('bubblealerts.enabled', '1'); + +-- Enable or Disable TTY in console (Default is enabled) +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '0'); From f167c6b6cd25a9e9621c5a6e6792eb552ba437e8 Mon Sep 17 00:00:00 2001 From: duckietm Date: Thu, 9 Dec 2021 07:41:10 +0000 Subject: [PATCH 2/5] Adding TTY setting in the emulator --- src/main/java/com/eu/habbo/Emulator.java | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 97fe313a..affec180 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -175,26 +175,30 @@ public final class Emulator { Runtime.getRuntime().availableProcessors() * 2); } - Emulator.getThreading().run(() -> { }, 1500); - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + // Check if console mode is true or false, default is true + if (Emulator.getConfig().getBoolean("console.mode", true)) { - while (!isShuttingDown && isReady) { - try { - String line = reader.readLine(); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - if (line != null) { - ConsoleCommand.handle(line); - } - System.out.println("Waiting for command: "); - } catch (Exception e) { - if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) { - LOGGER.error("Error while reading command", e); + while (!isShuttingDown && isReady) { + try { + String line = reader.readLine(); + + if (line != null) { + ConsoleCommand.handle(line); + } + System.out.println("Waiting for command: "); + } catch (Exception e) { + if (!(e instanceof IOException && e.getMessage().equals("Bad file descriptor"))) { + LOGGER.error("Error while reading command", e); + } } } } + } catch (Exception e) { e.printStackTrace(); } From a5d11b98e2e9ce81d0eea1fa93034744c383c3c1 Mon Sep 17 00:00:00 2001 From: duckietm Date: Mon, 20 Dec 2021 20:13:31 +0000 Subject: [PATCH 3/5] Move the update --- sqlupdates/3_0_BETA_1 to 3_0_0.sql | 3 --- 1 file changed, 3 deletions(-) diff --git a/sqlupdates/3_0_BETA_1 to 3_0_0.sql b/sqlupdates/3_0_BETA_1 to 3_0_0.sql index b28d10ce..31e6474c 100644 --- a/sqlupdates/3_0_BETA_1 to 3_0_0.sql +++ b/sqlupdates/3_0_BETA_1 to 3_0_0.sql @@ -7,6 +7,3 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.item_count -- Enable bubble alerts INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('bubblealerts.enabled', '1'); - --- Enable or Disable TTY in console (Default is enabled) -INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '0'); From 7d8c4747a71beae795d5a58223aab1e4557732b6 Mon Sep 17 00:00:00 2001 From: duckietm Date: Mon, 20 Dec 2021 20:13:55 +0000 Subject: [PATCH 4/5] Update 3_0_0 to 3_0_1.sql --- sqlupdates/3_0_0 to 3_0_1.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sqlupdates/3_0_0 to 3_0_1.sql b/sqlupdates/3_0_0 to 3_0_1.sql index 674b2097..b41da52a 100644 --- a/sqlupdates/3_0_0 to 3_0_1.sql +++ b/sqlupdates/3_0_0 to 3_0_1.sql @@ -1,4 +1,7 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('wired.place.under', '0'); INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('wired.custom.enabled', '0'); -INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_stalk.forgot_username', 'Specify the username of the Habbo you want to follow!'); \ No newline at end of file +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_stalk.forgot_username', 'Specify the username of the Habbo you want to follow!'); + +-- Enable or Disable TTY in console (Default is enabled) +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '0'); From 8b7859e5590206e34088ac71c49f3378626f3695 Mon Sep 17 00:00:00 2001 From: duckietm Date: Mon, 20 Dec 2021 20:24:18 +0000 Subject: [PATCH 5/5] Console output enabled by default --- sqlupdates/3_0_0 to 3_0_1.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlupdates/3_0_0 to 3_0_1.sql b/sqlupdates/3_0_0 to 3_0_1.sql index b41da52a..4a1d34e7 100644 --- a/sqlupdates/3_0_0 to 3_0_1.sql +++ b/sqlupdates/3_0_0 to 3_0_1.sql @@ -4,4 +4,4 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('wired.custom.enabled', INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_stalk.forgot_username', 'Specify the username of the Habbo you want to follow!'); -- Enable or Disable TTY in console (Default is enabled) -INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '0'); +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('console.mode', '1');