summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorPanFritz <redstonenoobpan@gmail.com>2015-09-11 11:43:57 +0200
committerPanFritz <redstonenoobpan@gmail.com>2015-09-11 11:43:57 +0200
commitd751654ff8b6ece57d28b09d4dadb9cabdbf351a (patch)
tree3cc1ce09417cf6754a2ed980de7f8a253b2d370c /check.py
parentebb893289cc3d0f9979a2ca5c8ccac858c1a175d (diff)
Acctualy, its simpler to just do it all in a thread.
Diffstat (limited to 'check.py')
-rw-r--r--check.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/check.py b/check.py
index cd13a6b..f7924b8 100644
--- a/check.py
+++ b/check.py
@@ -31,11 +31,14 @@ def get_last_seen(player):
# receive link and email from website
-def get_webite_data(player):
+def get_website_data(player):
+ conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver")
+ curs = conn.cursor()
uuid = str(uid(player)).replace("-", "")
- async_query(mysql_database,"SELECT DISTINCT `id`, `email` FROM users WHERE `uuid` = ? LIMIT 1",(uuid,),get_website_data_target)
-
-def get_website_data_target(results):
+ curs.execute("SELECT DISTINCT `id`, `email` FROM users WHERE `uuid` = ? LIMIT 1", (uuid,))
+ results = curs.fetchall()
+ curs.close()
+ conn.close()
return ("http://redstoner.com/users/%s" % results[0][0], results[0][1]) if results else (None, None)
@@ -83,7 +86,10 @@ def on_hook_command(sender, command, label, args):
plugin_header(sender, "Check")
msg(sender, "&7Please notice that the data may not be fully accurate!")
player = server.getOfflinePlayer(args[0]) if len(args) > 0 else None
- get_all_data(sender, player)
+
+ t = threading.Thread(target=get_all_data args=(sender, player))
+ t.daemon = True
+ t.start()
else:
msg(sender, "&4You don't have the required permissions to execute this command!")
return True \ No newline at end of file