名字限制修改

back_recharge
lvxinran 2019-08-10 15:34:22 +08:00
parent 3719f64ec8
commit ca477db687
2 changed files with 12 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -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;