Serialised Arena object does not load from file
pgmann opened this issue · 22 comments
The following error occurs when an arena exists and the plugin attempts to load it on enable, or any other time it uses reloadConfig();
. @AmauryCarrade, would you help please, since you were the one wrote the ArenasManager in the first place?
Error log:
09.09 12:30:05 [Multicraft] Skipped 44 lines due to rate limit (30/s)
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:184) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:850) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1013) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at co.technius.PluginManager.PMCommandExecutor.onCommand(PMCommandExecutor.java:497) [PluginManager.jar:?]
09.09 12:30:03 [Server] INFO at co.technius.PluginManager.PMCommandExecutor.loadCmd(PMCommandExecutor.java:450) [PluginManager.jar:?]
09.09 12:30:03 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at com.pgcraft.spectatorplus.SpectatorPlus.onEnable(SpectatorPlus.java:84) [SpectatorPlus-B2.0.jar:?]
09.09 12:30:03 [Server] INFO at com.pgcraft.spectatorplus.SpectatorPlus.reloadConfig(SpectatorPlus.java:575) [SpectatorPlus-B2.0.jar:?]
09.09 12:30:03 [Server] INFO at com.pgcraft.spectatorplus.ConfigAccessor.reloadConfig(ConfigAccessor.java:58) [SpectatorPlus-B2.0.jar:?]
09.09 12:30:03 [Server] INFO at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:180) [custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169) ~[custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226) ~[custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57) ~[custom.jar:git-Spigot-1624]
09.09 12:30:03 [Server] INFO org.bukkit.configuration.InvalidConfigurationException: org.yaml.snakeyaml.error.YAMLException: Could not deserialize object
09.09 12:30:03 [Server] INFO [12:30:03 ERROR]: Cannot load plugins/SpectatorPlus/setup.yml
09.09 12:30:03 [Server] INFO [12:30:03 INFO]: [SpectatorPlus] Enabling SpectatorPlus v2.0
setup.yml
:
active: true
xPos: -606.5
yPos: 72.0
zPos: -129.5
nextarena: 1
mode: arena
world: Games
arenas:
6f40672e-2e88-4b28-945f-8645daf40e50:
==: com.pgcraft.spectatorplus.Arena
id: 6f40672e-2e88-4b28-945f-8645daf40e50
registered: true
corner1:
==: Vector
x: -597.0
y: 85.0
z: 0.0
corner2:
==: Vector
x: -673.0
y: 64.0
z: -77.0
name: Event
lobby.world: Games
lobby.location:
==: Vector
x: -633.5
y: 102.0
z: -33.5
world: Games
It resets the setup.yml file right after the error. I will make the error happen again later and post the setup file.
Here is my config.yml, it's actually the original one from the error log above. I added it to the original issue post.
Here is another error log, with the same setup.yml.
10.09 08:32:31 [Multicraft] Skipped 37 lines due to rate limit (30/s)
10.09 08:32:02 [Server] INFO at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:461) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:306) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:145) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:325) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:37) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO Caused by: org.yaml.snakeyaml.error.YAMLException: Could not deserialize object
10.09 08:32:02 [Server] INFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:290) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.aB(DedicatedServer.java:326) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchServerCommand(CraftServer.java:753) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at com.pgcraft.spectatorplus.SpectateCommand.onCommand(SpectateCommand.java:81) [SpectatorPlus-B2.0.jar:?]
10.09 08:32:02 [Server] INFO at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25]
10.09 08:32:02 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]
10.09 08:32:02 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]
10.09 08:32:02 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]
10.09 08:32:02 [Server] INFO at com.pgcraft.spectatorplus.SpectateCommand.doReload(SpectateCommand.java:310) [SpectatorPlus-B2.0.jar:?]
10.09 08:32:02 [Server] INFO at com.pgcraft.spectatorplus.SpectatorPlus.reloadConfig(SpectatorPlus.java:575) [SpectatorPlus-B2.0.jar:?]
10.09 08:32:02 [Server] INFO at com.pgcraft.spectatorplus.ConfigAccessor.reloadConfig(ConfigAccessor.java:58) [SpectatorPlus-B2.0.jar:?]
10.09 08:32:02 [Server] INFO at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:180) [custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:169) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:226) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57) ~[custom.jar:git-Spigot-1624]
10.09 08:32:02 [Server] INFO org.bukkit.configuration.InvalidConfigurationException: org.yaml.snakeyaml.error.YAMLException: Could not deserialize object
10.09 08:32:02 [Server] INFO [08:32:02 ERROR]: Cannot load plugins/SpectatorPlus/setup.yml
I don't think it's my fault actually.
Why do you always run migrate()
when the ArenasManager
loads? In it you set p.setup.getConfig().set(NEXT_ARENA_KEY, null);
. Next time the plugin runs, wouldn't that cause an NPE?
I propose the following:
/**
* Migrates the arenas stored in the old format to this new one.
*/
private void migrate() {
final String OLD_STORAGE_KEY = "arena";
final String NEXT_ARENA_KEY = "nextarena";
if(p.setup.getConfig().isConfigurationSection(OLD_STORAGE_KEY) && p.setup.getConfig().contains(NEXT_ARENA_KEY) /* Prevent NPE's */) {
int lastNumericID = p.setup.getConfig().getInt(NEXT_ARENA_KEY);
(excerpt from migrate()
)
You're right, this needs to be added.
Does this fixes this bug?
Le 10/09/2014 17:51, pgmann a écrit :
I propose the following:
/** * Migrates the arenas stored in the old format to this new one. */ private void migrate() { final String OLD_STORAGE_KEY = "arena"; final String NEXT_ARENA_KEY = "nextarena"; if(p.setup.getConfig().isConfigurationSection(OLD_STORAGE_KEY) && p.setup.getConfig().contains(NEXT_ARENA_KEY)) { int lastNumericID = p.setup.getConfig().getInt(NEXT_ARENA_KEY);
(excerpt from |migrate()|)
—
Reply to this email directly or view it on GitHub
#15 (comment).
Just to be sure, you've tested this yourself? Because something went wrong every time I've tried...
It was successfully tested.
Le 10/09/2014 17:27, pgmann a écrit :
Just to be sure, you've tested this yourself? Because something went
wrong every time I've tried...—
Reply to this email directly or view it on GitHub
#15 (comment).
Problem found. I use http://dev.bukkit.org/bukkit-plugins/pm-pluginmanager/ to load and unload plugins quickly without a complete restart/complete reload. Turns out it was causing some bugs. I will try updating it to a newer version I just found.
Ok :) .
That's why with many tries, I was unable to reproduce the bug. Ok :) .
Le 10/09/2014 18:28, pgmann a écrit :
Problem found. I use
http://dev.bukkit.org/bukkit-plugins/pm-pluginmanager/ to load and
unload plugins quickly without a complete restart/complete reload.
Turns out it was causing some bugs. I will try updating it to a newer
version I just found.—
Reply to this email directly or view it on GitHub
#15 (comment).