Some Small Updates :)

This commit is contained in:
Bigsk 2020-11-18 16:00:11 +08:00
parent eb6fdc4922
commit 1c2851e36b

17
core.py
View File

@ -65,7 +65,7 @@ class GMCLCore(object):
''':Path The path of the dir you want to create'''
if(os.path.isdir(Path)==False):
os.mkdir(Path)
return self.Log("info","Successful.","MakeDir")
self.Log("info","Successful.","MakeDir")
else:
return self.Log("warn","Exist.","MakeDir")
def SearchFile(self,Path,Tag,Num=1):
@ -83,6 +83,7 @@ class GMCLCore(object):
break
else:
pass
self.Log("info","Success.","SearchFile")
return List
def GetUUID(self,Account="Steve"):
'''The function which was used to generate UUID'''
@ -91,17 +92,21 @@ class GMCLCore(object):
result="OfflinePlayer:"+Account
md5=hashlib.md5()
md5.update(result.encode(encoding='utf-8'))
self.Log("info","Success.","GetUUID")
return md5.hexdigest()
else:
return "Error:Wrong Auth Way."
return self.Log("warn","Wrong auth way","GetUUID")
def GetJavaPath(self,Num=1):
'''The function which was used to search java'''
''':Num How much result you want to get,you should set as "all" if you want to return all result,the default value is 1'''
if(platform.system()=="Windows"):
self.Log("info","Success.","GetJavaPath")
return self.SearchFile('C:\\','javaw.exe',Num)
elif(platform.system()=="Linux"):
self.Log("info","Success.","GetJavaPath")
return self.SearchFile('\\','java',Num)
else:
self.Log("info","Success.","GetJavaPath")
return self.SearchFile('\\','java',Num)
def SetAccount(self,Account="Steve",Password=""):
'''The function which was used to set game account data'''
@ -114,17 +119,19 @@ class GMCLCore(object):
self.__Token=result['accessToken']
self.__UUID=result['selectedProfile']['id']
self.__ID=result['selectedProfile']['name']
self.Log("info","Success.","GetAccount")
else:
return "Error:Fail to request Mojang\'s Auth Server."
return Log("warn","Fail to request Mojang\'s auth server.","SetAccount")
else:
return "Error:Wrong Account."
return Log("warn","Wrong Account.","SetAccount")
elif(self.__AuthWay=="offline"):
if(Account.count("@")==1):
return "Error:Wrong Account."
return Log("warn","Wrong Account.","SetAccount")
else:
self.__ID=Account
self.__UUID=self.GetUUID(Account)
self.__Token=""
self.Log("info","Success.","GetAccount")
else:
pass
def SetAuthWay(self,AuthWay):