mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +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;
|
return plugin.isPlayerOnAServer(player) ? plugin.getPlayerServerName(player) : null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return serverCache.get(uuid, new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
return serverCache.get(uuid, new RedisTask<String>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
return Objects.requireNonNull(unifiedJedis.hget("player:" + uuid, "server"), "user not found");
|
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();
|
return plugin.getConfiguration().getProxyId();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return proxyCache.get(uuid, new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
return proxyCache.get(uuid, new RedisTask<String>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
return Objects.requireNonNull(unifiedJedis.hget("player:" + uuid, "proxy"), "user not found");
|
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);
|
return plugin.getPlayerIp(player);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return ipCache.get(uuid, new RedisTask<InetAddress>(plugin.getAbstractRedisBungeeApi()) {
|
return ipCache.get(uuid, new RedisTask<InetAddress>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
public InetAddress unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public InetAddress unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
String result = unifiedJedis.hget("player:" + uuid, "ip");
|
String result = unifiedJedis.hget("player:" + uuid, "ip");
|
||||||
@ -127,7 +127,7 @@ public abstract class AbstractDataManager<P, PL, PD, PS> {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return lastOnlineCache.get(uuid, new RedisTask<Long>(plugin.getAbstractRedisBungeeApi()) {
|
return lastOnlineCache.get(uuid, new RedisTask<Long>(plugin) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public Long unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
|
@ -70,7 +70,7 @@ public final class UUIDTranslator {
|
|||||||
if (!plugin.isOnlineMode()) {
|
if (!plugin.isOnlineMode()) {
|
||||||
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8));
|
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
|
@Override
|
||||||
public UUID unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public UUID unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
String stored = unifiedJedis.hget("uuid-cache", player.toLowerCase());
|
String stored = unifiedJedis.hget("uuid-cache", player.toLowerCase());
|
||||||
@ -135,7 +135,7 @@ public final class UUIDTranslator {
|
|||||||
uuidToNameMap.remove(player);
|
uuidToNameMap.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
RedisTask<String> redisTask = new RedisTask<String>(plugin.getAbstractRedisBungeeApi()) {
|
RedisTask<String> redisTask = new RedisTask<String>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public String unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
String stored = unifiedJedis.hget("uuid-cache", player.toString());
|
String stored = unifiedJedis.hget("uuid-cache", player.toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user