mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 19:15:11 +00:00
Add Fail Safes to Cooldown and Locking
This commit is contained in:
1 parent
abc34b3f6f
commit
2f170363de
4 files changed
+93
-4
No files matched your search
@@ -94,6 +94,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
private boolean specialKeyDown = false;
|
||||
|
||||
public void onLogin() {
|
||||
// Clear any stale transient ability state that leaked via the PlayerData cache.
|
||||
// Must happen before the animation check since it may clear ability animation state.
|
||||
abilityData.resetOnLogin();
|
||||
|
||||
// Handle animation state from previous session
|
||||
AnimationData animationData = this.animationData;
|
||||
if (animationData != null && animationData.isClientAnimating()) {
|
||||
@@ -120,8 +124,9 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
}
|
||||
|
||||
public void onLogout() {
|
||||
// Cancel any executing ability and release all locks
|
||||
abilityData.interruptCurrentAbility();
|
||||
// Interrupt executing ability (fires events, rolls cooldown), then clear
|
||||
// all transient state so nothing leaks via the PlayerData cache.
|
||||
abilityData.resetOnDisconnect();
|
||||
this.partyInvites.clear();
|
||||
this.actionManager.clear();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user