|
@@ -5,6 +5,9 @@ import com.incubator.game.GGame;
|
|
|
import com.incubator.game.data.po.PlayerInfoPO;
|
|
|
import com.incubator.game.player.GPlayer;
|
|
|
import com.incubator.game.player.Player;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 玩家工具类
|
|
@@ -23,12 +26,12 @@ public final class PlayerUtil {
|
|
|
}
|
|
|
|
|
|
/** 根据账号查找玩家 */
|
|
|
- public static GPlayer getPlayerByUid(long uid) {
|
|
|
- if (uid <= 0) {
|
|
|
+ public static GPlayer getPlayerByUid(String uid) {
|
|
|
+ if (StringUtils.isEmpty(uid)) {
|
|
|
return null;
|
|
|
}
|
|
|
for (GPlayer p : GGame.onlinePlayers.values()) {
|
|
|
- if (p.getUid() == uid) {
|
|
|
+ if (Objects.equals(p.getUid(), uid)) {
|
|
|
return p;
|
|
|
}
|
|
|
}
|