Starting To Give Up, Unknown Command Situation.

Discussion in 'Plugin Development' started by xMwpgamer7ooox, May 11, 2014.

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

    xMwpgamer7ooox

    In game it says its an unknown command. Please help me fix my issue with my code and plugin.yml below!-~~~

    package me.Mwpgamer7ooo.java;

    import org.bukkit.ChatColor;
    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() {
    getLogger().info("Plugin Has Been Enabled! :D");

    }


    public void onDisable() {
    getLogger().info("Plugin Has Been Disabled! D:");

    }

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    if(commandLabel.equalsIgnoreCase("mwpgamer7ooo")) {
    Player player = (Player) sender;
    player.sendMessage(ChatColor.AQUA + "This Plugin Has Been Created By Michael Pereira");

    }

    return false;

    }
    }

    main: me.Mwpgamer7ooo.java.main
    name: Java
    version: 1.0
    author: Mwpgamer7ooo
    description: Java, Simple and Perfect! :)
    commands:
    mwpgamer7ooo:
    description: To Help You!
    usage: /mwpgamer7ooo
     
  2. Offline

    macboinc

    Ok, for the usage you do /<command>

    And the spaces for the for the plugin yml are in the wrong order. I will do this for you if you want.

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

    xMwpgamer7ooox

    Yes could you please do this for me please.
     
  4. Offline

    macboinc

    Here I did it for you:
    Code:java
    1. name: Java
    2. main: me.Mwpgamer7ooo.java.Java
    3. version: 1.0
    4. commands:
    5. mwpgamer7ooo:
    6. usage: /<command>
    7. description: A test command!


    And yes, you could do the author if you want.

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

    xMwpgamer7ooox

    Well I tried this and now it says invalid plugin.yml
     
  6. Offline

    thecrystalflame

    its because you Main is wrong, it shouldnt be java.Java it should be java.Main.

    also change return false to return true in your onCommand
     
  7. Offline

    macboinc

    Oh, Bukkit doesn't put space, here you go now: http://pastebin.com/9Bh3tmbV
     
  8. Offline

    Anonymous350

    xMwpgamer7ooox

    Stop posting multiple threads about the same situation. Staff notified.

    Threads:
    - Starting To Give Up, Unknown Command Situation
    - Command In Game isn't working
    - Command Not working
    - Plugin Coding and CMD Startup
    - Command Prompt Error Please help!
     
  9. Offline

    macboinc

    java.Java works for me. :p
     
  10. Offline

    thecrystalflame

    thats because you named your main class Java, Mwp however named his Main. its completly due to what your the class name of you JavaPlugin child is called.
     
  11. Offline

    macboinc

    Oh.
     
  12. Offline

    toCoda

    You aren't registering your main as the command executor for the command. The class should implement CommandExecutor and onEnable() should include the line getCommand("mwpgamer7ooo").setExecutor(this);
     
  13. Offline

    thecrystalflame

    you do not need to do this when calling the ovveride function onCommand from the plugin class. JavaPlugin has all the implementation for it to work of the bat. the only thing extra you need to do is check that the commandlabel matches a command from your plugin.yml

    getCommand("commandname").setExecutor(new CommandExecuter());
    is there for using a class that extends CommandExecutor not JavaPlugin instead
     
  14. Offline

    xMwpgamer7ooox

    could we please start a priivate conversation if you wouldnt mind
     
  15. Offline

    thecrystalflame

    it wont work for you anyway xMwpgamer7ooox
    the reason java.Java worked for him in plugin.yml is because he named his main class Java. you on the other hand named your class main. so bukkit will only recognise your plugin.yml as being correct if your package and class name in the main: of your yml matches the package and classname of you JavaPlugin class
     
  16. Offline

    d3v1n302418

    xMwpgamer7ooox hi, you must be new here. please please please learn java and bukkit.
     
    hintss likes this.
  17. Offline

    DrEinsteinium

    d3v1n302418 "Please learn java and bukkit." I think he's trying, but whenever he goes for help he always gets pushed away by people who do not want to take the time to help him. At least make a constructive post that directs him to where he/she can learn how to program and use the API rather than shunning him.

    xMwpgamer7ooox try some of these if you havent already. They might help you out

    Java nuts and bolts

    Bukkit Basics
    Plugin.yml help
    Command Tutorial (Outdated but still looks okay for beginners)
     
    hintss likes this.
  18. Offline

    d3v1n302418

    DrEinsteinium Actually as you can see, my post was edited because the original wasn't working(I was on a tablet). Originally I had Bukkit and Java hyperlinked to a Java Youtube channel(thenewboston) and a really useful Bukkit tutorial(TheBCBroz). I had no intent of shunning him.
     
  19. Offline

    xMwpgamer7ooox

    Thanks , I've solved it thanks to your advice! Is there a way I solve my thread now?
     
  20. Offline

    minoneer

    Go to your first post, edit it, select "solved" as prefix
     
Thread Status:
Not open for further replies.

Share This Page