UPDATE MODULES
This commit is contained in:
parent
73d2679238
commit
f2a2c174ce
67
main.py
67
main.py
@ -23,6 +23,69 @@ class GMCLCore(object):
|
|||||||
return "Error:Wrong Auth Way."
|
return "Error:Wrong Auth Way."
|
||||||
def GetMemory(self,Memory):
|
def GetMemory(self,Memory):
|
||||||
if(Memory.count("B")>1 or Memory.count("b")>1):
|
if(Memory.count("B")>1 or Memory.count("b")>1):
|
||||||
return "Error:Wrong Memory Unit."
|
return "Error:Wrong Memory Unit
|
||||||
else:
|
else:
|
||||||
if(Memory.count("GB"))
|
if(Memory.count("GB")==1):
|
||||||
|
self.__Memory=Memory.replace("GB","")
|
||||||
|
elif(Memory.count("MB")==1):
|
||||||
|
self.__Memory=str(float(Memory.replace("MB",""))/1024)
|
||||||
|
elif(Memory.count("Gb")==1):
|
||||||
|
self.__Memory=str(float(Memory.replace("Gb",""))/8)
|
||||||
|
elif(Memory.count("Mb")==1):
|
||||||
|
self.__Memory=str(float(Memory.replace("Mb",""))/8/1024)
|
||||||
|
else:
|
||||||
|
return "Error:Wrong Memory Unit."
|
||||||
|
def GetAccount(self,Account):
|
||||||
|
if(self.__AuthWay=="online"):
|
||||||
|
if(Account.count("@")==1):
|
||||||
|
self.OnlineAuth(Account,self._Password)
|
||||||
|
else:
|
||||||
|
return "Error:Wrong Account."
|
||||||
|
elif(self.__AuthWay=="offline"):
|
||||||
|
if(Account.count("@")==1):
|
||||||
|
return "Error:Wrong Account."
|
||||||
|
else:
|
||||||
|
self.OfflineAuth(Account)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
def GetUUID(self,Account):
|
||||||
|
if(self.__AuthWay=="offline"):
|
||||||
|
result="OfflinePlayer:"+Account
|
||||||
|
md5=hashlib.md5()
|
||||||
|
md5.update(result.encode(encoding='utf-8'))
|
||||||
|
return md5.hexdigest()
|
||||||
|
else:
|
||||||
|
return "Error:Wrong Auth Way."
|
||||||
|
def OnlineAuth(self,Account,Password):
|
||||||
|
if(json.loads(requests.get("https://authserver.mojang.com/",headers=self.__UserAgent).text)['status']=="OK"):
|
||||||
|
result=json.loads(requests.post("https://authserver.mojang.com/authenticate",'{"agent":{"name":"Minecraft","Version":1},"username":"'+Account+'","password":"'+Password+'"}',headers=self.__UserAgent).text)
|
||||||
|
self.__Token=result['accessToken']
|
||||||
|
self.__UUID=result['selectedProfile']['id']
|
||||||
|
self.__ID=result['selectedProfile']['name']
|
||||||
|
else:
|
||||||
|
return "Error:Fail to request Mojang's Auth Server."
|
||||||
|
def OfflineAuth(self,Account):
|
||||||
|
self.__ID=Account
|
||||||
|
self.__UUID=self.GetUUID(Account)
|
||||||
|
self.__Token=""
|
||||||
|
def GetJavaPaht(self):
|
||||||
|
if(platform.system()=="Windows"):
|
||||||
|
path="C:/"
|
||||||
|
elif(platform.system()=="Linux"):
|
||||||
|
path="/"
|
||||||
|
else:
|
||||||
|
path="/"
|
||||||
|
i=0
|
||||||
|
for ipath in os.listdir(Path):
|
||||||
|
FullDir=os.path.join(path,ipath)
|
||||||
|
if(os.path.isfile(FullDir)):
|
||||||
|
if("javaw.exe" in os.path.split(FullDir)[1]):
|
||||||
|
return FullDir
|
||||||
|
i+=1
|
||||||
|
if(i=1):
|
||||||
|
break
|
||||||
|
def Download(self,DownloadFrom,DownloadTo):
|
||||||
|
if(DownloadFrom=="" or DownloadTo==""):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user