whats the problem with my code???

Discussion in 'Spigot Plugin Help' started by TheAsher0001, May 15, 2015.

  1. I'm learning java to create plugins. I've made a package, class etc. I've also made a plugin.yml file but the console says every time: plugin.yml file is invalid...
    here is my code:

    package me.TheAsher0001.Test;

    import java.util.logging.Logger;

    import org.bukkit.command.Command;
    import org.bukkit.command.ConsoleCommandSender;
    import org.bukkit.entity.Player;

    public class test {
    public final Logger logger = Logger.getLogger("Minecraft");
    public static test plugin;


    public void onEnable(){
    this.logger.info("Testplugin Enabled");



    }
    public void onDisable(){
    this.logger.info("Testplugin Disabled");

    }

    public boolean onCommand(ConsoleCommandSender sender, Command cmd, String commandLabel, final String[] args ){

    if(commandLabel.equalsIgnoreCase("test")){
    Player player = (Player) sender;
    player.sendMessage("This works!!!");

    }
    return false;


    }
    }


    and my plugin.yml
    name: TestPlugin
    main: me.TheAsher0001.Test.test
    version: 0.1
    description: My First Plugin

    Commands:
    test:
    description: sends player a message that the plugin works
     
  2. Did you use proper YAML formatting(use spaces instead of tabs)? Can you show us the stack trace?
    Also please pastebin it! :)
     
  3. Your plugin.yml file is invalid, it should be:
    http://hastebin.com/yipomaguho.avrasm
    Tutorial on how to format it:
    http://wiki.bukkit.org/Plugin_Tutorial#Creating_plugin.yml
    http://wiki.bukkit.org/Plugin_YAML
     
  4. still gives error that it isnt a valid plugin
     
  5. Fix your commands section
     
  6. whats the problem with that?
     
  7. it gives this error:
    http://hastebin.com/evuxozozux.sm

    Im trying to learn it... that's why i ask this question... help or dont go hate ppl
     
    #8 TheAsher0001, May 15, 2015
    Last edited by a moderator: May 15, 2015
  8. Code (Text):

    [20:52:37 ERROR]: Could not load 'plugins\Test.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type
     
    Code (Text):

    [20:52:37 ERROR]: Could not load 'plugins\Test2.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
     
    he was using the from YAML format
     
    #9 jessegeerts, May 15, 2015
    Last edited by a moderator: May 15, 2015
  9. Me 2, but whats the problem in the commands???
     
  10.  
  11. whats the problem in the commands line???
     
  12. solved it... i typed: "public class text' but i had to be: "public class test extends JavaPlugin'....
     
  13. you have to extend class to JavaPlugin