My personal plugin don't work

Discussion in 'Plugin Development' started by zanurban, May 27, 2020.

  1. Offline

    zanurban

    Hello guys!

    I need help my cmd gets me this error:


    --------------------------------------------------------------------------------------------------------------------------------
    Code:
    Could not load 'plugins\HelloWorld.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: version is not defined
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:968) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:246) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:167) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:148) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:360) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:234) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:900) ~[patched_1.15.2.jar:git-Paper-309]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
    Caused by: java.lang.NullPointerException
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:966) ~[patched_1.15.2.jar:git-Paper-309]
            ... 7 more
    [18:07:20 ERROR]: Could not load 'plugins\Listeners.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: version is not defined
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:968) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:246) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:167) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:148) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:360) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:234) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:900) ~[patched_1.15.2.jar:git-Paper-309]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
    Caused by: java.lang.NullPointerException
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:966) ~[patched_1.15.2.jar:git-Paper-309]
            ... 7 more
    
    name: Listeners
    verssion: 1.0
    main: si.la.zan.listeners.Main


    Is it possible that errors are because I have paper server?


    Thanks Zanurban
     
    Last edited by a moderator: May 27, 2020
  2. Online

    timtower Moderator Moderator

    @zanurban You misspelled version in your plugin.yml
     
  3. Offline

    zanurban

    What version I need to type it?

    [14:18:39 ERROR]: Error occurred while enabling HelloWorld v1.0 (Is it up to date?)
    java.lang.NullPointerException: null
    at si.la.zan.helloworld.commands.HelloCommand.<init>(HelloCommand.java:17) ~[?:?]
    at si.la.zan.helloworld.Main.onEnable(Main.java:11) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.15.2.jar:git-Paper-309]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.15.2.jar:git-Paper-309]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.15.2.jar:git-Paper-309]
    at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin(CraftServer.java:472) ~[patched_1.15.2.jar:git-Paper-309]
    at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins(CraftServer.java:386) ~[patched_1.15.2.jar:git-Paper-309]
    at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:488) ~[patched_1.15.2.jar:git-Paper-309] at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.15.2.jar:git-Paper-309]
    at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:900) ~[patched_1.15.2.jar:git-Paper-309]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]



    should I use spigot 1.15.2?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2020
  4. Online

    timtower Moderator Moderator

    @zanurban Please post your HelloCommand class.
    [code] <code here> [/code]
     
  5. Offline

    zanurban

    What means api?

    Code:
    package si.la.zan.helloworld.commands;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import si.la.zan.helloworld.Main;
    import org.bukkit.entity.Player;
    
    public class HelloCommand implements CommandExecutor {
    
        @SuppressWarnings("unused")
        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 have permission to do this!");
                return true;
            }
            Player player = (Player) sender;
         
            if(player.hasPermission("hello.use")){
                player.sendMessage("Hello");
                return true;
            }
            else {
                player.sendMessage("You do not have permission to do that");
            }
         
            return false;
        }
    }
    
    
    + Main

    Code:
    package si.la.zan.helloworld;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    import si.la.zan.helloworld.commands.HelloCommand;
    
    public class Main extends JavaPlugin{
      
        @Override
        public void onEnable(){
            new HelloCommand(this);
        }
      
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  6. Online

    timtower Moderator Moderator

    Abstract Programming Interface

    And you did not register the command in the plugin.yml
     
  7. Offline

    zanurban

    this?

    name: HelloWorld
    version: 1.0
    main: si.la.zan.helloworld.Main
     
  8. Online

    timtower Moderator Moderator

    @zanurban That file, but you did not specify any commands in it.
     
  9. Offline

    zanurban

    oh tanks

    Code:
    name: Listeners
    version: 1.0
    main: si.la.zan.listeners.Main
    
    commands:
      hello:
        aliases: [hi]
    
    Code:
    14:47:36 INFO]: [HelloWorld] Enabling HelloWorld v1.0*
    [14:47:36 ERROR]: Error occurred while enabling HelloWorld v1.0 (Is it up to date?)
    java.lang.NullPointerException: null
            at si.la.zan.helloworld.commands.HelloCommand.<init>(HelloCommand.java:17) ~[?:?]
            at si.la.zan.helloworld.Main.onEnable(Main.java:11) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin(CraftServer.java:472) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins(CraftServer.java:386) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.reload(CraftServer.java:893) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.Bukkit.reload(Bukkit.java:666) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:761) ~[patched_1.15.2.jar:git-Paper-309]
            at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchServerCommand(CraftServer.java:723) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.DedicatedServer.handleCommandQueue(DedicatedServer.java:469) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:431) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1173) ~[patched_1.15.2.jar:git-Paper-309]
            at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:962) ~[patched_1.15.2.jar:git-Paper-309]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
    All working tanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2020

Share This Page