onebeastchris / PickPack

A Geyser Extension to let Geyser players choose their resource packs.
MIT License
9 stars 0 forks source link

`pickpack.Storage` is null #19

Closed JoshLoecker closed 11 months ago

JoshLoecker commented 11 months ago

Hi, I'm getting the following error when using pickpack version 1.2.1

org.bukkit.command.CommandException: Unhandled exception executing command 'pickpack' in plugin Geyser-Spigot v2.2.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.dispatchCommand(CraftServer.java:1003) ~[purpur-1.20.2.jar:git-Purpur-2088]
at org.bukkit.craftbukkit.v1_20_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[purpur-1.20.2.jar:git-Purpur-2088]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[purpur-1.20.2.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:338) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:322) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2278) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2238) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1351) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:193) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1328) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1321) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1437) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[purpur-1.20.2.jar:git-Purpur-2088]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2088]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

Caused by: java.lang.NullPointerException: Cannot invoke "net.onebeastchris.geyser.extension.pickpack.Util.PlayerStorage.getPackIds(String)" because "net.onebeastchris.geyser.extension.pickpack.PickPack.storage" is null
at net.onebeastchris.geyser.extension.pickpack.Form.getPacks(Form.java:147) ~[?:?]
at net.onebeastchris.geyser.extension.pickpack.Form.send(Form.java:52) ~[?:?]
at net.onebeastchris.geyser.extension.pickpack.PickPack.lambda$CommandEvent$0(PickPack.java:111) ~[?:?]
at org.geysermc.geyser.command.GeyserCommandManager$CommandBuilder$1.execute(GeyserCommandManager.java:290) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor.onCommand(GeyserSpigotCommandExecutor.java:67) ~[Geyser-Spigot.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
JoshLoecker commented 11 months ago

I was able to solve the issue by deleting the pickpack folder found at plugins/Geyser-Spigot/extensions/pickpack and restarting the Minecraft server

JoshLoecker commented 11 months ago

Sorry for the spam, but it does not seem like this has solved the issue. The same error occurs

JoshLoecker commented 11 months ago

Looking through the logs, I also get an error about the PostInitializeEvent function

[org.geysermc.geyser.event.GeyserEventBus]: An exception occurred while executing event GeyserPostInitializeEvent for subscriber org.geysermc.geyser.event.GeyserEventSubscriber

java.util.ConcurrentModificationException: null
at java.util.ArrayList.forEach(ArrayList.java:1513) ~[?:?]
at net.onebeastchris.geyser.extension.pickpack.Util.FileSaveUtil.load(FileSaveUtil.java:25) ~[?:?]
at net.onebeastchris.geyser.extension.pickpack.Util.PlayerStorage.<init>(PlayerStorage.java:28) ~[?:?]
at net.onebeastchris.geyser.extension.pickpack.PickPack.onPostInitialize(PickPack.java:83) ~[?:?]
at org.lanternpowered.lmbda.Lmbda$4.accept(Unknown Source) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.subscribe.impl.SubscriberImpl.lambda$new$0(SubscriberImpl.java:55) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.subscribe.impl.SubscriberImpl.invoke(SubscriberImpl.java:75) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.bus.impl.BaseBusImpl.fireSilently(BaseBusImpl.java:201) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.bus.impl.OwnedEventBusImpl.fireSilently(OwnedEventBusImpl.java:41) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.bus.impl.BaseBusImpl.fire(BaseBusImpl.java:180) ~[Geyser-Spigot.jar:?]
at org.geysermc.event.bus.impl.OwnedEventBusImpl.fire(OwnedEventBusImpl.java:41) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.GeyserImpl.startInstance(GeyserImpl.java:517) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.GeyserImpl.initialize(GeyserImpl.java:216) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.GeyserImpl.start(GeyserImpl.java:706) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin.postStartup(GeyserSpigotPlugin.java:209) ~[Geyser-Spigot.jar:?]
at org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin$1.onServerLoaded(GeyserSpigotPlugin.java:178) ~[Geyser-Spigot.jar:?]
at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:40) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:git-Purpur-2094]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.20.2.jar:git-Purpur-2094]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.20.2.jar:git-Purpur-2094]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[purpur-1.20.2.jar:git-Purpur-2094]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:429) ~[purpur-1.20.2.jar:git-Purpur-2094]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:345) ~[purpur-1.20.2.jar:git-Purpur-2094]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1102) ~[purpur-1.20.2.jar:git-Purpur-2094]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2094]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

My java is not good at all, but this may be a fix for the issue ConcurrentModificationException

public static List<String> load(Path filepath) {
    List<String> packs = readFromFile(filepath);
    AtomicBoolean changed = new AtomicBoolean(false);
    Iterator<String> iterator = packs.iterator();
    while (iterator.hasNext()) {
        String packId = iterator.next();
        ResourcePack pack = loader.getPack(packId);
        if (pack == null) {
            logger.debug("Could not find pack with UUID " + packId + " in cache, removing from file");
            iterator.remove(); // Safely remove the current element from the list
            changed.set(true);
        }
    }
    if (changed.get()) {
        saveToFile(packs, filepath);
    }
    return packs;
}

This uses an iterator instead of the pack variable to safely remove items from the list

onebeastchris commented 11 months ago

Could you please send a full log via mclo.gs? I'll try to fix this later today.

JoshLoecker commented 11 months ago

Of course, here is the link

https://mclo.gs/jlwY2yx

onebeastchris commented 11 months ago

Please try updating to the 1.2.2 release, the issue should be fixed there. Thanks for reporting it!