Very od error "}"

Discussion in 'Spigot Plugin Development' started by danielm175, Apr 18, 2017.

  1. Hi,

    I really cant see what i am missing but the error is saying that i am missing a"}"

    But i cant see where


    My plugin code:



    Code (Text):
    package me.nova.plugin1;

    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin {
       
       
        public void onEnable() {
            getLogger().info(ChatColor.BLUE + "Config Test");

            getConfig().options().copyDefaults(true);
            saveDefaultConfig();
           
        }
       
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
           

            if(cmd.getName().equalsIgnoreCase("hello")) {
               
            String message = getConfig().getString("message");  
            sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message));  

            }
           
           
            return false;
        }
    }
       
           
           
               
               



    Error message:


    Code (Text):
    18.04 16:50:26 [Server] ERROR Could not load 'plugins/Testerplugin7.jar' in folder 'plugins' 18.04 16:50:26 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.Error: Unresolved compilation problems: 18.04 16:50:26 [Server] INFO Type mismatch: cannot convert from int to boolean 18.04 16:50:26 [Server] INFO Syntax error, insert "}" to complete ClassBody 18.04 16:50:26 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at org.bukkit.craftbukkit.v1_9_R2.CraftServer.loadPlugins(CraftServer.java:297) [spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at net.minecraft.server.v1_9_R2.DedicatedServer.init(DedicatedServer.java:200) [spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at net.minecraft.server.v1_9_R2.MinecraftServer.run(MinecraftServer.java:532) [spigot-1.9.4.jar:git-Spigot-798f32d-0cd0397] 18.04 16:50:26 [Server] INFO at java.lang.Thread.run(Unknown Source) [?:1.8.0_25] 18.04 16:50:26 [Server] INFO Caused by: java.lang.Error: Unresolved compilation problems: 18.04 16:50:26 [Server] INFO Type mismatch: cannot convert from int to boolean 18.04 16:50:26 [Server] INFO Syntax error, insert "}" to complete ClassBody 18.04 16:50:26 [Server] INFO at me.nova.plugin1.Main.<init>(Main.java:36) ~[?:?] 18.04 16:50:26 [Server] INFO at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_25] 18.04 16:50:26 [Server] INFO at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_25]
     
  2. What is line 36
     
  3. I spotted "cannot convert from int to boolean" through the code, and there is no such problem or mistyping around brackets, unless you didn't paste a code part where there was some additional "{". That's all I can say so far. Also, like @Aubameyang asked, what's in line 36? (I just spotted it too)
     
  4. Are you even using an IDE? This is something so basic that an IDE would pick up on and designed to stop you from missing.
     
    • Like Like x 2
  5. I pasted the code into Eclipse and it didn't give me any errors from the formatting of it. There is no onDisable though?
     
  6. This is true, but the problem is most likely something else; I'm pretty sure nobody wouldn't use an IDE to code.
    onDisable method isn't required; onEnable neither.
    Edit: just found out the class is abstract but no method is though.
     
  7. I fill so DUMP lol, I fogot to put the Hello command into the Plugin.yml folder :(
    It works now
    but thanks for trying
     
    • Like Like x 1
    • Funny Funny x 1