Cannot load the data of a user when creating its data file
radek203 opened this issue · 18 comments
[12:57:05] [Craft Scheduler Thread - 175/ERROR]: [EnderContainers] Cannot load the data file of the useree89a2cb-b97e-3afe-b276-c0131b67c21a
java.io.IOException: cannot create the file plugins/EnderContainers/data/ee89a2cbb97e3afeb276c0131b67c21a.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:37) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerData.<init>(PlayerData.java:31) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:30) [EnderContainers-2.2.0-bug-3.jar:?]
at sun.reflect.GeneratedConstructorAccessor140.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageWrapper.get(StorageWrapper.java:105) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:48) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [EnderContainers-2.2.0-bug-3.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[12:57:05] [Craft Scheduler Thread - 175/WARN]: [EnderContainers] Plugin EnderContainers v2.2.0 generated an exception while executing task 5754282
java.lang.NullPointerException: null
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:56) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:118) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:41) ~[?:?]
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:108) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:32) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:52) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.lambda$loadEnderchests$1(PlayerContext.java:95) ~[?:?]
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_141]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_141]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:96) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:62) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
Spigot: 1.12.2
EnderContainers-2.2.0-bug-3
ProtocolLib v4.5.1-SNAPSHOT-b445
[EnderContainers] Use WorldGuard (v6.2.2-SNAPSHOT;8eeab68) as a dependency!
Hello @radek203,
I have made some tests to try understanding your issue. The second error is caused by the first one, as the player data file cannot be created. So it will not creates the storage object and it will causes a NullPointerException
error.
The IOException
error is thrown by these lines:
It seems that the
createNewFile()
method returns false. The javadoc says that it returns false if the named file already exists... but I don't know why in your case.
Sorry for that, but I can't reproduce this error on my environment... Maybe someone else on Github? Can you investigate more?
@utarwyn
I still haven't seen what this error crashes. But I know one thing, this error gets practically every day.
[14:56:05] [Craft Scheduler Thread - 235/ERROR]: [EnderContainers] Cannot load the data file of the user5f114526-14cb-3bc1-8415-ea80d5f7369f
java.io.IOException: cannot create the file plugins/EnderContainers/data/5f11452614cb3bc18415ea80d5f7369f.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:37) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerData.<init>(PlayerData.java:31) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:30) [EnderContainers-2.2.0-bug-3.jar:?]
at sun.reflect.GeneratedConstructorAccessor149.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageWrapper.get(StorageWrapper.java:105) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:48) [EnderContainers-2.2.0-bug-3.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [EnderContainers-2.2.0-bug-3.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[14:56:05] [Craft Scheduler Thread - 235/WARN]: [EnderContainers] Plugin EnderContainers v2.2.0 generated an exception while executing task 2971356
java.lang.NullPointerException: null
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:56) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:118) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:41) ~[?:?]
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:108) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:32) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:52) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.lambda$loadEnderchests$1(PlayerContext.java:95) ~[?:?]
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_141]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_141]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:96) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:62) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
Can it be fixed?
I don't understand why this error occurs frequently on your server... maybe you have problems with folder permissions or something else. Does this error occurs with all player files? Is the file exists in the folder just after the error? With a content?
Since I don't have another feedback, I can't really fix the problem... I only can delete the piece of code I have mentionned (the exception should never be thrown) but I don't think that its the good option. Sorry for the inconvenience, without more information I can't do anything.
I have improved something for my needs from: 2afb296
I deleted the backup system, a few commands and:
I don't think I could have broken something, but I know that files may now be different. I changed the plugin name, I hope it doesn't bother you (I can always change back)
And now I get these errors (among others as before):
[18:00:42] [Craft Scheduler Thread - 24/ERROR]: [KMEC] Cannot load the data file of the user24226140-b05a-3544-8706-81c068d45e8d
java.io.IOException: cannot create the file plugins/KMEC/data/24226140b05a3544870681c068d45e8d.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:41) [KMEC.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_141]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageManager.createPlayerDataStorage(StorageManager.java:57) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [KMEC.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[18:00:42] [Craft Scheduler Thread - 24/WARN]: [KMEC] Plugin KMEC v1.0 generated an exception while executing task 20598
java.lang.NullPointerException: null
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:76) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:118) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:42) ~[?:?]
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:143) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:33) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:52) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.lambda$2(PlayerContext.java:98) ~[?:?]
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_141]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_141]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:99) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:62) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
(This occurred three times - on different days.) (The ruler might change: "at sun.reflect.GeneratedConstructorAccessor117.newInstance(Unknown Source) [?:1.8.0_141]" on "at sun.reflect.GeneratedConstructorAccessor147.newInstance(Unknown Source) [?:1.8.0_141]"
[18:11:55] [Craft Scheduler Thread - 45/ERROR]: [KMEC] Cannot load the data file of the userbda7b6d1-1f1c-3900-8ad4-96cb794867c9
java.io.IOException: cannot create the file plugins/KMEC/data/bda7b6d11f1c39008ad496cb794867c9.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:41) [KMEC.jar:?]
at sun.reflect.GeneratedConstructorAccessor117.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageManager.createPlayerDataStorage(StorageManager.java:57) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [KMEC.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[18:11:55] [Craft Scheduler Thread - 45/WARN]: [KMEC] Plugin KMEC v1.0 generated an exception while executing task 984016
java.lang.NullPointerException: null
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:76) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:118) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:42) ~[?:?]
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:143) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:33) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:52) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.lambda$2(PlayerContext.java:98) ~[?:?]
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_141]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_141]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:99) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:62) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[19:15:36] [Craft Scheduler Thread - 106/ERROR]: [KMEC] Cannot load the data file of the user031f7674-dbff-34b3-9b48-0b83300df568
java.io.IOException: cannot create the file plugins/KMEC/data/031f7674dbff34b39b480b83300df568.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:41) [KMEC.jar:?]
at sun.reflect.GeneratedConstructorAccessor117.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageManager.createPlayerDataStorage(StorageManager.java:57) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [KMEC.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[19:15:36] [Craft Scheduler Thread - 106/WARN]: [KMEC] Plugin KMEC v1.0 generated an exception while executing task 6477280
java.lang.NullPointerException: null
(The error below occurred 4 times in a row.)
[12:06:05] [Craft Scheduler Thread - 231/ERROR]: [KMEC] Cannot load the data file of the user21596274-a8e5-39e3-894f-b7dcff66318c
java.io.IOException: cannot create the file plugins/KMEC/data/21596274a8e539e3894fb7dcff66318c.yml
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:33) ~[KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:41) [KMEC.jar:?]
at sun.reflect.GeneratedConstructorAccessor147.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageManager.createPlayerDataStorage(StorageManager.java:57) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:51) [KMEC.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:59) [KMEC.jar:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) [server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
(The error below occurred 4 times in a row.)
[12:06:05] [Craft Scheduler Thread - 235/WARN]: [KMEC] Plugin KMEC v1.0 generated an exception while executing task 956141
java.lang.NullPointerException: null
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:76) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:118) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:42) ~[?:?]
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:143) ~[?:?]
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:33) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:52) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.lambda$2(PlayerContext.java:98) ~[?:?]
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250) ~[?:1.8.0_141]
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110) ~[?:1.8.0_141]
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:99) ~[?:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:62) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
Do you know if your problem with files has been solved @radek203? I have never seen the error and I don't understand how this can only happen to you. Does it only occurs with my plugin on your server?
Yes, only with this plugin, I built the latest version, but the next edition of my server starts only on May 8, so I have to wait, as I say the problem occurs maybe 2 times a day (server about 80 people all the time) but still tries to find out what the error is is caused.
@radek203: I have changed methods to create directories and files in the last commit 70a38e5, can you try with this modification? I have compiled the latest source code for you: EnderContainers-2.2.0.zip
Give me a feedback about that! I hope it will fix your issue with files.
@utarwyn The error still occurs, I got a server crash today and 90% the all ender of players cleared :/
omg what a sadness, I'm so sorry! And I don't have any idea about that... Did you have an error log that I can exploit to investigate? I don't find any solution about your problem and I don't know why it only happens to you.
I changed something via source code, but with your version, the error also occurred. That's why I decided to send code snippets for certainty.
It's not Your fault the server crash, don't worry :-), Hm and maybe you can add some autosave every certain time?
[18:34:20] [Craft Scheduler Thread - 80/ERROR]: [EnderContainers] Cannot load the data file of the user 235e726a-b75e-319c-9e38-7e3ebbba4a49
java.nio.file.FileAlreadyExistsException: plugins/EnderContainers/data/235e726ab75e319c9e387e3ebbba4a49.yml
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88) ~[?:1.8.0_141]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_141]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_141]
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214) ~[?:1.8.0_141]
at java.nio.file.Files.newByteChannel(Files.java:361) ~[?:1.8.0_141]
at java.nio.file.Files.createFile(Files.java:632) ~[?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.FlatFile.load(FlatFile.java:71) ~[EnderContainers.jar:?]
at fr.utarwyn.endercontainers.storage.FlatFile.<init>(FlatFile.java:34) ~[EnderContainers.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.load(PlayerFlatData.java:52) [EnderContainers.jar:?]
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.<init>(PlayerFlatData.java:42) [EnderContainers.jar:?]
at sun.reflect.GeneratedConstructorAccessor145.newInstance(Unknown Source) [?:1.8.0_141]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_141]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_141]
at fr.utarwyn.endercontainers.storage.StorageManager.createPlayerDataStorage(StorageManager.java:57) [EnderContainers.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.<init>(PlayerContext.java:54) [EnderContainers.jar:?]
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:60) [EnderContainers.jar:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) [server.jar:git-PaperSpigot-"8b18730"]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) [server.jar:git-PaperSpigot-"8b18730"]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
[18:34:20] [Craft Scheduler Thread - 80/WARN]: Exception in thread "Craft Scheduler Thread - 80"
[18:34:20] [Craft Scheduler Thread - 80/WARN]: org.apache.commons.lang.UnhandledException: Plugin EnderContainers v2.2.0 generated an exception while executing task 3196418
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at fr.utarwyn.endercontainers.storage.player.PlayerFlatData.getEnderchestContents(PlayerFlatData.java:81)
at fr.utarwyn.endercontainers.enderchest.EnderChest.getContents(EnderChest.java:117)
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.prepare(EnderChestMenu.java:47)
at fr.utarwyn.endercontainers.menu.AbstractMenu.reloadInventory(AbstractMenu.java:141)
at fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu.<init>(EnderChestMenu.java:38)
at fr.utarwyn.endercontainers.enderchest.EnderChest.<init>(EnderChest.java:51)
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.createEnderchest(PlayerContext.java:195)
at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at fr.utarwyn.endercontainers.enderchest.context.PlayerContext.loadEnderchests(PlayerContext.java:126)
at fr.utarwyn.endercontainers.enderchest.context.LoadTask.run(LoadTask.java:63)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more
fr.utarwyn.endercontainers.storage.FlatFile
if (!this.file.exists()) {
if (this.file.getParentFile() != null) {
Files.createDirectories(this.file.getParentFile().toPath());
}
71 Files.createFile(this.file.toPath());
}
public FlatFile(String path) throws IOException {
34 this.load(path);
}
fr.utarwyn.endercontainers.storage.player.PlayerFlatData
@Override
public void load() {
try {
String minimalUuid = this.uuid.toString().replace("-", "");
52 this.flatFile = new FlatFile("data" + File.separator + minimalUuid + ".yml");
} catch (IOException e) {
this.logger.log(Level.SEVERE, String.format(
"Cannot load the data file of the user %s", this.uuid
), e);
}
}
public PlayerFlatData(Logger logger, UUID uuid) {
super(logger, uuid);
42 this.load();
}
@Override
public ConcurrentMap<Integer, ItemStack> getEnderchestContents(EnderChest enderChest) {
String path = PREFIX + "." + enderChest.getNum() + ".contents";
81 if (!this.flatFile.getConfiguration().contains(path)) {
return new ConcurrentHashMap<>();
}
return ItemSerializer.deserialize(this.flatFile.getConfiguration().getString(path));
}
fr.utarwyn.endercontainers.storage.StorageManager
public PlayerData createPlayerDataStorage(UUID uuid) {
try {
return this.playerDataPattern.getDeclaredConstructor(Logger.class, UUID.class)
57 .newInstance(this.logger, uuid);
} catch (ReflectiveOperationException e) {
this.logger.log(Level.SEVERE, "Cannot instantiate a player data storage object", e);
return null;
}
}
fr.utarwyn.endercontainers.enderchest.context.PlayerContext
PlayerContext(UUID owner) {
this.owner = owner;
this.chests = Collections.synchronizedSet(new HashSet<>());
54 this.data = Managers.get(StorageManager.class).createPlayerDataStorage(this.owner);
}
private EnderChest createEnderchest(int number) {
if (number == 0 && Files.getConfiguration().isUseVanillaEnderchest()) {
return new VanillaEnderChest(this);
} else {
195 return new EnderChest(this, number);
}
}
public void loadEnderchests(int count) {
this.chests = IntStream.rangeClosed(0, count - 1)
.mapToObj(this::createEnderchest)
126 .collect(Collectors.toSet());
}
fr.utarwyn.endercontainers.enderchest.context.LoadTask
@Override
public void run() {
// Initialize the player context
int count = this.manager.getMaxEnderchests();
60 PlayerContext context = new PlayerContext(this.owner);
// This task can take a certain amount of time to be executed
63 context.loadEnderchests(count);
// Schedule the callback and register the player context in memory
this.plugin.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, () -> {
this.manager.registerPlayerContext(context);
this.consumer.accept(context);
});
}
fr.utarwyn.endercontainers.enderchest.EnderChest
public ConcurrentMap<Integer, ItemStack> getContents() {
if (this.container != null && this.container.isInitialized()) {
return this.container.getMapContents();
} else {
117 return this.context.getData().getEnderchestContents(this);
}
}
public EnderChest(PlayerContext context, int num) {
this.context = context;
this.num = num;
this.rows = this.calculateRowCount();
51 this.container = new EnderChestMenu(this);
}
fr.utarwyn.endercontainers.menu.enderchest.EnderChestMenu
@Override
protected void prepare() {
int size = this.chest.getMaxSize();
47 this.chest.getContents().forEach((index, item) -> {
if (index < size) {
this.inventory.setItem(index, item);
}
});
}
public EnderChestMenu(EnderChest chest) {
this.chest = chest;
this.itemMovingRestricted = false;
38 this.reloadInventory();
}
fr.utarwyn.endercontainers.menu.AbstractMenu
protected void reloadInventory() {
String title = this.getTitle();
int size = this.getRows() * 9;
ItemStack[] itemStacks = new ItemStack[size];
if (title.length() > 32) {
title = title.substring(0, 32);
}
if (this.inventory != null) {
itemStacks = this.inventory.getContents();
}
this.inventory = Bukkit.createInventory(this, size, title);
this.inventory.setContents(itemStacks);
141 this.prepare();
this.initialized = true;
}
I am working on a new way to load and save configuration files through the plugin using the internal Bukkit Yaml system. If that rework does not solve your problem, I won't have any more ideas on how to help you. I keep you in touch about that fix soon!
About your idea to create an auto-saving system, I think that it will not be used by the majority of servers, since data are loaded at the player connection and saved at the player disconnection. Do you think so?
@radek203 Can you try with the latest development build? I've completely changed the way how configuration files are loaded and saved. I hope that this fix will be the good one, because I don't have any other ideas on how to help you.
You can pull the repository with latest commits or download this build:
➡️ EnderContainers-2.2.0-9fc4ea2.zip
29.05.2020 I wants to conduct beta tests of the next edition of my server, I will test it.
PaperSpigot: 1.8.8
When a player wants to open the ender crouching
getItemInMainHand must be getItemInHand on 1.8
[18:39:17 ERROR]: Could not pass event PlayerInteractEvent to EnderContainers v2.2.0
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[server.jar:git-PaperSpigot-"4c7641d"]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [server.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [server.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:228) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerInteractManager.interact(PlayerInteractManager.java:463) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:763) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:52) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-PaperSpigot-"4c7641d"]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_251]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_251]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [server.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [server.jar:git-PaperSpigot-"4c7641d"]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
Caused by: java.lang.NoSuchMethodError: org.bukkit.inventory.PlayerInventory.getItemInMainHand()Lorg/bukkit/inventory/ItemStack;
at fr.utarwyn.endercontainers.enderchest.EnderChestListener.onPlayerInteract(EnderChestListener.java:68) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_251]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_251]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_251]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_251]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[server.jar:git-PaperSpigot-"4c7641d"]
... 18 more
@utarwyn I haven't found these earlier errors, but the server tested only 200 people in total for 5 hours, usually there are about 100 people on my server all the time.
The start of the new edition of the server is scheduled for 05/06/2020, then after a day it will be possible to 100% determine if the problem has been solved.
Thank you for the feedback! I hope that this bug will be resolved, we are waiting for the 5th to confirm that. And, I will fix the bug with the method getItemInMainHand()
, I forgot it does not exist in 1.8...
@utarwyn The error has been resolved :)