diff options
| author | 1992414357@qq.com <1992414357@qq.com> | 2025-06-22 02:48:50 +0800 |
|---|---|---|
| committer | 1992414357@qq.com <1992414357@qq.com> | 2025-06-22 02:48:50 +0800 |
| commit | e7779d078e0a4920488e1df216aeb6287b2428c7 (patch) | |
| tree | 547f540396a0a0f022256d0bda5374882b037704 /core/src/data/game/game_runtime.rs | |
| parent | 35410b903f75a3a7bdfa0b8e502e08eb5ca09a93 (diff) | |
Add some trace! macros to game_runtime.rs, controller_runtime.rs
Diffstat (limited to 'core/src/data/game/game_runtime.rs')
| -rw-r--r-- | core/src/data/game/game_runtime.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/src/data/game/game_runtime.rs b/core/src/data/game/game_runtime.rs index 7ce1991..71f6160 100644 --- a/core/src/data/game/game_runtime.rs +++ b/core/src/data/game/game_runtime.rs @@ -85,29 +85,42 @@ impl GameRuntime { pub fn let_account_exit(&mut self, account: &Account, reason: ExitReason, service_type: ServiceType) { // Send a leave message to the pad_client and wait for it to actively disconnect if self.data.is_account_online(account) { + trace!("[Game Runtime] Let account \"{}\" exited.", account.id); self.send((account.clone(), LetExit(reason)), account.clone(), service_type); + } else { + trace!("[Game Runtime] Let account \"{}\" exit failed: Account not online!", account.id); } } pub fn kick_player(&mut self, player: &Player, service_type: ServiceType) { // Send a leave message to the pad_client and wait for it to actively disconnect if self.data.is_account_online(&player.account) { + trace!("[Game Runtime] Player \"{}\" kicked!", player.account.id); self.send((player.account.clone(), LetExit(YouAreKicked)), player.account.clone(), service_type); + } else { + trace!("[Game Runtime] Kick player \"{}\" failed: Account not online!", player.account.id); } } pub fn ban_player(&mut self, player: &Player, service_type: ServiceType) { if self.data.is_account_online(&player.account) { + trace!("[Game Runtime] Player \"{}\" Banned!", player.account.id); self.send((player.account.clone(), LetExit(YouAreBanned)), player.account.clone(), service_type); entry_mutex!(self.data.players_banned, |guard| { guard.insert(player.account.clone(), player.clone()); }); + } else { + trace!("[Game Runtime] Ban player \"{}\" failed: Account not online!", player.account.id); } } pub fn pardon_player(&mut self, player: &Player) { entry_mutex!(self.data.players_banned, |guard| { - guard.remove(&player.account); + if guard.remove(&player.account).is_some() { + trace!("[Game Runtime] Player \"{}\" pardoned!", player.account.id); + } else { + trace!("[Game Runtime] Pardon player \"{}\" failed: Account is not banned!", player.account.id); + } }); } @@ -142,6 +155,7 @@ impl GameRuntime { /// Send a GameMessage to account pub fn send_game_message(&mut self, account: &Account, message: GameMessage, service_type: ServiceType) { + trace!("[Game Runtime] Message {:?} sent to \"{}\" ({:?})", &message, account.id, &service_type); self.send((account.clone(), message), account.clone(), service_type); } |
