Async Viod

Discussion in 'Plugin Development' started by P_S, Jan 16, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    how can i run void asynchronously ??
        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) {
                return "" + e;
    This function run by player command async ...
    Thx for responses
  2. Offline


    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.
Thread Status:
Not open for further replies.

Share This Page