ChatEvent cancelling with async tasks

Discussion in 'BungeeCord Plugin Development' started by yaykeyboards, Jun 22, 2021.

  1. I want to cancel a ChatEvent, however, the task done in the event is async, and since ChatEvent is not an AsyncEvent, I can't use the intent system, so what can I do?

    Example:
    Code (Java):
    @EventHandler
    public void onChat(ChatEvent event) {
        // ... async task {
            if (result) event.setCancelled(true);
        // }
    }
    I hope this makes sense. The task must be run in a chat event since it is not a predetermined result (i.e: you were to store the result in a list and cancel off of that... I can't do that for my async task)
     
  2. SteelPhoenix

    Moderator

    There is no sync in bungee..?
     
  3. So if my async task was to get something from a database, it wouldn't block?