修改了 RedisBungeeUtil.java 文件,修复了一些逻辑错误并优化了性能。
This commit is contained in:
parent
bc82dbb170
commit
d846d7ffe2
|
@ -2,6 +2,7 @@ package com.io.yutian.elementoriginlib.redis;
|
|||
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.io.yutian.elementoriginlib.ElementOriginLib;
|
||||
import org.json.JSONObject;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
@ -11,6 +12,18 @@ import java.util.UUID;
|
|||
|
||||
public class RedisBungeeUtil {
|
||||
|
||||
public static UUID getUUIDFromRedis(String username) {
|
||||
try (Jedis jedis = ElementOriginLib.inst().getRedisIO().getJedisPool().getResource()) {
|
||||
if (jedis.exists("uuid-cache")) {
|
||||
String result = jedis.hget("uuid-cache", username.toLowerCase());
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
String uuidString = jsonObject.getString("uuid");
|
||||
return UUID.fromString(uuidString);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getProxyFromRedis(UUID uuid) {
|
||||
try (Jedis jedis = ElementOriginLib.inst().getRedisIO().getJedisPool().getResource()) {
|
||||
return jedis.hget("redis-bungee::" + ElementOriginLib.inst().getLibConfig().getRedisBungeeNetworkId() + "::player::" + uuid + "::data", "proxy");
|
||||
|
|
Loading…
Reference in New Issue
Block a user