Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mcstats/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"updateInactive": False, # also update profile for inactive players
"inactiveDays": 7, # number of offline days before a player is considered inactive
"minPlaytime": 60, # number of minutes a player must have played before entering stats
"lookupUsingOPs": True, # Include ops.json in the UUID to name lookup
"excludeBanned": True, # whether or not to exclude banned players
"excludeOps": False, # whether or not to exclude ops
"excludeUUIDs": [] # list of UUIDs to exclude
Expand Down
16 changes: 16 additions & 0 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ def is_active(last):
except:
handle_error('Cannot open ' + usercacheFile + ' for offline player lookup')

# try and load OPs
oplist = dict()
if config.players.lookupUsingOPs:
for (path, _) in sources:
opsFile = os.path.join(path, 'ops.json')
try:
with open(opsFile) as f:
for entry in json.load(f):
oplist[entry['uuid']] = entry['name']
except:
handle_error('Cannot open ' + opsFile + ' for offline (op player) lookup')

# exclude players
excludePlayers = set()

Expand Down Expand Up @@ -379,6 +391,10 @@ def is_active(last):
# no profile available, but the UUID is in the usercache
player['name'] = usercache[uuid]

if (not 'name' in player) and (uuid in oplist):
# no profile available, but the UUID is in the OP list
player['name'] = oplist[uuid]

if (not 'name' in player):
# there is no way to find the name of this player
# this may happen if the player has no valid Mojang UUID
Expand Down