Multiverse-Portals

Multiverse-Portals

2M Downloads

NPE on start-up

SlimeDog opened this issue ยท 12 comments

commented

Spigot 1.13.2
Multiverse-Core 3.0.0-b756
Multiverse-Portals 3.0.0-b783
No change to MV configurations from pre-3.0.0 MV versions

[23:19:56] [Server thread/INFO]: [Multiverse-Portals] Enabling Multiverse-Portals v3.0.0-SNAPSHOT-b783
[23:19:56] [Server thread/INFO]: [Multiverse-Portals] - Version 3.0.0-SNAPSHOT-b783 Enabled - By Rigby and fernferret
[23:19:57] [Server thread/ERROR]: Error occurred while enabling Multiverse-Portals v3.0.0-SNAPSHOT-b783 (Is it up to date?)
java.lang.NullPointerException: null
        at de.themoep.idconverter.multiverse.IdMappings.getById(IdMappings.java:870) ~[?:?]
        at com.onarandombox.MultiverseCore.utils.MaterialConverter.convertTypeString(MaterialConverter.java:35) ~[?:?]
        at com.onarandombox.MultiverseCore.utils.MaterialConverter.convertConfigType(MaterialConverter.java:24) ~[?:?]
        at com.onarandombox.MultiversePortals.MVPortal.loadMVPortalFromConfig(MVPortal.java:188) ~[?:?]
        at com.onarandombox.MultiversePortals.MultiversePortals.loadPortals(MultiversePortals.java:230) ~[?:?]
        at com.onarandombox.MultiversePortals.MultiversePortals.onEnable(MultiversePortals.java:141) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:254) ~[spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at org.bukkit.craftbukkit.v1_13_R2.CraftServer.enablePlugin(CraftServer.java:434) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at org.bukkit.craftbukkit.v1_13_R2.CraftServer.enablePlugins(CraftServer.java:348) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at net.minecraft.server.v1_13_R2.MinecraftServer.l(MinecraftServer.java:580) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:542) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:420) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at net.minecraft.server.v1_13_R2.DedicatedServer.init(DedicatedServer.java:294) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:698) [spigot-1.13.2.jar-2019-01-29-2305:git-Spigot-f56e2e7-ed274c5]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
commented

No hurry here. It's a test server.

commented

you know, i brought up using a default material so things shouldn't be null outside of the MaterialConverter, he decided against that though

commented

There's a high chance returning a default Material instead of null will fix this

commented

Returns should always be checked for null. :(

commented

https://github.com/Multiverse/Multiverse-Core/blob/master/src/main/java/com/onarandombox/MultiverseCore/utils/MaterialConverter.java

here's 188 from MV portals, portal.setCurrency(MaterialConverter.convertConfigType(portal.config, portal.portalConfigString + ".entryfee.currency"));

commented

oh? what if we had a DEFAULT MATERIAL? well, the NULL never leaves that MaterialConverter class, lets use this issue as an example shall we?

current : portal.setCurrency(MaterialConverter.convertConfigType(portal.config, portal.portalConfigString + ".entryfee.currency")); - causes an NPE if the material doesn't exist

with default:
portal.setCurrency(MaterialConverter.convertConfigType(portal.config, portal.portalConfigString + ".entryfee.currency", Material.AIR)); - Sets the currency to AIR if the Material is null, which as far as i'm aware won't cause an NPE

commented

and even if that's not the case, the default material would still stop an NPE since SOMETHING other than NULL is being returned

commented

also, as far as i'm aware, i believe setting something in to null deletes it from the config, i'm not 100% sure if that's what's happening here or not though, i'll have to look into it more once i get around to this plugin

commented

@SlimeDog my dumb ass just realized, oh wait it's erroring in the core, an update will be sooner than i thought since i'm literally updating the core as i write this message

commented

I'm currently being a dick by resetting to the most recent commits from the MV repos and readding what's missing, i'll make sure to get around to this since dumptruckman went to bed <3

commented

Thanks. The error has been resolved and new versions of Multiverse-Core and Multiverse-Portals are available: https://ci.onarandombox.com/job/Multiverse-Core/757/ https://ci.onarandombox.com/job/Multiverse-Portals/784/

This issue really had nothing to do with having a default material.

commented

Confirmed fixed with the new version ^^^. Thanks.