Solved Problem overriding onCommand from CommandExecutor

Discussion in 'Plugin Development' started by amhokies, Dec 7, 2013.

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

    amhokies

    I'm importing all of my Eclipse projects into Maven projects, and I came across this on one of my plugins. The class is implementing CommandExecutor, and the method I'm trying to override is the onCommand method, but according to Eclipse there isn't a method with that signature in CommandExecutor. Any ideas? Thanks.

    [​IMG]
     
  2. Offline

    The_Doctor_123

    What are your imports?
     
  3. Offline

    amhokies

    import java.util.HashSet;
    import java.util.Set;

    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
     
  4. Offline

    jimuskin

    the Override isn't needed.
    Overrides are used when extending a class not implementing one.
     
  5. Offline

    amhokies

    If Eclipse doesn't let me use Override there, the method isn't going to be called when the command is executed. Overrides are generally good practice and should be used whenever possible.
     
  6. Offline

    The_Doctor_123

    jimuskin
    The Override annotation may be used to override methods from both superclasses and superinterfaces. It does nothing but indicate that a method is being overridden, which makes the code easier to read/understand.

    amhokies
    Maybe try rebooting Eclipse?
     
  7. Offline

    amhokies

    Yeah, I've tried rebooting Eclipse several times and nothing. I'll try using a different Bukkit version and see if that does anything.

    Got rid of the Override annotation, and it works fine. Not sure what the deal is with that, but oh well.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  8. Offline

    jimuskin

    The_Doctor_123

    Told ya :p
     
  9. Offline

    The_Doctor_123

    jimuskin
    That must have been a bug with Eclipse. It is completely fine to have that annotation there.
     
Thread Status:
Not open for further replies.

Share This Page