plugin problem

Discussion in 'Plugin Development' started by _ionut_, Oct 18, 2018.

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

    _ionut_

    Could not load 'plugins/My.jar' in folder 'plugins'

    Code:
    package staff.plugin;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin{
       
        public void onEnable () {
            System.out.println("Plugin Abilitato");
        }
        public void onDisable() {
            System.out.println("Plugin Disabilitato"); 
        }
       public boolean onCommand(CommandSender sender, Command cmd, String[] args) {
           
       if(cmd.getName().equalsIgnoreCase("Prova")) {
          Player player = (Player) sender;
          player.sendMessage("Sei pronto per essere un staffer");
          player.getExp();
       }
           return false;
       } 
           
    } 
    
    

    plugin.yml
    Code:
    name:provaplugin
    main: staff.plugin:Main
    version: 1.0
    description:Ilmioprimoplugin
     
    Last edited by a moderator: Oct 18, 2018
  2. Online

    timtower Administrator Administrator Moderator

    @_ionut_ You need to have a space after the : in the plugin.yml
     
  3. Offline

    Tango_

    staff.plugin:Main change this to staff.plugin.Main
     
  4. Should look like this:

    Code:
    name: ProvaPlugin
    main: staff.plugin.main
    version: 1.1
    author: _ionut_ (optional)
    description: Ilmio PorvaPlugin (optional)
    wesbite: bukkit.org (optional)
    commands:
        prova:
           usage: /prova
           description: ProvaPlugin Command (optional)
    also in your onEnable() , make sure to register your command so add this line :
    Code:
     getServer().getPluginCommand("prova").setExecutor(this); 
    "prova" is the command and "this" is the class that implements CommandExecutor so in this case this class. In this case you have not done this, so make sure the first line looks like this:

    Code:
     public class Main extends JavaPlugin implements CommandExecutor {
    When you implement CommandExecutor you are saying that this class (in this case Main) contains a new command with the onCommand method

    You should look around on youtube to find helpful videos!
     
  5. Online

    timtower Administrator Administrator Moderator

    @Shadow_tingBRO Registering the command is only needed when the executor isn't the main class.
     
  6. oh yh forgot good point!
     
  7. Offline

    _ionut_

    what should I do
     
  8. Online

    timtower Administrator Administrator Moderator

     
  9. Offline

    _ionut_

    it gives me an error
     
  10. Online

    timtower Administrator Administrator Moderator

    Then please post your new plugin.yml
     
  11. Offline

    _ionut_

    name:provaplugin
    main:staff.plugin.Main
    version: 1.0
    description:Ilmioprimoplugin
     
  12. Online

    timtower Administrator Administrator Moderator

    @_ionut_ You need a space after every :
    You haven't added those yet.
     
  13. Offline

    _ionut_

    it makes me no longer see error, but it does not make me command
     
  14. Online

    timtower Administrator Administrator Moderator

    @_ionut_ You have no commands in your plugin.yml
     
Thread Status:
Not open for further replies.

Share This Page