Formatting
This commit is contained in:
1 parent
2abe34e88c
commit
d9199a3e2a
11 files changed
+667
-582
No files matched your search
@@ -6,45 +6,44 @@ from networking import PacketSenderManager, NetworkManager
|
||||
from optparse import OptionParser
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = OptionParser()
|
||||
|
||||
|
||||
parser.add_option("-u", "--username", dest="username", default="",
|
||||
help="username to log in with")
|
||||
|
||||
help="username to log in with")
|
||||
|
||||
parser.add_option("-p", "--password", dest="password", default="",
|
||||
help="password to log in with")
|
||||
|
||||
help="password to log in with")
|
||||
|
||||
parser.add_option("-s", "--server", dest="server", default="",
|
||||
help="server to connect to")
|
||||
|
||||
help="server to connect to")
|
||||
|
||||
parser.add_option("-x", "--offline-mode", dest="offlineMode",
|
||||
action="store_true", default=False,
|
||||
help="run in offline mode i.e don't attempt to auth via minecraft.net")
|
||||
|
||||
action="store_true", default=False,
|
||||
help="run in offline mode i.e don't attempt to auth via minecraft.net")
|
||||
|
||||
# pluginLoader
|
||||
pluginLoader = PluginLoader("plugins")
|
||||
pluginLoader.loadPlugins(parser)
|
||||
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
||||
pluginLoader.notifyOptions(options)
|
||||
|
||||
if(options.username != ""):
|
||||
|
||||
if (options.username != ""):
|
||||
user = options.username
|
||||
else:
|
||||
user = raw_input("Enter your username: ")
|
||||
if(options.password != ""):
|
||||
if (options.password != ""):
|
||||
passwd = options.password
|
||||
elif(not options.offlineMode):
|
||||
elif (not options.offlineMode):
|
||||
passwd = getpass.getpass("Enter your password: ")
|
||||
|
||||
|
||||
if (not options.offlineMode):
|
||||
loginThread = Utils.MinecraftLoginThread(user, passwd)
|
||||
loginThread.start()
|
||||
loginThread.join()
|
||||
loginResponse = loginThread.getResponse()
|
||||
if(loginResponse['Response'] != "Good to go!"):
|
||||
if (loginResponse['Response'] != "Good to go!"):
|
||||
print loginResponse['Response']
|
||||
sys.exit(1)
|
||||
sessionid = loginResponse['SessionID']
|
||||
@@ -52,8 +51,8 @@ if __name__ == "__main__":
|
||||
print "Logged in as " + loginResponse['Username'] + "! Your session id is: " + sessionid
|
||||
else:
|
||||
sessionid = None
|
||||
|
||||
if(options.server != ""):
|
||||
|
||||
if (options.server != ""):
|
||||
serverAddress = options.server
|
||||
else:
|
||||
serverAddress = raw_input("Enter host and port if any: ")
|
||||
@@ -71,9 +70,9 @@ if __name__ == "__main__":
|
||||
try:
|
||||
chat_input = raw_input()
|
||||
if (connection.isConnected):
|
||||
PacketSenderManager.send03(connection.grabSocket(), chat_input)
|
||||
PacketSenderManager.send03(connection.grabSocket(), chat_input)
|
||||
else:
|
||||
pass
|
||||
pass
|
||||
except KeyboardInterrupt, e:
|
||||
connection.disconnect()
|
||||
pluginLoader.disablePlugins()
|
||||
|
||||
Reference in new issue
Block a user