NullPointerException in World.setStorm()

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:
    • 4627-Spigot-566f972-11c38ee (MC: 26.1.2)
    • EndlessSnow
    • Yes

      Attempting to enable a storm on all worlds fails on 26.1.2, but not on 1.21.11. It also doesn't fail if `stormActive` is false, only when enabling the storm.

      //Update the weather for all worlds
      for (World world : Bukkit.getWorlds()) {
          world.setStorm(stormActive);
      }

       

      Plugin repository: https://github.com/stuarthayhurst/endless-snow-plugin

       

      Full backtrace:

      [16:04:25] [Server thread/INFO]: [Username] issued server command: /pstorm on
      [16:04:25] [Server thread/INFO]: [EndlessSnow] Persistent storm enabled
      [16:04:25] [Server thread/ERROR]: null
      org.bukkit.command.CommandException: Unhandled exception executing command 'pstorm' in plugin EndlessSnow v1.2.0
          at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47)
          at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:150)
          at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:935)
          at org.bukkit.craftbukkit.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:50)
          at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73)
          at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:29)
          at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:13)
          at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8)
          at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:8)
          at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:106)
          at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:480)
          at net.minecraft.commands.Commands.performCommand(Commands.java:403)
          at net.minecraft.commands.Commands.performCommand(Commands.java:390)
          at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2190)
          at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$0(ServerGamePacketListenerImpl.java:2166)
          at net.minecraft.server.TickTask.run(TickTask.java:18)
          at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:173)
          at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23)
          at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1348)
          at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:231)
          at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:147)
          at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1331)
          at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1324)
          at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:156)
          at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1291)
          at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1155)
          at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:358)
          at java.base/java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.level.ServerLevel.getWorld()" because "this.world" is null
          at net.minecraft.world.level.saveddata.WeatherData.setRaining(WeatherData.java:95)
          at org.bukkit.craftbukkit.CraftWorld.setStorm(CraftWorld.java:1116)
          at io.github.stuarthayhurst.endlesssnow.EndlessSnow.setStormActive(EndlessSnow.java:77)
          at io.github.stuarthayhurst.endlesssnow.StormCommand.onCommand(StormCommand.java:38)
          at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
          ... 27 more

      The "[16:04:25] [Server thread/ERROR]: null" isn't output from my plugin, in case it helps track this down.

       

            Assignee:
            Unassigned
            Reporter:
            Stuart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: