- Баллы
- 36
Всем привет, возникла такая проблема: если сохранять текущий инвентарь игрока в конфиг при помощи:
и потом перезапустить сервер, то в консоли вылазит дофига ошибок, а весь конфиг удаляется.
Собственно как решить? Или посоветуйте другой способ сохранить вещи в конфиг.
PS: сохранение происходит с-под команды
Java:
int index = Integer.parseInt(args[0]);
Inventory inv = Bukkit.getPlayer(sender.getName()).getInventory();
config.set("clans.battle.armorList." + index, inv);
Собственно как решить? Или посоветуйте другой способ сохранить вещи в конфиг.
Код:
[21:18:09] [Server thread/ERROR]: Cannot load plugins\VLmoney\config.yml
org.bukkit.configuration.InvalidConfigurationException: could not determine a constructor for the tag tag:yaml.org,2002:org.bukkit.craftbukkit.v1_8_R1.inventory.CraftInventoryPlayer
in 'string', line 4, column 12:
'0': !!org.bukkit.craftbukkit.v1_8_R1 ...
^
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:180) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:188) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:162) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at ua.rivne.vlnet.mainPluginTeaCraft.mainClass.onEnable(mainClass.java:42) [VLmoney.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.reload(CraftServer.java:746) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.Bukkit.reload(Bukkit.java:534) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_79]
at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_79]
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: could not determine a constructor for the tag tag:yaml.org,2002:org.bukkit.craftbukkit.v1_8_R1.inventory.CraftInventoryPlayer
in 'string', line 4, column 12:
'0': !!org.bukkit.craftbukkit.v1_8_R1 ...
^
at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructUndefined.construct(SafeConstructor.java:501) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:485) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:485) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:485) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:485) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.yaml.snakeyaml.Yaml.load(Yaml.java:400) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) ~[mcoffline_server.jar:git-Spigot-c3c767f-33d5de3]
... 28 more
PS: сохранение происходит с-под команды
, но строка явно лишняя, можно ведь:
)
