def on_getinfo_command_thread(sender, args): if(sender.hasPermission(iptrack_permission)): if not checkargs(sender, args, 1, 1): return False else: if is_ip(args[0]): conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver") curs = conn.cursor() curs.execute("SELECT uuids FROM ip2uuids WHERE ip = ?", (args[0], )) results = curs.fetchall() curs.close() conn.close() if len(results) == 0: msg(sender, "IP " + args[0] + " is not registered in the database, maybe you got a number wrong?") else: uuids = json.loads(results[0][0]) msg(sender, "IP " + args[0] + " was seen with " + str(len(uuids)) + " different Accounts:") for i in range(0, len(uuids)): p=Bukkit.getOfflinePlayer(UUID.fromString(uuids[i])) if is_player(sender): send_JSON_message(sender.getName(), '["",{"text":"' + p.getName() + ' - (uuid: ' + uuids[i] + '","color":"gold","clickEvent":{"action":"run_command","value":"/getinfo ' + p.getName() + '"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"To search for ' + p.getName() + ' in the database, simply click the name!","color":"gold"}]}}}]') else: msg(sender,p.getName() + " - (uuid: " + uuids[i] + ")") else: target = Bukkit.getOfflinePlayer(args[0]) uuid = target.getUniqueId() conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver") curs = conn.cursor() curs.execute("SELECT ips FROM uuid2ips WHERE uuid = ?", (uuid.toString(), )) results = curs.fetchall() curs.close() conn.close() if len(results) == 0: msg(sender, "Player " + args[0] + " is not registered in the database, maybe you misspelled the name?") else: ips = json.loads(results[0][0]) msg(sender, "Player " + args[0] + " was seen with " + str(len(ips)) + " different IPs:") for i in range(0, len(ips)): if is_player(sender): send_JSON_message(sender.getName(), '["",{"text":"' + ips[i] + '","color":"gold","clickEvent":{"action":"run_command","value":"/getinfo ' + ips[i] + '"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"To search for the IP ' + ips[i] + ' in the database, simply click the IP!","color":"gold"}]}}}]') else: msg(sender,ips[i]) else: noperm(sender) return True
.withEntityName(entityName) .withStartCharIndex(utterance.indexOf(value)) .withEndCharIndex(utterance.indexOf(value) + value.length()); } /** * Main function which runs the runtime part of the sample. * * @param runtimeClient instance of the LUIS Runtime API client * @return true if sample runs successfully */ private static String runLuisRuntimeSample(LuisRuntimeAPI runtimeClient, String text) { try { // TODO: replace the application ID that every time you have republish the application appId = UUID.fromString("223c3a69-c59a-4e53-b163-181c6d25dbf2"); //============================================================= // This will execute a LUIS prediction for a "find second class flight to new york" utterance String query = text; LuisResult predictionResult = runtimeClient.predictions().resolve() .withAppId(appId.toString()) .withQuery(query) .execute(); System.out.println("Executing query: " + query); String intentEntities = ""; if (predictionResult != null && predictionResult.topScoringIntent() != null) { System.out.format("Detected intent \"%s\" with the score %f%%\n", predictionResult.topScoringIntent().intent(), predictionResult.topScoringIntent().score() * 100); predictionResult.entities(); if (predictionResult.entities() != null && predictionResult.entities().size() > 0) {
def on_getinfo_command_thread(sender, args): if (sender.hasPermission(iptrack_permission)): if not checkargs(sender, args, 1, 1): return False else: if is_ip(args[0]): conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver") curs = conn.cursor() curs.execute("SELECT uuids FROM ip2uuids WHERE ip = ?", (args[0], )) results = curs.fetchall() curs.close() conn.close() if len(results) == 0: msg( sender, "IP " + args[0] + " is not registered in the database, maybe you got a number wrong?" ) else: uuids = json.loads(results[0][0]) msg( sender, "IP " + args[0] + " was seen with " + str(len(uuids)) + " different Accounts:") for i in range(0, len(uuids)): p = Bukkit.getOfflinePlayer(UUID.fromString(uuids[i])) if is_player(sender): send_JSON_message( sender.getName(), '["",{"text":"' + p.getName() + ' - (uuid: ' + uuids[i] + '","color":"gold","clickEvent":{"action":"run_command","value":"/getinfo ' + p.getName() + '"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"To search for ' + p.getName() + ' in the database, simply click the name!","color":"gold"}]}}}]' ) else: msg(sender, p.getName() + " - (uuid: " + uuids[i] + ")") else: target = Bukkit.getOfflinePlayer(args[0]) uuid = target.getUniqueId() conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver") curs = conn.cursor() curs.execute("SELECT ips FROM uuid2ips WHERE uuid = ?", (uuid.toString(), )) results = curs.fetchall() curs.close() conn.close() if len(results) == 0: msg( sender, "Player " + args[0] + " is not registered in the database, maybe you misspelled the name?" ) else: ips = json.loads(results[0][0]) msg( sender, "Player " + args[0] + " was seen with " + str(len(ips)) + " different IPs:") for i in range(0, len(ips)): if is_player(sender): send_JSON_message( sender.getName(), '["",{"text":"' + ips[i] + '","color":"gold","clickEvent":{"action":"run_command","value":"/getinfo ' + ips[i] + '"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"To search for the IP ' + ips[i] + ' in the database, simply click the IP!","color":"gold"}]}}}]' ) else: msg(sender, ips[i]) else: noperm(sender) return True
def _JSequenceConvert(_, obj): return UUID.fromString(str(obj))
def _set_correlation_id(self, value): if isinstance(value, UUID): value = JUUID.fromString( str(value) ) return self.impl.setCorrelationId(value)
def _set_id(self, value): if isinstance(value, UUID): value = JUUID.fromString( str(value) ) return self.impl.setMessageId(value)
def put_uuid(self, u): u = JUUID.fromString( str(u) ) self._data.putUUID(u)
def put_uuid(self, u): u = JUUID.fromString(str(u)) self._data.putUUID(u)
def _set_correlation_id(self, value): if isinstance(value, UUID): value = JUUID.fromString(str(value)) return self.impl.setCorrelationId(value)
def _set_id(self, value): if isinstance(value, UUID): value = JUUID.fromString(str(value)) return self.impl.setMessageId(value)