Solved java ';' expected

Discussion in 'Plugin Development' started by itsss, May 14, 2018.

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

    itsss

    I executed this source, the error outputs like: Error:(50, 49) java: ';' expected
    where is no ';'? I think no ';' missing...

    Code:
    int left = 60 * 3;
    
                            new Runnable() {
                                int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(), this, 0L, 20L);
    
                                {
                                    @Override
                                    private void run() //(50,49)
                                    {
                                        double x = player.getLocation().getX();
                                        double y = player.getLocation().getY();
                                        double z = player.getLocation().getZ();
    
                                        if (x == 212 && y == 4 && z == -1839) {
                                            Bukkit.broadcastMessage(ChatColor.GREEN + "YOU WIN! score:" + left);
                                            Bukkit.broadcastMessage(ChatColor.GREEN + "Please let your staff know your score.");
                                            Bukkit.broadcastMessage(ChatColor.GREEN + "スコアをスタッフにお知らせください。");
                                            Bukkit.getScheduler().cancelTask(taskID);
                                        }
                                        if (left > 0) {
                                            left--;
                                            switch (left) {
                                                case 60 * 3:
                                                    Bukkit.broadcastMessage(ChatColor.AQUA + "There are 3 minutes remaining!");
                                                    break;
                                                case 60 * 2:
                                                    Bukkit.broadcastMessage(ChatColor.AQUA + "There are 2 minutes remaining!");
                                                    break;
                                                case 60:
                                                    Bukkit.broadcastMessage(ChatColor.AQUA + "There is 1 minute remaining!");
                                                    break;
                                                case 30:
                                                    Bukkit.broadcastMessage(ChatColor.YELLOW + "There are 30 seconds remaining!");
                                                    break;
                                                case 10:
                                                    Bukkit.broadcastMessage(ChatColor.YELLOW + "There are 10 seconds remaining!");
                                                    break;
                                                case 3:
                                                    Bukkit.broadcastMessage(ChatColor.RED + "There are 3 seconds remaining!");
                                                    break;
                                                case 2:
                                                    Bukkit.broadcastMessage(ChatColor.RED + "There are 2 seconds remaining!");
                                                    break;
                                                case 1:
                                                    Bukkit.broadcastMessage(ChatColor.RED + "There are 1 seconds remaning!");
                                                    break;
                                            }
    
                                        } else {
                                            Bukkit.getScheduler().cancelTask(taskID);
                                            Bukkit.broadcastMessage(ChatColor.RED + "GAME OVER!!!");
                                        }
                                    }
                                }
                            };
    and sorry for the title, I accidentally uploaded it.
     
  2. Offline

    timtower Ninja on the waves Moderator

    @itsss Your taskID is in the wrong place, you have a double nested class, that is not possible.
     
    Last edited: May 14, 2018
  3. Offline

    itsss

    @timtower Thanks, the problem fixed,
     
    Last edited: May 14, 2018
Thread Status:
Not open for further replies.

Share This Page