diff --git a/constants/serverPackets.py b/constants/serverPackets.py index 570dcbe..b1e0a0e 100644 --- a/constants/serverPackets.py +++ b/constants/serverPackets.py @@ -84,12 +84,12 @@ def onlineUsers(): def userLogout(userID): return packetHelper.buildPacket(packetIDs.server_userLogout, [[userID, dataTypes.sInt32], [0, dataTypes.byte]]) -def userPanel(userID): +def userPanel(userID, force = False): # Connected and restricted check userToken = glob.tokens.getTokenFromUserID(userID) if userToken == None: return bytes() - if userToken.restricted == True: + if userToken.restricted == True and force == False: return bytes() # Get user data @@ -126,12 +126,12 @@ def userPanel(userID): ]) -def userStats(userID): +def userStats(userID, force = False): # Get userID's token from tokens list userToken = glob.tokens.getTokenFromUserID(userID) if userToken == None: return bytes() # NOTE: ??? - if userToken.restricted == True: + if userToken.restricted == True and force == False: return bytes() # Stats are cached in token object #rankedScore = userHelper.getRankedScore(userID, userToken.gameMode) diff --git a/events/changeActionEvent.py b/events/changeActionEvent.py index bfbdb1b..1c1dde0 100644 --- a/events/changeActionEvent.py +++ b/events/changeActionEvent.py @@ -49,12 +49,10 @@ def handle(userToken, packetData): token = glob.tokens.getTokenFromUserID(i) if token != None: - token.enqueue(serverPackets.userPanel(userID)) - token.enqueue(serverPackets.userStats(userID)) - - # TODO: Enqueue all if we've changed game mode, (maybe not needed because it's cached) - #glob.tokens.enqueueAll(serverPackets.userPanel(userID)) - #glob.tokens.enqueueAll(serverPackets.userStats(userID)) + # Force our own packet + force = True if token.userID == userID else False + token.enqueue(serverPackets.userPanel(userID, force)) + token.enqueue(serverPackets.userStats(userID, force)) # Send osu!direct alert if needed # NOTE: Remove this when osu!direct will be fixed