Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException: Cannot invoke "net.imprex.orebfuscator.config.OrebfuscatorProximityConfig.createWeightedRandoms(net.imprex.orebfuscator.util.HeightAccessor)" because "this.proximityConfig" is null #280

Closed
ASchneider-GitHub opened this issue Apr 9, 2023 · 2 comments · Fixed by #284
Labels
bug Something isn't working

Comments

@ASchneider-GitHub
Copy link

ASchneider-GitHub commented Apr 9, 2023

Description

I have the following config file. The way I have it set up is intended to hide ores between -5 < Y < 2031 as stone, and any ores between -2032 < Y < 5 as deepslate. I basically just removed replacement blocks and hidden blocks from the config and changed the target wold name, but it crashes regardless. I disabled the proximity configs because I wasn't sure what the difference was between that and the actual Orebfuscation capability

version: 3
general:
  checkForUpdates: true
  updateOnBlockDamage: true
  bypassNotification: true
  ignoreSpectator: false
  updateRadius: 3
advanced:
  verbose: false
  useAsyncPacketListener: true
  maxMillisecondsPerTick: 10
  protocolLibThreads: -1
  obfuscationWorkerThreads: -1
  proximityHiderThreads: -1
cache:
  enabled: true
  baseDirectory: orebfuscator_cache
  maximumOpenRegionFiles: 256
  deleteRegionFilesAfterAccess: 172800000
  enableDiskCache: true
  maximumSize: 16384
  expireAfterAccess: 60000
  maximumTaskQueueSize: 32768
obfuscation:
  obfuscation-overworld:
    enabled: true
    minY: -2032
    maxY: 2031
    worlds:
    - AWholeNewWorld
    hiddenBlocks:
    - minecraft:emerald_ore
    - minecraft:deepslate_emerald_ore
    - minecraft:diamond_ore
    - minecraft:deepslate_diamond_ore
    - minecraft:gold_ore
    - minecraft:deepslate_gold_ore
    - minecraft:raw_gold_block
    - minecraft:iron_ore
    - minecraft:deepslate_iron_ore
    - minecraft:raw_iron_block
    - minecraft:coal_ore
    - minecraft:deepslate_coal_ore
    - minecraft:lapis_ore
    - minecraft:deepslate_lapis_ore
    - minecraft:redstone_ore
    - minecraft:deepslate_redstone_ore
    - minecraft:copper_ore
    - minecraft:raw_copper_block
    - minecraft:deepslate_copper_ore
    randomBlocks:
      section-stone:
        minY: -5
        maxY: 2031
        blocks:
          minecraft:stone: 5
      section-deepslate:
        minY: -2032
        maxY: 5
        blocks:
          minecraft:deepslate: 5
  obfuscation-nether:
    enabled: true
    minY: -2032
    maxY: 2031
    worlds:
    - AWholeNewWorld_nether
    hiddenBlocks:
    - minecraft:nether_quartz_ore
    - minecraft:ancient_debris
    - minecraft:nether_gold_ore
    randomBlocks:
      section-global:
        minY: -2032
        maxY: 2031
        blocks:
          minecraft:netherrack: 5
