Syntax error, insert "}" to complete Expression

Discussion in 'Plugin Development' started by QuecksilberHD, Oct 28, 2013.

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

    QuecksilberHD

    Hey Com,
    I have a problem... Eclipse make a red line under ) in (b.getLocation()) and says me
    Syntax error, insert "}" to complete Expression
    but I have all }, know anyone what I can do ?
    Code:
    @EventHandler
        public void onInteract(PlayerInteractEvent e){
        if(e.getAction() == Action.LEFT_CLICK_BLOCK){
        Player p = e.getPlayer();
        if(p.getItemInHand().getType()==Material.STICK){
            if (plugin.choosers.contains(p.getName()))
            {
                 Block b = e.getClickedBlock();
                 this.plugin.getConfig().set("coords", packageLocation(b.getLocation());
                 this.plugin.saveConfig();
            }
            }
            }
        }
    
     
  2. Offline

    nisovin

    You need another close parenthesis at the end of that line.
     
    Skyost likes this.
  3. Offline

    QuecksilberHD

    nisovin Yes, but which ? :D
    Code:
    @EventHandler
        public void onInteract(PlayerInteractEvent e){
        if(e.getAction() == Action.LEFT_CLICK_BLOCK){
        Player p = e.getPlayer();
        if(p.getItemInHand().getType()==Material.STICK){
            if (plugin.choosers.contains(p.getName()))
            {
                 Block b = e.getClickedBlock();
                 this.plugin.getConfig().set("coords", packageLocation(b.getLocation());
                 this.plugin.saveConfig();
            }
            }
            }
        }    
    /**
         * Formats a location to world,x,y,z for saving *
         */
        public static String packageLocation(Location l)
        {
                if (l == null)
                        return null;
                return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
        }
    
     
  4. Offline

    HGPDev

    try:
    Code:
    public class Urname-ect-here {
     
    //Rest of your code here..
     
        @EventHandler
        public void onInteract(PlayerInteractEvent e){
        if(e.getAction() == Action.LEFT_CLICK_BLOCK){
        Player p = e.getPlayer();
        if(p.getItemInHand().getType()==Material.STICK){
            if (plugin.choosers.contains(p.getName()))
            {
                Block b = e.getClickedBlock();
                this.plugin.getConfig().set("coords", packageLocation(b.getLocation());
                this.plugin.saveConfig();
                    }
                }
            }
        } 
    /**
        * Formats a location to world,x,y,z for saving *
        */
        public static String packageLocation(Location l)
        {
                if (l == null)
                        return null;
                return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
        }
    } // This one is the extra 
    If its not working send me the hole class code.
     
  5. Offline

    nisovin

    The line with the error, right before the semi-colon. Count the parentheses on that line, you'll see.
     
  6. Offline

    adam753

    These things wouldn't happen if you just took the time to use proper indentation, honestly.
     
    reider45 likes this.
Thread Status:
Not open for further replies.

Share This Page