代码可读性修改
parent
aace2dae75
commit
258d1e88ce
|
@ -174,15 +174,12 @@ public class PlayerLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
|
||||
if (checkName(iSession, name, msgId)){
|
||||
return;
|
||||
}
|
||||
if (type == 1||type == 3) {
|
||||
// 检查名字是否被占用
|
||||
if (PlayerLogic.getInstance().isExistName(name)) {
|
||||
// MessageUtil.sendErrorResponse(iSession, 0, msgId, SErrorCodeEerverConfig.getI18NMessage("name_repeat_txt"));
|
||||
// return;
|
||||
throw new ErrorCodeException(name,ErrorCode.NAME_USE);
|
||||
}
|
||||
if (!playerInfoManager.getNickName().equals(String.valueOf(uid))){
|
||||
|
@ -231,18 +228,13 @@ public class PlayerLogic {
|
|||
}
|
||||
|
||||
private boolean checkName(ISession iSession, String name, int msgId) throws Exception {
|
||||
// if(!Repot37EventUtil.Report37Chat(UserManager.getUser(iSession.getUid()), ChatContentType.ROLE_NAME,name)){
|
||||
// throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
|
||||
// }
|
||||
int length = getStrLength(name);
|
||||
if (length == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
|
||||
}
|
||||
// STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxNameLength()
|
||||
if (length > 18 || length < 1) {
|
||||
throw new ErrorCodeException(ErrorCode.NAME_LENTH);
|
||||
}
|
||||
;
|
||||
boolean result = ShieldedWordUtils.checkName(UserManager.getUser(iSession.getUid()),name,true,ChatContentType.ROLE_NAME);
|
||||
if (!result) {
|
||||
throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
|
||||
|
|
|
@ -17,25 +17,22 @@ public class ShieldedWordUtils {
|
|||
return checkName(user,name,validateSpecStr,chatContentType);
|
||||
|
||||
}
|
||||
public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType){
|
||||
boolean result;
|
||||
public static boolean checkName(User user,String name,boolean validateSpecStr,ChatContentType chatContentType){
|
||||
boolean result = true;
|
||||
// 校验特殊符号
|
||||
if(validateSpecStr){
|
||||
result = validateUserName(name);
|
||||
if(!result){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 校验违禁字符
|
||||
if (result == true){
|
||||
try {
|
||||
result = isContaintSensitiveWord(name);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("检查名称,报错:"+e.getMessage());
|
||||
return false;
|
||||
result = false;
|
||||
}
|
||||
if(result){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue