配置只是说 null Spigot 插件 minecraft
Configuration just says null Spigot plugin minecraft
我一直收到这个错误,这真的很烦人,看起来一切都是正确的。我正在使用 intellij 编写代码。我正在设置一个 config.yml 并试图让它更改命令中的单词,我将字符串添加到单词中,但出现此错误,我的配置看起来不错,我看了教程。
这是我的配置文件:
\ Set the message you recieve when you do /feed
FeedYourselfMessage: 'You fed yourself, your hunger bars are full!'
\ Set the message the target player recieves when you do /feed [target]
PlayerWasFedMessage: 'You have been fed.'
\ Set the message you recieve when you do /heal
HealYourselfMessage: 'You healed yourself, you now have full hearts!'
\ Set the message the target player recieves when you do /heal [target]
PlayerWasHealedMessage: 'You have been healed.'
这是我用来制作字符串的代码
String FeedYourselfMsg = plugin.getConfig().getString("FeedYourselfMessage");
String PlayerWasFedMsg = plugin.getConfig().getString("PlayerWasFedMessage");
这里是错误
[Server thread/ERROR]: Cannot load configuration from stream
org.bukkit.configuration.InvalidConfigurationException: expected '<document start>', but found '<block mapping start>'
in 'reader', line 6, column 1:
FeedYourselfMessage: 'You fed yo ...
^
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:104) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:333) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:165) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:134) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at me.mrbloxman43.bloxtools.BloxTools.onEnable(BloxTools.java:28) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:517) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:431) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.reload(CraftServer.java:916) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.Bukkit.reload(Bukkit.java:789) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:825) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1956) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1795) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1776) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda[=12=](PlayerConnectionUtils.java:31) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1190) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:131) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.be(MinecraftServer.java:1169) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1162) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:140) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1146) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1051) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.lambda[=12=](MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.yaml.snakeyaml.parser.ParserException: expected '<document start>', but found '<block mapping start>'
in 'reader', line 6, column 1:
FeedYourselfMessage: 'You fed yo ...
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:259) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:166) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:156) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:145) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.Yaml.compose(Yaml.java:575) ~[snakeyaml-1.30.jar:?]
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:102) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
... 34 more
我解决了,基本上是我的配置有斜杠 (\),我认为这导致它无法将其识别为代码。相反,我应该使用 hashtags(#) 来制作它,这样它就不会将其识别为代码。感谢fireshadow52提供答案
我一直收到这个错误,这真的很烦人,看起来一切都是正确的。我正在使用 intellij 编写代码。我正在设置一个 config.yml 并试图让它更改命令中的单词,我将字符串添加到单词中,但出现此错误,我的配置看起来不错,我看了教程。
这是我的配置文件:
\ Set the message you recieve when you do /feed
FeedYourselfMessage: 'You fed yourself, your hunger bars are full!'
\ Set the message the target player recieves when you do /feed [target]
PlayerWasFedMessage: 'You have been fed.'
\ Set the message you recieve when you do /heal
HealYourselfMessage: 'You healed yourself, you now have full hearts!'
\ Set the message the target player recieves when you do /heal [target]
PlayerWasHealedMessage: 'You have been healed.'
这是我用来制作字符串的代码
String FeedYourselfMsg = plugin.getConfig().getString("FeedYourselfMessage");
String PlayerWasFedMsg = plugin.getConfig().getString("PlayerWasFedMessage");
这里是错误
[Server thread/ERROR]: Cannot load configuration from stream
org.bukkit.configuration.InvalidConfigurationException: expected '<document start>', but found '<block mapping start>'
in 'reader', line 6, column 1:
FeedYourselfMessage: 'You fed yo ...
^
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:104) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:333) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:165) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:134) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at me.mrbloxman43.bloxtools.BloxTools.onEnable(BloxTools.java:28) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:517) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:431) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.reload(CraftServer.java:916) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at org.bukkit.Bukkit.reload(Bukkit.java:789) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:825) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1956) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1795) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1776) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda[=12=](PlayerConnectionUtils.java:31) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1190) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:131) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.be(MinecraftServer.java:1169) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1162) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:140) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1146) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1051) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at net.minecraft.server.MinecraftServer.lambda[=12=](MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3453-Spigot-ffceeae-64db512]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.yaml.snakeyaml.parser.ParserException: expected '<document start>', but found '<block mapping start>'
in 'reader', line 6, column 1:
FeedYourselfMessage: 'You fed yo ...
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:259) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:166) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:156) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:145) ~[snakeyaml-1.30.jar:?]
at org.yaml.snakeyaml.Yaml.compose(Yaml.java:575) ~[snakeyaml-1.30.jar:?]
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:102) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
... 34 more
我解决了,基本上是我的配置有斜杠 (\),我认为这导致它无法将其识别为代码。相反,我应该使用 hashtags(#) 来制作它,这样它就不会将其识别为代码。感谢fireshadow52提供答案