2018-10-28 12:02:55 +01:00
|
|
|
### Import our module
|
2018-10-28 13:21:23 +01:00
|
|
|
from mcuuid.api import GetPlayerData
|
2018-10-28 15:07:58 +01:00
|
|
|
from mcuuid.tools import is_valid_minecraft_username
|
|
|
|
from mcuuid.tools import is_valid_mojang_uuid
|
2015-03-11 20:16:17 +01:00
|
|
|
|
2018-10-28 12:02:55 +01:00
|
|
|
### Import some other necessary modules
|
|
|
|
import sys
|
2015-03-11 20:16:17 +01:00
|
|
|
|
2018-10-28 16:40:35 +01:00
|
|
|
### Which input method should we use?
|
|
|
|
# Are there some arguments brought by the console use the first after the filename as identifier
|
|
|
|
timestamp = None
|
2018-10-28 12:02:55 +01:00
|
|
|
if len(sys.argv) > 1:
|
2018-10-28 15:07:58 +01:00
|
|
|
identifier = sys.argv[1]
|
2018-10-28 16:40:35 +01:00
|
|
|
|
|
|
|
if len(sys.argv) > 2:
|
|
|
|
if sys.argv[2].isdigit():
|
|
|
|
timestamp = int(sys.argv[2])
|
|
|
|
|
|
|
|
|
|
|
|
# Else, ask for a identifier by userinput
|
2018-10-28 12:02:55 +01:00
|
|
|
else:
|
2018-10-28 15:07:58 +01:00
|
|
|
print("Please enter a username or UUID: ")
|
2018-10-28 20:46:18 +01:00
|
|
|
identifier = input()
|
2018-10-28 15:07:58 +01:00
|
|
|
|
2018-10-28 16:40:35 +01:00
|
|
|
### Is the identifier a valid value?
|
2018-10-28 15:07:58 +01:00
|
|
|
if is_valid_minecraft_username(identifier) or is_valid_mojang_uuid(identifier):
|
2018-10-28 16:40:35 +01:00
|
|
|
# Print the type of the identifier
|
2018-10-28 15:07:58 +01:00
|
|
|
if is_valid_minecraft_username(identifier):
|
|
|
|
print('Valid username')
|
|
|
|
if is_valid_mojang_uuid(identifier):
|
|
|
|
print('Valid UUID')
|
|
|
|
|
|
|
|
### Obtaining the playerinformation using our module
|
2018-10-28 16:40:35 +01:00
|
|
|
player = GetPlayerData(identifier, timestamp)
|
2018-10-28 15:07:58 +01:00
|
|
|
# Check if the request was valid and the user exists
|
|
|
|
if player.valid is True:
|
|
|
|
# Getting UUID
|
|
|
|
uuid = player.uuid
|
|
|
|
# Getting real Username
|
|
|
|
name = player.username
|
|
|
|
|
|
|
|
# Print everything
|
|
|
|
print('UUID: ' + uuid)
|
|
|
|
print('correct name: ' + name)
|
|
|
|
|
|
|
|
|
|
|
|
# Error message
|
|
|
|
else:
|
|
|
|
print("That player was not found.")
|
|
|
|
|
2015-03-11 20:16:17 +01:00
|
|
|
else:
|
2018-10-28 15:07:58 +01:00
|
|
|
print('identifier is not valid')
|