Friend's Hello World Doesn't Work

Discussion in 'Plugin Development' started by kmccmk9, Jun 27, 2013.

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

    kmccmk9

    Hello, my friend is trying to get a hello world type of plugin to work but for some reason there is no output in the console and nothing happens when you type in the command. There are no errors at all. This was exported on a Mac from Eclipse. Below is his java code and yml. Thanks for any help. I have made several plugins in the past but I can't figure out why this isn't working either. Everything seems right, all the imports and code.

    Code:java
    1. package com.mvintzel.Hi;
    2.  
    3. import org.bukkit.Server;
    4. import org.bukkit.command.CommandSender;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.material.Command;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8.  
    9. public class Hi extends JavaPlugin {
    10. Server server;
    11.  
    12. public void onEnable() {
    13. getLogger().info("Hi Plugin Enabled");
    14. server = this.getServer();
    15. }
    16. public void onDisable() {
    17. getLogger().info("Hi Plugin Disabled");
    18. }
    19. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String args[]) {
    20. Player player = (Player) sender;
    21. System.out.println("enter onCommand");
    22. if(commandLabel.equalsIgnoreCase("hi"))
    23. {
    24. System.out.println("entered hi");
    25. server.broadcastMessage("hi dude");
    26. player.sendMessage("hi dude");
    27. }
    28.  
    29. return true;
    30.  
    31. }
    32.  
    33. }
    34.  


    Code:
    name: Hi
    main: com.mvintzel.Hi.Hi
    version: 0.1
    commands:
      hi:
        description: Hi
        usage: /<command>
     
  2. Offline

    Burnett1

    @Override above onEnable and OnDisable
     
  3. Offline

    mvintzel

    Hi im kmccmk9's friend. That didn't work.
     
  4. Offline

    Burnett1

    Upload the jar so i can get it
     
  5. Offline

    wizzinangel

    kmccmk9 Try changing this:

    Code:java
    1.  
    2. if(commandLabel.equalsIgnoreCase("hi"))
    3.  

    to
    Code:java
    1.  
    2. if (command.getName().equalsIgnoreCase("hi"))
    3.  
     
  6. Offline

    LazyLemons

    mvintzel kmccmk9
    You're importing the wrong 'Command'.
    What you have :
    Code:
    import org.bukkit.material.Command;
    You need :
    Code:
    import org.bukkit.command.Command;
     
  7. Offline

    mvintzel

    This fixed it. Thanks.
     
Thread Status:
Not open for further replies.

Share This Page