-
Notifications
You must be signed in to change notification settings - Fork 111
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
rsp Nullpointerexpcetion #160
Comments
ALWAYS get the service provider lazily - that is as late as possible, but preferably via https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServiceRegisterEvent.html. If it is done eagerly you risk that the economy plugin hasn't been initialized yet which would necessarily blow up your plugin. However this approach doesn't guard against the event where there is no economy plugin - at which point you just have to roll the dice and decide what you do from there (either do nothing and crash with a NPE, disable plugin when no eco plugin is active or disable certain functionalities of your plugin if the eco plugin is absent) |
But there is XConomy plugin |
This is an issue tracker, not a help forum. I already said that the fix is to obtain services lazily as you can never be certain when the plugins register their economies. |
ok ty |
depend: [PlaceholderAPI, Vault, XConomy]
api-version: 1.16
Error occurred while enabling UltimateRPGPlugin v0.0.1 ALPHA (Is it up to date?)
java.lang.NullPointerException: null
at Ultimate.huh.core.UltimateRPGPlugin.setupChat(UltimateRPGPlugin.java:150) ~[?:?]
at Ultimate.huh.core.UltimateRPGPlugin.onEnable(UltimateRPGPlugin.java:53) ~[?:?]
IDE:
Method invocation 'getProvider' may produce 'NullPointerException'
How to solve this?
The text was updated successfully, but these errors were encountered: