@EventHandler public void asyncChatTrigger(final AsyncPlayerChatEvent event) { if (event.isCancelled()) return; // Return if "Use asynchronous event" is false in config file if (!Settings.ChatAsynchronous()) return; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() { return process(event.getPlayer(), event.getMessage()); } }; Boolean cancelled = false; try { cancelled = event.isAsynchronous() ? Bukkit.getScheduler().callSyncMethod(DenizenAPI.getCurrentInstance(), call).get() : call.call(); } catch (InterruptedException e) { // dB.echoError(e); } catch (ExecutionException e) { dB.echoError(e); } catch (Exception e) { dB.echoError(e); } event.setCancelled(cancelled); }
@EventHandler public void syncChatTrigger(final PlayerChatEvent event) { if (event.isCancelled()) return; // Return if "Use asynchronous event" is true in config file if (Settings.ChatAsynchronous()) return; Boolean cancelled = process(event.getPlayer(), event.getMessage()); event.setCancelled(cancelled); }