Easy plugin help!

Discussion in 'Plugin Development' started by Maxxxy93, Jun 1, 2016.

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

    Maxxxy93

    I am just starting out on coding and I tried to make a plugin that you do /joke and it tells you a joke, so far its not working, doesnt even show up in my /plugins, heres the code.

    Code:
    package me.maxxxy;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class FreezeByMax extends JavaPlugin {
       
        @Override
        public void onEnable() {
               
        }
    
        @Override
        public void onDisable () {
           
        }
       
        public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
        
            if (cmd.getName().equalsIgnoreCase("joke") && sender instanceof Player) {
               
                Player player = (Player) sender;
               
                player.sendMessage("What goes up but never goes down?!.... AGE");
               
                return true;
           
               
            }
    }   
    
    
    It is named freezebymax cause I changed my mind on what to make the plugin do when I had it all setup, as its just a test plugin, I dont mind.
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    Maxxxy93

  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    Maxxxy93

  6. Online

    timtower Administrator Administrator Moderator

    @Maxxxy93
    Code:
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.maxxxy.freezebymax'
    And don't reload the server, restart instead.
    Capitalization is important.
     
  7. Offline

    Maxxxy93

    So what do I have to do to fix this :/
     
  8. Online

    timtower Administrator Administrator Moderator

    @Maxxxy93 You make the capitalization of the main: match the main class
     
  9. Offline

    Maxxxy93

  10. Offline

    MrGeneralQ

    @Maxxxy93

    In your plugin.yml write this:

    main: me.maxxxy.FreezeByMax

    That will fix it!
     
  11. Offline

    Maxxxy93

    I did a complete rewrite of the plugin, and it shows up and lets me do /hello, but I want it to let me do /joke, but either way when I do /hello it doesnt tell me the joke I set, it just replies with /hello
     
  12. Offline

    A5H73Y

    You will have to post your new code in order for us to help you.
     
  13. Offline

    MrGeneralQ

    @A5H73Y

    I already spoke him privately. The problem was simple. He was trying /hello but in his plugin.yml it wass "joke:"
    The plugin.yml command simply didn't matched with the command in his Class.
     
Thread Status:
Not open for further replies.

Share This Page