mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 12:18:01 +00:00
Fix NullPointerException due plugin instance for jedis tasks in UUIDTranslator/AbstractDataManager (#57)
This commit is contained in:
parent
c8362a44ec
commit
c3888c8f65
@ -59,7 +59,7 @@ public abstract class AbstractDataManager<P, PL, PD, PS> {
|
||||
return plugin.isPlayerOnAServer(player) ? plugin.getPlayerServerName(player) : null;
|
||||
|
||||
try {
|
||||
return serverCache.get(uuid, new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
||||
return serverCache.get(uuid, new RedisTask<String>(plugin) {
|
||||
@Override
|
||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
return Objects.requireNonNull(unifiedJedis.hget("player:" + uuid, "server"), "user not found");
|
||||
@ -82,7 +82,7 @@ public abstract class AbstractDataManager<P, PL, PD, PS> {
|
||||
return plugin.getConfiguration().getProxyId();
|
||||
|
||||
try {
|
||||
return proxyCache.get(uuid, new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
||||
return proxyCache.get(uuid, new RedisTask<String>(plugin) {
|
||||
@Override
|
||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
return Objects.requireNonNull(unifiedJedis.hget("player:" + uuid, "proxy"), "user not found");
|
||||
@ -103,7 +103,7 @@ public abstract class AbstractDataManager<P, PL, PD, PS> {
|
||||
return plugin.getPlayerIp(player);
|
||||
|
||||
try {
|
||||
return ipCache.get(uuid, new RedisTask<InetAddress>(plugin.getAbstractRedisBungeeApi()) {
|
||||
return ipCache.get(uuid, new RedisTask<InetAddress>(plugin) {
|
||||
@Override
|
||||
public InetAddress unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
String result = unifiedJedis.hget("player:" + uuid, "ip");
|
||||
@ -127,7 +127,7 @@ public abstract class AbstractDataManager<P, PL, PD, PS> {
|
||||
return 0;
|
||||
|
||||
try {
|
||||
return lastOnlineCache.get(uuid, new RedisTask<Long>(plugin.getAbstractRedisBungeeApi()) {
|
||||
return lastOnlineCache.get(uuid, new RedisTask<Long>(plugin) {
|
||||
|
||||
@Override
|
||||
public Long unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
|
@ -70,7 +70,7 @@ public final class UUIDTranslator {
|
||||
if (!plugin.isOnlineMode()) {
|
||||
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
RedisTask<UUID> redisTask = new RedisTask<UUID>(plugin.getAbstractRedisBungeeApi()) {
|
||||
RedisTask<UUID> redisTask = new RedisTask<UUID>(plugin) {
|
||||
@Override
|
||||
public UUID unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
String stored = unifiedJedis.hget("uuid-cache", player.toLowerCase());
|
||||
@ -135,7 +135,7 @@ public final class UUIDTranslator {
|
||||
uuidToNameMap.remove(player);
|
||||
}
|
||||
|
||||
RedisTask<String> redisTask = new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
||||
RedisTask<String> redisTask = new RedisTask<String>(plugin) {
|
||||
@Override
|
||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||
String stored = unifiedJedis.hget("uuid-cache", player.toString());
|
||||
|
Loading…
Reference in New Issue
Block a user