Plugin wont install

Discussion in 'Plugin Development' started by Techno, Jun 6, 2013.

  1. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hello,

    I have written a Plugin for my server (A simple one.) And it won't work when I put
    the .jar into the plugin's folder.

    Plugin Download: www.mediafire.com/?ge8xom8gprx38d9#
    Code:
    Code:
     
    package BukkitPlugin;
     
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class bukkitPlugin_Main extends JavaPlugin implements Listener {
            @Override
            public void onEnable() {
                    getServer().getPluginManager().registerEvents(this, this);
                    getLogger().info("Bukkit: I AM ALIVE!");
            }
           
            @Override
            public void onDisable() {
                    getLogger().info("Bukkit: I AM DEAD!");
                   
            }            
            public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
                   
                    if(cmd.getName().equalsIgnoreCase("alive")) {
                            getLogger().info("Bukkit: Hello!");
                            return true;    
                    }
     
                    return true;
            }
    }
     
    
    Please help :)
  2. Offline

    NoLiver92

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    the command wont work because you haven't registered the command in onEnable()
  3. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    Umm... How do I do that?
  4. Offline

    Technius

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @NoLiver92
    You don't need to register it in onEnable().

    @Techno
    Are you getting the messages in the console. Are there any error logs?
  5. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Technius
    No. It does not say anything about it in the console.
  6. Offline

    Burnett1

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Plugin.yml please.
  7. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Burnett1
    Here you go:
    Code:
     
    name: Bukkit_Plugin
    main: BukkitPlugin.bukkitPlugin_Main
    version: 1.0
     
    commands:
    Alive:
    description: Testing Command
    usage: /<command> [player]
    permission: Bukkit_Plugin.Alive
    permission-message: You don't have Bukkit_Plugin.Alive
     
    
  8. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Techno Well it doesn't look like your command identifiers in the plugin.yml are done correctly. All of the things like the description, usage, permission, and oermission-message needs to be three spaces in.
  9. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    Thank you. I have fixed the orientation but it is still not working
  10. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  11. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  12. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Techno Hmmm it may have to do with the name of your package. The name BukkitPlugin may already be used by something in Bukkit. A kind of customary thing to do is to make your package me.YourName.PluginName so it doesn't coflict with anything else. Also, I'm not sure, but maybe you shouldn't use underscores in the class name. I am not sure, but try to avoid it.

    This post has been edited 1 time. It was last edited by Zach_1919 Jun 7, 2013.
  13. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    Should I rename it?
  14. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Techno Yes, copy your code, delete your package and the class, then create a new package and a new class as I told you, then paste the code back in.
  15. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    I have done that. Still not working....
  16. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Techno Ummm....post code again?
  17. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    Code:
     
    package Bill4788Package;
     
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Bill4788_MainBukkitClass extends JavaPlugin implements Listener {
            @Override
            public void onEnable() {
                    getServer().getPluginManager().registerEvents(this, this);
                    getLogger().info("Bukkit: I AM ALIVE!");                
            }
           
            @Override
            public void onDisable() {
                    getLogger().info("Bukkit: I AM DEAD!");
                   
            }            
            public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
                   
                    if(cmd.getName().equalsIgnoreCase("alive")) {
                            getLogger().info("Bukkit: Hello!");
                            return true;    
                    }
     
                    return true;
            }
    }
     
    
  18. Offline

    Zach_1919

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Techno Uhh I got nothing.... This guy is pretty awesome though: @CluelessDev maybe he can help
  19. Online

    Jhtzb

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    You use 2 times: "return true;"
  20. Offline

    Burnett1

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Didnt notice that, you need to return false at the end to show that it has not worked and it will send the usage.
  21. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    I have set the
    Code:
    return true
    with
    Code:
    return false
    at the end of the code.

    (Look up this topic for the code.)
  22. Offline

    Burnett1

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    And what happened?
  23. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    Nothing... It said nothing about it in the console either.
  24. Offline

    NoLiver92

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    try adding this after implements Listener:
    Code:
    implements CommandExecutor
    this tells the plugin there is a command function in the code

    This post has been edited 1 time. It was last edited by NoLiver92 Jun 7, 2013.
  25. Offline

    PatoTheBest

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    This should work
    Code:java
    1. package Bill4788Package;
    2.  
    3. import org.bukkit.command.Command;
    4. import org.bukkit.command.CommandSender;
    5. import org.bukkit.plugin.java.JavaPlugin;
    6.  
    7. public class Bill4788_MainBukkitClass extends JavaPlugin {
    8. public final Logger logger = Logger.getLogger("Minecraft");
    9.  
    10. @Override
    11. public void onEnable() {
    12. getServer().getPluginManager().registerEvents(this, this);
    13. this.logger.info("Bukkit: I AM ALIVE!");
    14. }
    15.  
    16. @Override
    17. public void onDisable() {
    18. this.logger.info("Bukkit: I AM DEAD!");
    19.  
    20. }
    21. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    22.  
    23. if(commandLabel.equalsIgnoreCase("alive")) {
    24. this.logger.info("Bukkit: Hello!");
    25. }
    26. return true;
    27. }
    28. }

    This post has been edited 1 time. It was last edited by PatoTheBest Jun 7, 2013.
  26. Offline

    PatoTheBest

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    you can't use "implements" two times in the same class, this is only if the command is in another class (the CommandExecutor)

    This post has been edited 2 times. It was last edited by PatoTheBest Jun 7, 2013.
  27. Offline

    Techno

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    No. It does not. There are error's for the Logger's.
  28. Offline

    NoLiver92

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Technothe loggers should be this:
    Code:
    getLogger().info("Message here");
  29. Offline

    Rocoty

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    A class can implement as many interfaces as you'd like it to. But of course you're right, the keyword "implements" cannot be used twice. You'd have to separate the interfaces with commas.

    @NoLiver92 CommandExecutor is already implemented by some class some levels up in the hierarchy, so implementing CommandExecutor on that class wouldn't make any difference (I don't think it would even work)
  30. Offline

    Rocoty

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Where is the plugin.yml located anyway? It has to be in the default package or in no package

    EDIT: And I assume you replaced the main key in the plugin.yml with the updated path once you refactored the class?

    This post has been edited 1 time. It was last edited by Rocoty Jun 8, 2013.

Share This Page