Checking chat

Discussion in 'Spigot Plugin Development' started by MaxKrissigo, Jun 25, 2016.

  1. I've tried a lot of things but can't seem to work out how to do this. I basically want to run some code at a specific point by calling it, and that code constantly checks until a certain player sends a message and then stops once that player sends a message in chat. I also want to then store the message that the specific player sent. Not really sure how to explain it or go about doing it. Thanks Max.
     
  2. I've worked it out myself, but thanks for the help! Here is the code:
    Code (Text):
        public String nameFW;
       
        private ArrayList<Player> checkingFW = new ArrayList<Player>();
       
        @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            if (checkingFW.contains(p)) {
                e.setCancelled(true);
                nameFW = e.getMessage();
                saveFirework1(p);
                checkingFW.remove(p);
            }
        }