diff --git a/sqlupdates/3_0_0 to 3_0_1.sql b/sqlupdates/3_0_0 to 3_0_1.sql index 674b2097..4a1d34e7 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', '1'); 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(); }