Syntax Error

Discussion in 'Plugin Development' started by ElectricWarlock, Jan 23, 2015.

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

    ElectricWarlock

    So I just coded my 1st plugin (that means there's probably millions of errors) but I have a syntax error in my code So can you please help me? Here is my code.

    Code:
    package com.Electric.Superman;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    
    public class Main extends JavaPlugin{
        public void onEnable(){
            getLogger().info("Superman plugin Activated");
        }
        @Override
        public boolean onCommand(CommandSender sender, Command command,
                String commandLabel, String[] args)
        {
    
    
            if (command.getName().equalsIgnoreCase("Superman"))
    
                if (args.length == 0) {
                    Player player = (Player) sender;
    
    
                    if (player.hasPermission("superman.superman")) {
    
                        player.setHealth(20.0);
                        player.setFoodLevel(20);
                        player.setFireTicks(0);
                        player.setAllowFlight(true);
                        player.getWorld().strikeLightning(player.getLocation());
                        player.setHealth(20F); player.setFoodLevel(20); player.setFireTicks(0);player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 50));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 999));player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 999999, 999));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 999999, 999));player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999999, 999));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 999999, 999));player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 999999, 999));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 50, 999999999)); player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 999999, 999));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 999999, 999));player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 10));
                        player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 999));player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 999999, 999));
                        player.sendMessage(ChatColor.GOLD + "You Are now Superman");
                        if (command.getName().equalsIgnoreCase("Human")) {
                        } else {
                            player.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
                        }
    
                        if (command.getName().equalsIgnoreCase("Human"))
                            if (args.length == 0) {
    
                                if (player.hasPermission("superman.human")) {
                                    player.setAllowFlight(false);
                                    for(PotionEffect effect : player.getActivePotionEffects())
                                    {
                                        player.removePotionEffect(effect.getType());
                                    }
    
                                    player.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 999999, 15));
                                    player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 50, 15));
                                    player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1, 15));
                                    player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 3, 120));
                                } else {
                                    player.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
                                }
    
    
                                return true;
                            }
                        return false;
                    }
                    @Override
                    public void onDisable() {
                        getLogger().info("Superman disabled");
                    }
                }

    The error is after return false; the semicolon is underlined. Eclipse says

    Syntax error, insert "}" to complete Statement.

    Need any other information just tell me.
     
  2. Offline

    WinX64

    In this case, this is exactly the problem, You opened the method/statement/whatever body with a bracket, but forgot to close it.
     
  3. Offline

    BlackDereker

    if(command.getName().equalsIgnoreCase("Superman"))

    forgot the brackets
     
  4. Offline

    ElectricWarlock

    @BlackDereker
    -_- wow! Of all things, it wasn't even a hard mistake. Well thank you
     
Thread Status:
Not open for further replies.

Share This Page