Is plugin up to date error?

Discussion in 'Plugin Development' started by troaxx, Apr 8, 2021.

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

    troaxx

    Hey guys, I have absolutely no knowledge in coding and I just followed a tutorial lol. Followed it exactly but I still have the (Is it up to date?) error. I have tried retyping the .yml lots of times but still fails. First had an error about how the java class is too high for my server to read or use, so I used Java 9 for it then I get the error so I'm not sure what's wrong.

    Code :
    Code:
    package me.troaxx.followingtutorial1;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    
    public class HelloCommand implements CommandExecutor {
       
        private Main plugin;
       
        public HelloCommand(Main Plugin){
            this.plugin = plugin;
            plugin.getCommand("hello").setExecutor(this);
        }
       
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (!(sender instanceof Player)){
                sender.sendMessage("Only players may execute this command!");
                return true;
            }
           
            Player p = (Player) sender;
           
            if (p.hasPermission("hello.use")){
                p.sendMessage("hi!");
                return true;
            } else{
                p.sendMessage("You do not have permission to execute this command!");
            }
            return false;
        }
    }
    plugin.yml:
    Code:
    name: HelloWorld
    version: 1.0
    author: troaxx
    main: me.troaxx.followingtutorial1.Main
    description:
    
    commands:
      hello:
        description: This is the hello command
        usage: /<command>
     
    Last edited by a moderator: Apr 8, 2021
  2. Offline

    KarimAKL

  3. Offline

    Newdel

    Tried to put a description here?

    Then why are you trying to code bukkit plugins anyways? Learn coding first
     
  4. Offline

    troaxx

    Code:
    [22:46:19] [Server thread/ERROR]: Error occurred while enabling HelloWorld v1.0 (Is it up to date?)
    java.lang.NullPointerException: null
        at me.troaxx.followingtutorial1.HelloCommand.<init>(HelloCommand.java:15) ~[?:?]
        at me.troaxx.followingtutorial1.Main.onEnable(Main.java:9) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.4.jar:git-Paper-261]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:468) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:239) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.4.jar:git-Paper-261]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.4.jar:git-Paper-261]
        at java.lang.Thread.run(Unknown Source) [?:?]
    [22:46:19] [Server thread/INFO]: [HelloWorld] Disabling HelloWorld v1.0
    The description was meant as the plugin description. Removed it.
    Just did it for fun, but I want to see if it works.
     
    Last edited by a moderator: Apr 8, 2021
  5. Offline

    davidclue

    You didn't define the api version in your yml add this to your yml
    Code:
    name: HelloWorld
    version: 1.0
    author: troaxx
    main: me.troaxx.followingtutorial1.Main
    description: a cool description
    api-version: 1.16
    
    commands:
      hello:
        description: This is the hello command
        usage: /<command>
    I am just assuming you are using 1.16 but replace that with whatever version your using, you can learn more about the yaml here.
     
    troaxx and Newdel like this.
  6. Offline

    KarimAKL

    Did you pass null to the HelloCommand constructor? Please post your main class as well.

    api-version is not required, and it is not the cause of this problem.
    @troaxx did not tell us what version they are building for, and they are not using materials, so this is unrelated.
     
  7. Offline

    troaxx

    package me.troaxx.followingtutorial1;

    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin {

    @Override
    public void onEnable(){
    new HelloCommand(this);

    }
    }
     
  8. Offline

    KarimAKL

    I just noticed, but your constructor's parameter is named "Plugin" while you use "plugin"
    Java is case-sensitive, so that is probably why you are getting a NullPointerException.
    You should change it from "Plugin" to "plugin"
     
    Newdel likes this.
  9. Offline

    davidclue

    Idk I just said that because whenever I was building a plugin for 1.13 or higher, it would always throw me an "is it up to date?" error unless I specified the api-version.
     
  10. Offline

    troaxx

    Ah yes it works now, thank you so much!
     
    KarimAKL likes this.
Thread Status:
Not open for further replies.

Share This Page