proximity:
  proximity-overworld:
    enabled: false
    minY: -2032
    maxY: 2031
    worlds:
    - world
    distance: 24
    useFastGazeCheck: false
    useBlockBelow: true
    hiddenBlocks:
      minecraft:mossy_cobblestone: {}
      minecraft:diamond_ore: {}
      minecraft:deepslate_diamond_ore: {}
      minecraft:emerald_ore: {}
      minecraft:deepslate_emerald_ore: {}
      minecraft:chest: {}
      minecraft:ender_chest: {}
      minecraft:trapped_chest: {}
      minecraft:anvil: {}
      minecraft:crafting_table: {}
      minecraft:dispenser: {}
      minecraft:enchanting_table: {}
      minecraft:furnace: {}
      minecraft:blast_furnace: {}
      minecraft:cartography_table: {}
      minecraft:fletching_table: {}
      minecraft:grindstone: {}
      minecraft:composter: {}
      minecraft:lectern: {}
      minecraft:loom: {}
      minecraft:smithing_table: {}
      minecraft:smoker: {}
      minecraft:stonecutter: {}
      minecraft:hopper: {}
      minecraft:spawner: {}
      minecraft:shulker_box: {}
      minecraft:white_shulker_box: {}
      minecraft:orange_shulker_box: {}
      minecraft:magenta_shulker_box: {}
      minecraft:light_blue_shulker_box: {}
      minecraft:yellow_shulker_box: {}
      minecraft:lime_shulker_box: {}
      minecraft:pink_shulker_box: {}
      minecraft:gray_shulker_box: {}
      minecraft:light_gray_shulker_box: {}
      minecraft:cyan_shulker_box: {}
      minecraft:purple_shulker_box: {}
      minecraft:blue_shulker_box: {}
      minecraft:brown_shulker_box: {}
      minecraft:green_shulker_box: {}
      minecraft:red_shulker_box: {}
      minecraft:black_shulker_box: {}
      minecraft:bee_nest: {}
      minecraft:beehive: {}
    randomBlocks:
      section-stone:
        minY: -5
        maxY: 2031
        blocks:
          minecraft:stone: 1
      section-deepslate:
        minY: -2032
        maxY: 5
        blocks:
          minecraft:deepslate: 1
  proximity-nether:
    enabled: false
    minY: -2032
    maxY: 2031
    worlds:
    - world_nether
    distance: 24
    useFastGazeCheck: false
    useBlockBelow: true
    hiddenBlocks:
      minecraft:chest: {}
      minecraft:ender_chest: {}
      minecraft:trapped_chest: {}
      minecraft:anvil: {}
      minecraft:crafting_table: {}
      minecraft:dispenser: {}
      minecraft:enchanting_table: {}
      minecraft:furnace: {}
      minecraft:blast_furnace: {}
      minecraft:cartography_table: {}
      minecraft:fletching_table: {}
      minecraft:grindstone: {}
      minecraft:composter: {}
      minecraft:lectern: {}
      minecraft:loom: {}
      minecraft:smithing_table: {}
      minecraft:smoker: {}
      minecraft:stonecutter: {}
      minecraft:hopper: {}
      minecraft:spawner: {}
      minecraft:shulker_box: {}
      minecraft:white_shulker_box: {}
      minecraft:orange_shulker_box: {}
      minecraft:magenta_shulker_box: {}
      minecraft:light_blue_shulker_box: {}
      minecraft:yellow_shulker_box: {}
      minecraft:lime_shulker_box: {}
      minecraft:pink_shulker_box: {}
      minecraft:gray_shulker_box: {}
      minecraft:light_gray_shulker_box: {}
      minecraft:cyan_shulker_box: {}
      minecraft:purple_shulker_box: {}
      minecraft:blue_shulker_box: {}
      minecraft:brown_shulker_box: {}
      minecraft:green_shulker_box: {}
      minecraft:red_shulker_box: {}
      minecraft:black_shulker_box: {}
      minecraft:bee_nest: {}
      minecraft:beehive: {}
      minecraft:ancient_debris: {}
      minecraft:nether_gold_ore: {}
      minecraft:respawn_anchor: {}
    randomBlocks:
      section-global:
        minY: -2032
        maxY: 2031
        blocks:
          minecraft:netherrack: 1
  proximity-end:
    enabled: false
    minY: -2032
    maxY: 2031
    worlds:
    - world_the_end
    distance: 24
    useFastGazeCheck: false
    useBlockBelow: true
    hiddenBlocks:
      minecraft:chest: {}
      minecraft:ender_chest: {}
      minecraft:trapped_chest: {}
      minecraft:anvil: {}
      minecraft:crafting_table: {}
      minecraft:dispenser: {}
      minecraft:enchanting_table: {}
      minecraft:furnace: {}
      minecraft:blast_furnace: {}
      minecraft:cartography_table: {}
      minecraft:fletching_table: {}
      minecraft:grindstone: {}
      minecraft:composter: {}
      minecraft:lectern: {}
      minecraft:loom: {}
      minecraft:smithing_table: {}
      minecraft:smoker: {}
      minecraft:stonecutter: {}
      minecraft:hopper: {}
      minecraft:spawner: {}
      minecraft:shulker_box: {}
      minecraft:white_shulker_box: {}
      minecraft:orange_shulker_box: {}
      minecraft:magenta_shulker_box: {}
      minecraft:light_blue_shulker_box: {}
      minecraft:yellow_shulker_box: {}
      minecraft:lime_shulker_box: {}
      minecraft:pink_shulker_box: {}
      minecraft:gray_shulker_box: {}
      minecraft:light_gray_shulker_box: {}
      minecraft:cyan_shulker_box: {}
      minecraft:purple_shulker_box: {}
      minecraft:blue_shulker_box: {}
      minecraft:brown_shulker_box: {}
      minecraft:green_shulker_box: {}
      minecraft:red_shulker_box: {}
      minecraft:black_shulker_box: {}
      minecraft:bee_nest: {}
      minecraft:beehive: {}
    randomBlocks:
      section-global:
        minY: -2032
        maxY: 2031
        blocks:
          minecraft:end_stone: 1

