gm支持
parent
7f801ad0b3
commit
db52e6b0be
|
@ -8,14 +8,15 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.util.EmojiUtil;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.ShieldedWordUtils;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -27,12 +28,19 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
String name;
|
||||
if (args.length == 1) {
|
||||
name = args[0];
|
||||
return doCheck(name);
|
||||
if (doCheck(name)) {
|
||||
return true;
|
||||
}else {
|
||||
LOGGER.error("名称检查失败");
|
||||
return false;
|
||||
}
|
||||
} else if (args.length == 0) {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
name = PlayerLogic.getInstance().getRandomName2();
|
||||
if (doCheck(name)) {
|
||||
return true;
|
||||
}else {
|
||||
LOGGER.error("名称检查失败");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -75,20 +83,26 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false);
|
||||
RedisUtil.getInstence().set(key, String.valueOf(getUser().getId()), RedisKey.REDIS_OVER_FOREVER);
|
||||
|
||||
Map<Integer,Integer> itemMap = new HashMap<>(1);
|
||||
itemMap.put( Global.CHANGENAME,1);
|
||||
ItemUtil.addItem(user,itemMap,null, BIReason.GM_CHANGENAME);
|
||||
Map<Integer, Integer> itemMap = new HashMap<>(1);
|
||||
itemMap.put(Global.CHANGENAME, 1);
|
||||
ItemUtil.addItem(user, itemMap, null, BIReason.GM_CHANGENAME);
|
||||
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("change_name_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("change_name_txt");
|
||||
|
||||
int[][] values=new int[1][2];
|
||||
values[0][0]= Global.CHANGENAME;
|
||||
values[0][1]=1;
|
||||
int[][] values = new int[1][2];
|
||||
values[0][0] = Global.CHANGENAME;
|
||||
values[0][1] = 1;
|
||||
String mailReward = ItemUtil.getMailReward(values);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if (null != sessionByUid) {
|
||||
PlayerInfoProto.PlayerBackCInfoIndication build = PlayerInfoProto.PlayerBackCInfoIndication.newBuilder().setNickName(name).build();
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.PLAYER_BACKCINFO_INDICATION_VALUE, build, true);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
public class Cmd_kick extends GmGlobleAbstract {
|
||||
|
||||
|
@ -8,7 +12,11 @@ public class Cmd_kick extends GmGlobleAbstract {
|
|||
public boolean exec(String[] args) throws Exception {
|
||||
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
instance.kickOldUser(getUser().getId(), "", 000, "LOSE HEART PACKET!!!!", 0);
|
||||
ISession session= OnlineUserManager.getSessionByUid(getUser().getId());
|
||||
if (session != null) {
|
||||
MessageUtil.sendErrorCode(session, ErrorCode.kickUserCode, "您已被踢下线!");
|
||||
instance.kickOldUser(getUser().getId(), "", ErrorCode.kickUserCode, "LOSE HEART PACKET!!!!", 0);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.GmService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class GmAbstract implements GmInterface{
|
||||
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(GmAbstract.class);
|
||||
public String msg = "";
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue