从python文件打开minecraft服务器

时间:2020-08-22 14:18:01

标签: python server minecraft popen

你好(抱歉,我的英语不好),我一直在尝试使用子进程lib从python文件打开Minecraft服务器

from subprocess import *
import time


stop = "/stop\n".encode()
minecraft = Popen(['java', '-jar', 'server.jar', '-nogui', 'PAUSE'], stdin=PIPE)

它“起作用”,直到控制台向我显示下一个错误:

*** Warning, you've not updated in a while! ***
*** Please download a new build as per instructions from https://papermc.io/downloads ***
System Info: Java 1.8 (Java HotSpot(TM) 64-Bit Server VM 25.221-b11) Host: Windows 10 10.0 (amd64)
Loading libraries, please wait...
ago 22, 2020 4:11:30 PM org.jline.utils.Log logr
ADVERTENCIA: Error in WindowsStreamPump
java.io.IOException: ReadConsoleInputW failed
        at org.fusesource.jansi.internal.Kernel32.readConsoleInputHelper(Kernel32.java:816)
        at org.fusesource.jansi.internal.WindowsSupport.readConsoleInput(WindowsSupport.java:99)
        at org.jline.terminal.impl.jansi.win.JansiWinSysTerminal.processConsoleInput(JansiWinSysTerminal.java:112)
        at org.jline.terminal.impl.AbstractWindowsTerminal.pump(AbstractWindowsTerminal.java:458)
        at java.lang.Thread.run(Unknown Source)

我知道问题是“ stdin = PIPE”,因为如果删除它,就没有问题,并且服务器可以正常运行。但是我想像这样向服务器发送命令:

停止

天气晴朗

说“随机消息”

我也尝试删除stdin = POPE并尝试

stop = "stop\n".encode()
minecraft.comunicate(stop)

但是服务器永不停止

0 个答案:

没有答案