ProxioDev / ValioBungee

Synchronize players data between BungeeCord / Velocity proxies
Eclipse Public License 1.0
200 stars 51 forks source link

getRedisBungeeApi() is null #24

Closed quiquelhappy closed 2 years ago

quiquelhappy commented 2 years ago

Describe the bug When trying to hook to the API: java.lang.NullPointerException: Cannot invoke "com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.isPlayerOnline(java.util.UUID)" because the return value of "com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.getRedisBungeeApi()" is null

To Reproduce https://github.com/BenCodez/VotingPlugin/commit/29dad6ca255398f956b6c575f72ad81cc2f9dfe1

Expected behavior com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.getRedisBungeeApi() shouldn't be null, redis is in fact installed

Screenshots

Redis version? it should be at least 6 and above. 0.6.5

Bungeecord version or (the bungee fork name eg: waterfall) and your plugins latest.

image

console logs?

22:51:11 [SEVERE] java.lang.NullPointerException: Cannot invoke "com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.isPlayerOnline(java.util.UUID)" because the return value of "com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI.getRedisBungeeApi()" is null

22:51:11 [SEVERE]     at com.bencodez.votingplugin.bungee.RedisBungee.isOnline(RedisBungee.java:33)

22:51:11 [SEVERE]     at com.bencodez.votingplugin.bungee.VotingPluginBungee.isOnline(VotingPluginBungee.java:541)

22:51:11 [SEVERE]     at com.bencodez.votingplugin.bungee.VotingPluginBungee.login(VotingPluginBungee.java:551)

22:51:11 [SEVERE]     at com.bencodez.votingplugin.bungee.VotingPluginBungee.onPluginMessage(VotingPluginBungee.java:599)

22:51:11 [SEVERE]     at jdk.internal.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)

22:51:11 [SEVERE]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

22:51:11 [SEVERE]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)

22:51:11 [SEVERE]     at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19)

22:51:11 [SEVERE]     at net.md_5.bungee.event.EventBus.post(EventBus.java:49)

22:51:11 [SEVERE]     at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:412)

22:51:11 [SEVERE]     at net.md_5.bungee.connection.DownstreamBridge.handle(DownstreamBridge.java:257)

22:51:11 [SEVERE]     at net.md_5.bungee.protocol.packet.PluginMessage.handle(PluginMessage.java:79)

22:51:11 [SEVERE]     at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:114)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

22:51:11 [SEVERE]     at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

22:51:11 [SEVERE]     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

22:51:11 [SEVERE]     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

22:51:11 [SEVERE]     at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)

22:51:11 [SEVERE]     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

22:51:11 [SEVERE]     at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

22:51:11 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

22:51:11 [SEVERE]     at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)

22:51:11 [SEVERE]     at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)

22:51:11 [SEVERE]     at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)

22:51:11 [SEVERE]     at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)

22:51:11 [SEVERE]     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)

22:51:11 [SEVERE]     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

22:51:11 [SEVERE]     at java.base/java.lang.Thread.run(Thread.java:833)
ham1255 commented 2 years ago

its the plugin issue i seen the pom of the project and you forgot to add provided scope. https://github.com/BenCodez/VotingPlugin/blob/master/VotingPlugin/pom.xml#L225

        <dependency>
            <groupId>com.github.limework</groupId>
            <artifactId>redisbungee</artifactId>
            <version>0.6.5</version>
                        <scope>provided</scope>
        </dependency>
ham1255 commented 2 years ago

issue here when you include the redis bungee in your project it shades it into the final jar,

redis bungee will load fine but when you load your jar your plugin class loader will load redis-bungee again where api variable will return null or nullpointer since the api class was not initiated.

ham1255 commented 2 years ago

alright the readme has no provided sorry about that xd

quiquelhappy commented 2 years ago

Seems to fix the issue