[19:09:29 ERROR]: Caused by: java.lang.NullPointerException: Cannot invoke "com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin.isOnlineMode()" because "this.plugin" is null
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator$2.unifiedJedisTask(UUIDTranslator.java:159)
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator$2.unifiedJedisTask(UUIDTranslator.java:138)
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.api.tasks.RedisTask.execute(RedisTask.java:56)
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator.getNameFromUuid(UUIDTranslator.java:184)
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.AbstractRedisBungeeAPI.getNameFromUuid(AbstractRedisBungeeAPI.java:316)
[19:09:29 ERROR]: at com.imaginarycode.minecraft.redisbungee.AbstractRedisBungeeAPI.getNameFromUuid(AbstractRedisBungeeAPI.java:299)
...
In UUIDTranslator the plugin was initializing a RedisTask without passing the right plugin instance.
new RedisTask<UUID>(plugin.getAbstractRedisBungeeApi()) -> new RedisTask<UUID>(plugin)
For this reason, the plugin variable inside RedisTask was not correctly initialized.
In some unifiedJedisTask methods, the variable plugin is used, this behavior throws a NullPointerException, for example in the error above:
RedisTask<String> redisTask = new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
@Override
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
// ...
if (!expensiveLookups || !plugin.isOnlineMode()) // <- Here the NullPointerException
return null;
// ...
}
};
Fixes the issue:
In
UUIDTranslator
the plugin was initializing aRedisTask
without passing the right plugin instance.new RedisTask<UUID>(plugin.getAbstractRedisBungeeApi())
->new RedisTask<UUID>(plugin)
For this reason, theplugin
variable insideRedisTask
was not correctly initialized.In some
unifiedJedisTask
methods, the variableplugin
is used, this behavior throws aNullPointerException
, for example in the error above: