Hi, how can i run void asynchronously ?? Code: private String getText(String preURL) { try { URL url = new URL(preURL); URLConnection connection = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String text = in.readLine(); return text; } catch (Exception e) { e.printStackTrace(); return "" + e; } } This function run by player command async ... Thx for responses
Take a look at scheduling programming. And remember, never interact with parts of the Bukkit API inside the asynchronous method (or thread) UNLESS you know they're thread safe. This is admittedly a very small subset of the API (sendMessage(), getOnlinePlayers()) though, so you will often have to schedule a synchronous task inside the asynchronous method instead.