Skip to content

Commit

Permalink
Ну и хуйня, фикс хуйни
Browse files Browse the repository at this point in the history
  • Loading branch information
lokha committed Sep 23, 2018
1 parent f460597 commit 07f729c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import org.apache.logging.log4j.Logger;
import org.jline.reader.*;
import org.jline.reader.LineReader.Option;
import org.jline.reader.impl.LineReaderImpl;
import org.jline.terminal.Terminal;
import ua.lokha.spigotloggerforbungee.CommandCompleter;
import ua.lokha.spigotloggerforbungee.SpigotLoggerForBungeePlugin;
import ua.lokha.spigotloggerforbungee.utils.Try;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
Expand All @@ -21,6 +24,12 @@
* this class from paperspigot: com.destroystokyo.paper.console.TerminalHandler
*/
public class TerminalHandler {
private static Field LineReaderImpl_reading = Try.unchecked(() -> {
final Field reading = LineReaderImpl.class.getDeclaredField("reading");
reading.setAccessible(true);
return reading;
});

private TerminalHandler() {
}

Expand All @@ -40,7 +49,13 @@ public static boolean handleCommands(BungeeCord bungeeCord, SpigotLoggerForBunge
try {
String line;
try {
if (reader instanceof LineReaderImpl) {
LineReaderImpl_reading.set(reader, false);
}
line = reader.readLine("> ");
if (reader instanceof LineReaderImpl) {
LineReaderImpl_reading.set(reader, true);
}
} catch (EndOfFileException var9) {
continue;
}
Expand Down

0 comments on commit 07f729c

Please sign in to comment.