When loading that config, the plugin fails to init with the error

java.lang.NullPointerException: Cannot invoke "net.imprex.orebfuscator.config.OrebfuscatorProximityConfig.createWeightedRandoms(net.imprex.orebfuscator.util.HeightAccessor)" because "this.proximityConfig" is null
        at net.imprex.orebfuscator.config.OrebfuscatorConfig$OrebfuscatorWorldConfigBundle.<init>(OrebfuscatorConfig.java:293) ~[?:?]
        at net.imprex.orebfuscator.config.OrebfuscatorConfig.deserialize(OrebfuscatorConfig.java:155) ~[?:?]
        at net.imprex.orebfuscator.config.OrebfuscatorConfig.load(OrebfuscatorConfig.java:59) ~[?:?]
        at net.imprex.orebfuscator.config.OrebfuscatorConfig.<init>(OrebfuscatorConfig.java:53) ~[?:?]
        at net.imprex.orebfuscator.Orebfuscator.onEnable(Orebfuscator.java:54) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:539) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:453) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:587) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:412) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:250) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:973) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:301) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3669-Spigot-454acb7-f150cfb]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

Reproduction Steps

Installed Orebfuscator v5.3.3
Installed ProtocolLib v5.0.0-SNAPSHOT (build #616) as recommended by https://ci.dmulloy2.net/job/ProtocolLib/
Updated config

Expected Behaviour

Plugin should start up normally. If the config is unchanged, then it inits correctly. I'm not sure what part of this is breaking it.

Server Details

3669-Spigot-454acb7-f150cfb (MC: 1.19.3)

Orebfuscator Version

Orebfuscator version 5.3.3

ProtocolLib Version

ProtocolLib version 5.0.0-SNAPSHOT

Logs and Configs

No response

Extra Details

No response

@ASchneider-GitHub ASchneider-GitHub added the bug Something isn't working label Apr 9, 2023
@ASchneider-GitHub
Copy link
Author

ASchneider-GitHub commented Apr 9, 2023

After poking around a bit and utilizing the /reload command to test the config, it looks like that error is being thrown when changing any of the worlds: lines. For example, my server uses the world name AWholeNewWorld in the server.properties file, but switching

    worlds:
    - world

on lines 29 & 30 of the default config to

    worlds:
    - AWholeNewWorld

causes the errors to be thrown immediately. I'm not sure what the cause would be here since the world file exists and the YAML lints correctly.


Edit: After more testing, it looks like the config at least loads correctly when the world name is all lowercase instead of mix case. I'm not sure if it will pick up the correct world files as intended if the case doesn't match.


Edit 2: After further testing, it looks like the error is only thrown when the world name starts with a capital letter such as

    worlds:
    - AWholeNewWorld

however, this does not throw the error:

    worlds:
    - aWholeNewWorld

Again, not sure if the world will match correctly if the world folder is called "AWholeNewWorld"


Last edit before I give up and wait for a response
Keeping the world files with the name AWholeNewWorld but switching the config to

    worlds:
    - awholenewworld

allowed the config to load correctly, but the Obfuscation wasn't kicking in at all. In a last-ditch effort I changed the name in the server.properties to awholenewworld (all lowercase) and regenerated the world. Now that the world name AND config world name are both lowercase, the error persists and gets thrown again.


I lied: It looks like the error is thrown any time the world name set in the server.properties file starts with an uppercase letter, and the worlds: setting in the config file matches it (starts with an uppercase letter as well). Containing uppercase letters is fine, as long as the first letter is lowercase

@Ingrim4
Copy link
Member

Ingrim4 commented Apr 9, 2023

Yeah looks like a simple typo (see 904c64f), here's a temp fix to bridge the time until the next release: https://github.com/Imprex-Development/orebfuscator/suites/12119779088/artifacts/638815555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants