Skip to content

Commit

Permalink
Fix NullPointerException due plugin instance for jedis tasks in UUIDT…
Browse files Browse the repository at this point in the history
…ranslator/AbstractDataManager (#57)
  • Loading branch information
AlessioDP authored Dec 25, 2022
1 parent c8362a4 commit c3888c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public String getServer(final UUID uuid) {
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");
Expand All @@ -82,7 +82,7 @@ public String getProxy(final UUID uuid) {
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");
Expand All @@ -103,7 +103,7 @@ public InetAddress getIp(final UUID uuid) {
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");
Expand All @@ -127,7 +127,7 @@ public long getLastOnline(final UUID uuid) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public UUID getTranslatedUuid(@NonNull String player, boolean expensiveLookups)
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());
Expand Down Expand Up @@ -135,7 +135,7 @@ public String getNameFromUuid(@NonNull UUID player, boolean expensiveLookups) {
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());
Expand Down

0 comments on commit c3888c8

Please sign in to comment.