summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ThreadCommandReader.java
blob: 0158e96a0ffdb3359c2bf33eeb45c494a2d777a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package net.minecraft.server;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

// CraftBukkit start
import java.util.logging.Level;
import java.util.logging.Logger;
import jline.ConsoleReader;
// CraftBukkit end

public class ThreadCommandReader extends Thread {

    final MinecraftServer server;

    public ThreadCommandReader(MinecraftServer minecraftserver) {
        this.server = minecraftserver;
    }

    public void run() {
        // CraftBukkit start
        ConsoleReader bufferedreader = this.server.reader;
        String s = null;
        String jlineTerminalSetting = org.bukkit.craftbukkit.Main.jlineTerminalSetting;
        // CraftBukkit end

        try {
            while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
                // CraftBukkit start - JLine disabling compatibility
                if (jlineTerminalSetting != null && jlineTerminalSetting.equals("jline.UnsupportedTerminal")) {
                    s = bufferedreader.readLine();
                } else {
                    s = bufferedreader.readLine(">", null);
                }
                if (s != null) {
                    // CraftBukkit end
                    this.server.issueCommand(s, this.server);
                }
            }
        } catch (IOException ioexception) {
            // CraftBukkit
            Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
        }
    }
}