[SPIGOT-6594] NPE at Bukkit.getServer().getGenerateStructures() call Created: 21/Jun/21 Updated: 23/Jun/21 Resolved: 23/Jun/21 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Joo200 | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | Properties, api | ||
Environment: |
Windows 10, Currently latest spigot release |
Version: | This server is running CraftBukkit version 3159-Spigot-f773da8-887bc05 (MC: 1.17) (Implementing API version 1.17-R0.1-SNAPSHOT) |
Plugin: | WorldGuard |
Guidelines Read: | Yes |
Description |
I'm running the latest version from Spigot, to create a System report I want to read different server settings.
The call Bukkit.getServer().getGenerateStructures() generates a NPE. Full error: [14:59:56] [Server thread/INFO]: Cannot invoke "net.minecraft.world.level.levelgen.GeneratorSettings.shouldGenerateMapFeatures()" because "org.bukkit.craftbukkit.v1_17_R1.CraftServer.getProperties().Y" is null The worlds are fresh generated. |
Comments |
Comment by Joo200 [ 23/Jun/21 ] |
I use the method in a command (has to be after worlds are loaded) public void onCondition(CommandSender sender) { if (Bukkit.getServer().getGenerateStructures()) { sender.sendMessage("True"); } else { sender.sendMessage("False"); } }
WorldGuard did strip a little bit the stacktrace. here is the complete stacktrace: [23:58:38] [Server thread/ERROR]: [ACF] Exception in command: acf condition [23:58:38] [Server thread/ERROR]: [ACF] java.lang.reflect.InvocationTargetException [23:58:38] [Server thread/ERROR]: [ACF] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [23:58:38] [Server thread/ERROR]: [ACF] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) [23:58:38] [Server thread/ERROR]: [ACF] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [23:58:38] [Server thread/ERROR]: [ACF] at java.base/java.lang.reflect.Method.invoke(Method.java:567) [23:58:38] [Server thread/ERROR]: [ACF] at com.exampleplugin.lib.acf.RegisteredCommand.invoke(RegisteredCommand.java:152) [23:58:38] [Server thread/ERROR]: [ACF] at com.exampleplugin.lib.acf.BaseCommand.executeCommand(BaseCommand.java:577) [23:58:38] [Server thread/ERROR]: [ACF] at com.exampleplugin.lib.acf.BaseCommand.execute(BaseCommand.java:513) [23:58:38] [Server thread/ERROR]: [ACF] at com.exampleplugin.lib.acf.RootCommand.execute(RootCommand.java:99) [23:58:38] [Server thread/ERROR]: [ACF] at com.exampleplugin.lib.acf.BukkitRootCommand.execute(BukkitRootCommand.java:81) [23:58:38] [Server thread/ERROR]: [ACF] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) [23:58:38] [Server thread/ERROR]: [ACF] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:760) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1944) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1783) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1764) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.TickTask.run(SourceFile:18) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.MinecraftServer.bg(MinecraftServer.java:1125) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1118) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.util.thread.IAsyncTaskHandler.executeAll(SourceFile:110) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1101) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1031) [23:58:38] [Server thread/ERROR]: [ACF] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) [23:58:38] [Server thread/ERROR]: [ACF] at java.base/java.lang.Thread.run(Thread.java:831) [23:58:38] [Server thread/ERROR]: [ACF] Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.levelgen.GeneratorSettings.shouldGenerateMapFeatures()" because "org.bukkit.craftbukkit.v1_17_R1.CraftServer.getProperties().Y" is null [23:58:38] [Server thread/ERROR]: [ACF] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getGenerateStructures(CraftServer.java:626) [23:58:38] [Server thread/ERROR]: [ACF] at co.aikar.acfexample.SomeCommand.onCondition(SomeCommand.java:90) [23:58:38] [Server thread/ERROR]: [ACF] ... 28 more |
Comment by md_5 [ 23/Jun/21 ] |
Code please. Are you doing this on startup before worlds are loaded? |