Need help with this ._.

Discussion in 'Plugin Development' started by Tysonn92, Feb 2, 2014.

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

    Tysonn92

    Hey guys im kinda new in the plugin world and i wanna say thnx in advance for any kind of help :p


    Now... this is the code:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    2.  
    3. Player player = (Player) sender;
    4.  
    5. if (commandLabel.equalsIgnoreCase("halloffame")) {
    6. List list = getConfig().getStringList("HallOfFame");
    7. int size = list.size();
    8.  
    9. if (args.length == 0 && player.hasPermission("halloffame.latest")) {
    10. sender.sendMessage(list.get(size - 1) + " Random text");
    11. } else {
    12. sender.sendMessage("Command invalid please use:");
    13. sender.sendMessage("/halloffame");
    14. }
    15.  
    16. if (args.length != 0 && args[0].equalsIgnoreCase("list") && player.hasPermission("halloffame.list")) {
    17. for (int i = 0; i < size; ++i)
    18. sender.sendMessage(list.get(i) + ";");
    19. }
    20.  
    21. if (args.length != 0 && args[0].equalsIgnoreCase("add") && player.hasPermission("halloffame.add")) {
    22. if (args.length == 2) {
    23.  
    24. list.add(args[1]);
    25. getConfig().set("HallOfFame", list);
    26. sender.sendMessage("Random Text 2");
    27. reloadConfig();
    28. saveConfig();
    29. } else {
    30. sender.sendMessage("Command invalid please use:");
    31. sender.sendMessage("/halloffame add <Player>");
    32. }
    33. }
    34.  
    35. return true;
    36. } else {
    37. sender.sendMessage(ChatColor.GOLD + "No Permission to use this Command.");
    38.  
    39. }
    40.  
    41. return false;
    42. }


    Nothing happens and it just says

    Unknown command please "help" blah blah (something like this)


    Can you help me?
     
  2. Offline

    _Filip

    You didn't regis ter the command in the plugins.yml
     
  3. Offline

    FireBreath14

    In your plugin.yml file that has to be included in the .jar, be sure you have this entry:

    Code:
    commands:
      commandNameHereNoSlash:
        description: blah blah
        usage: /commandHereWithSlash
        permission: some.default.permission
        permission-message: yada yada yada!
     
  4. Offline

    Niknea

    Tysonn92 Check this out, to help you learn how to add the command to the plugin.yml and the features you can add to it.
     
  5. Offline

    Tysonn92

    Thnx for the quick answer guys.

    Its now working :)
     
Thread Status:
Not open for further replies.

Share This Page