0

I am coding a plugin for a game. This is probably a really simple answer and I have stared at it for about 15 minutes and cannot figure out what the error is on this else statement. It is after an if statement but Eclipse still says that there is a syntax error. I'm sure that this is an easy fix but I is eluding me all the same. Thank you in advance.

@EventHandler (priority = EventPriority.HIGHEST)
    public void onPlayerChat(AsyncPlayerChatEvent event)
    {
        Player sender = event.getPlayer();
        String sentmessage = event.getMessage();
        if (sentmessage.charAt(0) == '@')
        {
            event.setCancelled(true);

            String message = "";
            ArrayList<String> recipients = new ArrayList<String>();
            recipients.add("");
            int nor = 0;

            for (int x = 1; true; x++)
            {
                if (sentmessage.charAt(x) != ' ')
                {
                    recipients.set(nor,  recipients.get(nor) + sentmessage.charAt(x));
                }
                else if (sentmessage.charAt(++x) == '@');
                {
                    nor++;
                    recipients.ensureCapacity(nor);
                    recipients.add("");
                }
                else //Syntax error is on this else statement
                {
                    message = sentmessage.substring(x);
                    break;
                }
            }
            plugin.privateMessage(recipients, sender, message);
        }
    }
user2263904
  • 1
  • 1
  • 2

1 Answers1

4
else if (sentmessage.charAt(++x) == '@');

Remove ; at end

should be:

else if (sentmessage.charAt(++x) == '@'){
.........
}
kosa
  • 65,990
  • 13
  • 130
  • 167