Solved Join Command doesn´t work, but no error

Discussion in 'Plugin Development' started by Daniel90542, Nov 18, 2014.

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

    Daniel90542

    Hey Guys,

    I just wanted to write a little Plugin for my Friend.
    It´s only a "join" Command, but if I perform it InGame, there is no error or "unkown Command" or something like this, it´s just not working.

    If someone out there have an Idea, where the error is, please answer me in this thread.

    Thank you for your support :)


    Here is the Code:

    Code:java
    1. public void onCommand(CommandSender sender, Command cmd, String[] args)
    2. {
    3. Player p = (Player) sender;
    4. double x = 377;
    5. double y = 69;
    6. double z = 1215;
    7. World Weltname = Bukkit.getWorld("Buro");
    8. Location Burowelt = new Location(Weltname, x, y, z);
    9.  
    10.  
    11. if(sender instanceof Player)
    12. {
    13. if (cmd.getName().equalsIgnoreCase("Buro"))
    14. {
    15. if (args.length == 0)
    16. {
    17. p.sendMessage("§Use: §6/Buro join");
    18. }
    19.  
    20. if (args.length == 1)
    21. {
    22. if (args[0].equalsIgnoreCase("join"))
    23. {
    24. if(p.hasPermission("Buro.join"))
    25. {
    26. p.teleport(Burowelt);
    27. }else
    28. {
    29. p.sendMessage("Nope :D");
    30. }
    31. }
    32. }
    33. }
    34. }
    35. }


    and here is the Plugin.yml:

    Code:java
    1.  
    2. name: DeathDrops
    3. version: 1.4
    4. author: Daniel90542
    5. website: [url]http://bukkti.org/[/url]
    6.  
    7. main: Haupt.hauptklasse
    8. commands:
    9. Buro:
    10. description: Just do Buro join
    11.  
     
  2. Offline

    Nateb1121

    Add some Bukkit.getLogger("INFO"); statements in your logic so you can see where it stops executing, it will also help us find out where it's stopping.

    Also let us know the command you're entering in, too.
     
  3. Offline

    HeadGam3z

    onCommand is a boolean, not a void.

    Missing an argument in your onCommand parameters.

    Is this class extending JavaPlugin? If not, register the command in your onEnable.

    You're casting player to sender, then checking if sender is a player. (It's like saying 3493419481x3493 is 300 w/o checking if it's correct (obviously not, lol)).

    Your .yml looks a little weird to me.
     
    Nateb1121 likes this.
  4. Offline

    Nateb1121



    Your eye is much better than mine, :p. The YAML is odd looking but valid.
     
  5. Offline

    Daniel90542

    Ok, thank you for your answer´s.

    I thougt I changed everything, except the Argument in the onCommand-Method.

    Here is the newest Code:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String[] args)
    2. {
    3. Player p = (Player) sender;
    4. double x = 377;
    5. double y = 69;
    6. double z = 1215;
    7. World Weltname = Bukkit.getWorld("Buro");
    8. Location Burowelt = new Location(Weltname, x, y, z);
    9.  
    10.  
    11. Bukkit.broadcastMessage("Player instance = ok");
    12. if (cmd.getName().equalsIgnoreCase("Buro"))
    13. {
    14. Bukkit.broadcastMessage("cmd Buro = ok");
    15. if (args.length == 0)
    16. {
    17. p.sendMessage("§Use: §6/Buro join");
    18. }
    19.  
    20. if (args.length == 1)
    21. {
    22. Bukkit.broadcastMessage("args lengt 1 = ok");
    23. if (args[0].equalsIgnoreCase("join"))
    24. {
    25. Bukkit.broadcastMessage("2ndcmd join = ok");
    26. if(p.hasPermission("Buro.join"))
    27. {
    28. Bukkit.broadcastMessage("teleport = ok");
    29. p.teleport(Burowelt);
    30. }else
    31. {
    32. Bukkit.broadcastMessage("No Permission = ok");
    33. p.sendMessage("Nope :D");
    34. }
    35. }
    36. }
    37. }
    38. return true;
    39. }


    The Plugin extend JavaPlugin and I deleted the test, if the sender instanceof Player{}.

    But it still don´t want to work...

    If you know, where the error is, please answer me again :D

    Thank you for your support.
     
  6. Offline

    Daniel90542

    Hey Guys,

    I just wanted to Export my Jar File and got this error(Image)
    View attachment 22479
    Here is the plugin.yml:

    Code:
    name: DeathDrops
    version: 1.4
    author: Daniel90542
    website: http://bukkti.org/
     
    main: Haupt.hauptklasse
    commands:
        Buro:
              description: Just do Buro join
    What does this error message mean?

    Could you please help me... again :)

    Thank you veeeery much :)
     

    Attached Files:

  7. Offline

    HeadGam3z

    You need to add String stringNameGoesHere in your parameters. I usually use "s" because why not.

    Please upload your picture to a photo sharing website, as the view attachment link takes me nowhere.

    Also, if you could, let us see the full class (or at least your package name) to make sure your "main: context" is correct in your plugin.yml.
     
  8. Offline

    Daniel90542

  9. Offline

    HeadGam3z

    PHP:
    public boolean onCommand(CommandSender senderCommand cmdString sString[] args) {
     
  10. Offline

    Daniel90542

    Ok, it Works :)

    Thank you a lot for the Help :)
     
Thread Status:
Not open for further replies.

Share This Page