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

[API] "com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI.plugin" is null #1133

Closed
Teyir opened this issue May 16, 2022 · 17 comments
Closed
Assignees
Labels
❌ Unconfirmed Bugs that were reported but yet to be replicatable

Comments

@Teyir
Copy link
Contributor

Teyir commented May 16, 2022

Minecraft's Version

1.18.2 (paper)

Plugin's Version

latest dev build and API 1.10.0

Describe the bug

I have this error

java.lang.NullPointerException: Cannot invoke "com.bgsoftware.superiorskyblock.api.SuperiorSkyblock.getProviders()" because "com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI.plugin" is null

I can't init SuperiorSkyblockAPI.plugin to my plugin.

I already add the softdepend [SuperiorSkyblock2].

To Reproduce

Main function onEnable:
hookSuperiorSkyblock(this); SuperiorSkyblockAPI.getProviders();

function hookSuperiorSkyblock()
private void hookSuperiorSkyblock(Plugin plugin) { for(RegisteredListener listener : HandlerList.getRegisteredListeners(Bukkit.getPluginManager().getPlugin("SuperiorSkyblock2"))) { try { if(listener.getListener().getClass() == Class.forName("com.bgsoftware.superiorskyblock.module.generators.listeners.GeneratorsListener")){ HandlerList.unregisterAll(listener.getListener()); plugin.getLogger().info(String.format("%s: Unregistered inbuilt-generator from Plugin (%s) to use this one", this.getClass().getSimpleName(), listener.getListener().getClass().getName())); } } catch (ClassNotFoundException e) { plugin.getLogger().warning(String.format("%s: Generator class for inbuilt-generator not found (%s)", this.getClass().getSimpleName(), listener.getListener().getClass().getName())); } } }

My pom.xml

<dependency> <groupId>com.bgsoftware</groupId> <artifactId>SuperiorSkyblockAPI</artifactId> <version>1.10.0</version> </dependency>

Thank you very much !

Additional Information

No response

@Teyir Teyir added the Pending Pending reports to be investigated label May 16, 2022
@OmerBenGera
Copy link
Member

SSB sets the instance when plugin loads, and this field cant be null unless you access it before its initialized.

@OmerBenGera
Copy link
Member

I added a null check for the API instance.
Try using latest dev build, let me know what happens

@OmerBenGera OmerBenGera added ❌ Unconfirmed Bugs that were reported but yet to be replicatable and removed Pending Pending reports to be investigated labels May 20, 2022
@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

I have the same issue @OmerBenGera

image

@OmerBenGera
Copy link
Member

I have the same issue @OmerBenGera

image

Send me your entire logs (Upload them to pastebin)

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

For sure !
https://pastebin.com/ft8pGv0g

@OmerBenGera
Copy link
Member

For sure ! → https://pastebin.com/ft8pGv0g

Mind showing me the entire code and how you use the API?

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

My bad @OmerBenGera, this is the good log*

https://pastebin.com/JMT6T6Qk

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

For sure ! → https://pastebin.com/ft8pGv0g

Mind showing me the entire code and how you use the API?

File (sgUtiles.java)
if(userUtils.getIsLevel(player).compareTo(BigDecimal.valueOf(Integer.parseInt(value))) >= 0){ Bukkit.broadcastMessage("Is level good"); }

File (userUtils.java)

public static BigDecimal getIsLevel(Player player){ return SuperiorSkyblockAPI.getPlayer(player.getUniqueId()).getIsland().getIslandLevel(); }

@OmerBenGera
Copy link
Member

For sure ! → https://pastebin.com/ft8pGv0g

Mind showing me the entire code and how you use the API?

File (sgUtiles.java) if(userUtils.getIsLevel(player).compareTo(BigDecimal.valueOf(Integer.parseInt(value))) >= 0){ Bukkit.broadcastMessage("Is level good"); }

File (userUtils.java)

public static BigDecimal getIsLevel(Player player){ return SuperiorSkyblockAPI.getPlayer(player.getUniqueId()).getIsland().getIslandLevel(); }

For sure ! → https://pastebin.com/ft8pGv0g

Mind showing me the entire code and how you use the API?

For sure ! → https://pastebin.com/ft8pGv0g

Mind showing me the entire code and how you use the API?

File (sgUtiles.java) if(userUtils.getIsLevel(player).compareTo(BigDecimal.valueOf(Integer.parseInt(value))) >= 0){ Bukkit.broadcastMessage("Is level good"); }

File (userUtils.java)

public static BigDecimal getIsLevel(Player player){ return SuperiorSkyblockAPI.getPlayer(player.getUniqueId()).getIsland().getIslandLevel(); }

I have no clue why it happens.
Does it occur if you only have SSB and your plugin installed on your server?
Also, do you have SSB as a soft depend?

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

Yes !

image

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

I have no clue why it happens. Does it occur if you only have SSB and your plugin installed on your server? Also, do you have SSB as a soft depend?

And if you want this is my depend
image

@OmerBenGera
Copy link
Member

I have no clue why it happens. Does it occur if you only have SSB and your plugin installed on your server? Also, do you have SSB as a soft depend?

And if you want this is my depend image

Mind sending me a copy of your plugin?
I will try to replicate it on my localhost and maybe better understand why it happens

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

I have no clue why it happens. Does it occur if you only have SSB and your plugin installed on your server? Also, do you have SSB as a soft depend?

And if you want this is my depend image

Mind sending me a copy of your plugin? I will try to replicate it on my localhost and maybe better understand why it happens

If you want (in pm Discord)

@OmerBenGera
Copy link
Member

I have no clue why it happens. Does it occur if you only have SSB and your plugin installed on your server? Also, do you have SSB as a soft depend?

And if you want this is my depend image

Mind sending me a copy of your plugin? I will try to replicate it on my localhost and maybe better understand why it happens

If you want (in pm Discord)

What's your discord? I will open a ticket for you

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

I have no clue why it happens. Does it occur if you only have SSB and your plugin installed on your server? Also, do you have SSB as a soft depend?

And if you want this is my depend image

Mind sending me a copy of your plugin? I will try to replicate it on my localhost and maybe better understand why it happens

If you want (in pm Discord)

What's your discord? I will open a ticket for you

Teyir#4439

@OmerBenGera
Copy link
Member

After looking at your jar, I can clearly see what the issue is.
You are shading SSB's API into your jar. Therefore, even tho you use SSB's API methods, you aren't actually using them, but you use a version of your own of the API, as can be seen in the picture below:
https://gyazo.com/525721bdcf5c8eef99b56b584e2cc85f

Make sure you don't shade the API into your jar, and only have it on runtime.
Let me know if it fixes the issue

@Teyir
Copy link
Contributor Author

Teyir commented May 21, 2022

Oh I have make a mistake with my maven....

Sorry for this "issue"

@Teyir Teyir closed this as completed May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❌ Unconfirmed Bugs that were reported but yet to be replicatable
Projects
None yet
Development

No branches or pull requests

2 participants