如何解决这个错误:控制台无法读取数据

huangapple go评论65阅读模式
英文:

How i can solve this error: Console can't read data

问题

我正在编写一个Minecraft插件(这是我的第一个**“真实”**插件,其他都是测试),但我不知道为什么会出现这个错误。

«我不知道这个错误叫什么,大部分帖子都是西班牙语,因为我来自厄瓜多尔 »

我猜想这段代码导致了这个错误:

 @Override
    public void onEnable() {
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN+"Anti-lag enabled");
    }

或者在 plugin.yml 中:

# 这是私有插件...
name: Anti-lag
version: 1.16.1.0.1
api-version: 1.16.1 
# 添加在Stack Overflow:我不知道API版本是否正确。
author: me

main: private.private.antilag.anti_lag
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

如果你想阅读所有服务器(控制台)日志,请点击下面的链接。

点击这里查看完整的服务器线程

[17:26:29 ERROR]: Failed to read console input
java.io.IOException: Invalid controller
	at java.io.FileInputStream.readBytes(Native Method) ~[?:1.8.0_191]
	at java.io.FileInputStream.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedInputStream.read1(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedInputStream.read(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.InputStreamReader.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.fill(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_191]
	at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:180) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:143) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.DedicatedServer$1.run(DedicatedServer.java:66) ~[patched_1.16.1.jar:git-Paper-131]
	Suppressed: java.io.IOException: Controlador no válido
		...
		省略其他错误信息

如果你能帮助我,我会非常感谢你的回答。

英文:

I'm coding a Minecraft plugin (my first "real" plugin the others were tests) but I don't know why this error is happening.

«I don't know how this error is called & most of this thread is in Spanish because I'm from Ecuador »

I guess this code produces this error:

 @Override
    public void onEnable() {
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN+"Anti-lag enabled);
    }

or is in the plugin.yml: <a><strong>⬇️</strong></a>

# This plugin is private...  
name: Anti-lag
version: 1.16.1.0.1
api-version: 1.16.1 
# Added in Stack Overflow: Idk if the API version is correct.
author: me

main: private.private.antilag.anti_lag
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

If you want to read the all server (console) logs click in the link below.

Click Here for the full server thread..

[17:26:29 ERROR]: Failed to read console input
java.io.IOException: Invalid controller
	at java.io.FileInputStream.readBytes(Native Method) ~[?:1.8.0_191]
	at java.io.FileInputStream.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedInputStream.read1(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedInputStream.read(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:1.8.0_191]
	at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.InputStreamReader.read(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.fill(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_191]
	at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_191]
	at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:180) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:143) ~[patched_1.16.1.jar:git-Paper-131]
	at net.minecraft.server.v1_16_R1.DedicatedServer$1.run(DedicatedServer.java:66) ~[patched_1.16.1.jar:git-Paper-131]
	Suppressed: java.io.IOException: Controlador no v&#225;lido
		at java.io.FileInputStream.close0(Native Method) ~[?:1.8.0_191]
		at java.io.FileInputStream.access$000(Unknown Source) ~[?:1.8.0_191]
		at java.io.FileInputStream$1.close(Unknown Source) ~[?:1.8.0_191]
		at java.io.FileDescriptor.closeAll(Unknown Source) ~[?:1.8.0_191]
		at java.io.FileInputStream.close(Unknown Source) ~[?:1.8.0_191]
		at java.io.BufferedInputStream.close(Unknown Source) ~[?:1.8.0_191]
		at sun.nio.cs.StreamDecoder.implClose(Unknown Source) ~[?:1.8.0_191]
		at sun.nio.cs.StreamDecoder.close(Unknown Source) ~[?:1.8.0_191]
		at java.io.InputStreamReader.close(Unknown Source) ~[?:1.8.0_191]
		at java.io.BufferedReader.close(Unknown Source) ~[?:1.8.0_191]
		at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:183) ~[patched_1.16.1.jar:git-Paper-131]
		at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:143) ~[patched_1.16.1.jar:git-Paper-131]
		at net.minecraft.server.v1_16_R1.DedicatedServer$1.run(DedicatedServer.java:66) ~[patched_1.16.1.jar:git-Paper-131]

Thanks if you help me i'll be observant of your responses.

答案1

得分: 0

恭喜你的第一个插件!看起来错误确实是由你的plugin.yml中的API版本引起的:

将"api-version: 1.16.1"更改为"api-version: 1.16"应该解决了这个问题。在使用api-version时,只需要使用主要版本号(比如1.13、1.14等),不需要使用次要版本号(1.13.1、1.14.2等)。

奇怪的是,"无效的控制器"错误似乎是Minecraft本身的一个错误,但幸运的是,根据Mojang的解释,"不应该有任何副作用,可以忽略"。这与你所做的无关 如何解决这个错误:控制台无法读取数据

英文:

Congrats on your first plugin! Looks like the error is indeed being caused by the API version in your plugin.yml:

[17:26:33 ERROR]: Could not load &#39;plugins\Anti-lag.jar&#39; in folder &#39;plugins&#39;
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.1
at org.bukkit.craftbukkit.v1_16_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:290) ~[patched_1.16.1.jar:git-Paper-131]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[patched_1.16.1.jar:git-Paper-131]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:397) ~[patched_1.16.1.jar:git-Paper-131]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:305) ~[patched_1.16.1.jar:git-Paper-131]
at org.bukkit.craftbukkit.v1_16_R1.CraftServer.loadPlugins(CraftServer.java:388) ~[patched_1.16.1.jar:git-Paper-131]
at net.minecraft.server.v1_16_R1.DedicatedServer.init(DedicatedServer.java:208) ~[patched_1.16.1.jar:git-Paper-131]
at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:941) ~[patched_1.16.1.jar:git-Paper-131]
at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.1.jar:git-Paper-131]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]

Switching "api-version: 1.16.1" to "api-version: 1.16" should resolve the problem. When using api-version, you only need to use the major release numbers (such as 1.13, 1.14, etc.) and not the minor release numbers (1.13.1, 1.14.2, etc.).

Strangely enough, the "Invalid Controller" error seems to be a bug within Minecraft itself, but luckily "should not have any side effects and can be ignored" according to Mojang's explanation. Nothing you did 如何解决这个错误:控制台无法读取数据

huangapple
  • 本文由 发表于 2020年8月7日 07:35:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/63293163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定