名字限制修改
parent
3719f64ec8
commit
ca477db687
|
@ -100,6 +100,8 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private Map<Integer,int[]> itemRecoveryMap;
|
||||
|
||||
private int maxNameLength;
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
||||
|
@ -295,4 +297,8 @@ public class SGameSetting implements BaseConfig {
|
|||
public void setShowRank(int showRank) {
|
||||
showRank = showRank;
|
||||
}
|
||||
|
||||
public int getMaxNameLength() {
|
||||
return maxNameLength;
|
||||
}
|
||||
}
|
|
@ -74,9 +74,9 @@ public class PlayerLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
// if (checkName(iSession, name, msgId)){
|
||||
// return;
|
||||
// }
|
||||
if (checkName(iSession, name, msgId)){
|
||||
return;
|
||||
}
|
||||
if (type == 1) {
|
||||
// 检查名字是否被占用
|
||||
if (PlayerLogic.getInstance().isExistName(name)) {
|
||||
|
@ -106,13 +106,13 @@ public class PlayerLogic {
|
|||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "");
|
||||
return true;
|
||||
}
|
||||
if (length > 14 || length < 1) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "");
|
||||
if (length > SGameSetting.getGameSetting().getMaxNameLength() || length < 1) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "名字长度不符!");
|
||||
return true;
|
||||
}
|
||||
boolean result = ShieldedWordUtils.checkName( name,true);
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "");
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "名字不合法");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue