MCPcopy Create free account
hub / github.com/e2wugui/zeze / tryLogout

Method tryLogout

ZezeJava/ZezeJava/src/main/java/Zeze/Arch/Online.java:470–496  ·  view source on GitHub ↗
(@NotNull BDelayLogoutCustom custom)

Source from the content-addressed store, hash-verified

468 }
469
470 private long tryLogout(@NotNull BDelayLogoutCustom custom) throws Exception {
471 var account = custom.getAccount();
472 var clientId = custom.getClientId();
473 var currentLoginVersion = custom.getLoginVersion();
474
475 // local online 独立判断version分别尝试删除。
476 var local = _tlocal.get(account);
477 if (local != null) {
478 var loginLocal = local.getLogins().get(clientId);
479 if (loginLocal != null && loginLocal.getLoginVersion() == currentLoginVersion) {
480 var ret = removeLocalAndTrigger(account, clientId);
481 if (ret != 0)
482 return ret;
483 }
484 }
485 // 如果玩家在延迟期间建立了新的登录,下面版本号判断会失败。
486 var online = getOnline(account);
487 var login = online != null ? online.getLogins().get(clientId) : null;
488 if (login != null && login.getLink().getState() != eOffline
489 && login.getLoginVersion() == currentLoginVersion) {
490 login.setLogoutVersion(login.getLoginVersion());
491 var ret = logoutTrigger(account, clientId);
492 if (0 != ret)
493 return ret;
494 }
495 return Procedure.Success;
496 }
497
498 static @Nullable Online instance;
499

Callers 1

logoutMethod · 0.45

Calls 11

removeLocalAndTriggerMethod · 0.95
getOnlineMethod · 0.95
logoutTriggerMethod · 0.95
getAccountMethod · 0.65
getClientIdMethod · 0.65
getLoginVersionMethod · 0.65
getMethod · 0.65
getStateMethod · 0.65
getLinkMethod · 0.65
getLoginsMethod · 0.45
setLogoutVersionMethod · 0.45

Tested by

no test coverage detected