本帖最後由 匿名 於 2017-6-20 18:39 編輯
- //在 World.java 中新增
- public static void clearChannelChangeDataByAccountId(int accountid) {
- for (ChannelServer cs : ChannelServer.getAllInstances()) {
- getStorage(cs.getChannel()).deregisterPendingPlayerByAccountId(accountid);
- }
- getStorage(-20).deregisterPendingPlayerByAccountId(accountid);
- getStorage(-10).deregisterPendingPlayerByAccountId(accountid);
- }
- //在 PlayerStorage.java 新增
- public final void deregisterPendingPlayerByAccountId(final int accountId) {
- writeLock2.lock();
- try {
- for (CharacterTransfer transfer : PendingCharacter.values()) {
- if (transfer.accountid == accountId) {
- PendingCharacter.remove(transfer.characterid);
- }
- }
- } finally {
- writeLock2.unlock();
- }
- }
- // 修改 PlayerStorage.java
- public final void deregisterPendingPlayer(final int charid) {
- writeLock2.lock();
- try {
- int accountid = 0;
- if (PendingCharacter.containsKey(charid)) {
- accountid = PendingCharacter.get(charid).accountid;
- }
- PendingCharacter.remove(charid);
- if (accountid > 0) {
- for (CharacterTransfer transfer : PendingCharacter.values()) {
- if (transfer.accountid == accountid) {
- PendingCharacter.remove(transfer.characterid);
- }
- }
- }
- } finally {
- writeLock2.unlock();
- }
- }
- public final void registerPendingPlayer(final CharacterTransfer chr, final int playerid) {
- writeLock2.lock();
- try {
- for (CharacterTransfer transfer : PendingCharacter.values()) {
- if (transfer.accountid == chr.accountid) {
- PendingCharacter.remove(transfer.characterid);
- }
- }
- PendingCharacter.put(playerid, chr);//new Pair(System.currentTimeMillis(), chr));
- } finally {
- writeLock2.unlock();
- }
- }
- //在 LoginWorker.java 中 增加這一行
- //...
- if (c.finishLogin() == 0) {
- World.clearChannelChangeDataByAccountId(c.getAccID());
- //...
單純分享 看得懂就看
再靠BUG 斂財阿
|