Command not executing

Discussion in 'Plugin Development' started by IsThisNameTakenNope, Aug 19, 2014.

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

    SpaceManiac

    Your post formatting is really broken.

    What does your plugin.yml contain? What command are you issuing, what do you expect to output, what outputs instead?
     
  2. Offline

    Totom3

  3. SpaceManiac yes, and I fixed the formatting, the output is supposed to use another event, and the event works, but the command doesn't.
    Totom3 I registered the command and then used the yaml parser to verify it was correct

    I can use tab to autocomplete it, but nothing fires.

    EDIT: plugin.yml:
    Code:
    name: Buffz
    main: me.IsThisName.buffz.Main
    version: 1.0
    commands:
        buffz:
            description: add buffs to your server!
     
  4. Offline

    SpaceManiac

    So are you only supplying "/globalbuffs" as your command input? Your code specifically says that shouldn't do anything and returns false (which normally prints command usage, but you haven't provided any).
     
  5. SpaceManiac I'm using multiple args, and both of the last ones are integers, and I'm going to add that in later but the command doesn't even fire.
     
  6. Offline

    SpaceManiac

    Try logging all the parameters at the beginning of the function, to see if maybe cmd.getName() is returning something weird or the method just isn't being called.
     
  7. SpaceManiac I tried debugging even putting a broadcast after the onCommand but it wont broadcast...
     
  8. Offline

    Totom3

    IsThisNameTakenNope Mhm... that's weird. Did you try setting your main class as the CommandExecutor for the command ? Or maybe use another class for that and register that one instead ?
     
  9. Totom3 I tried using a CommandExecutor with the same results but then removed it, don't you not need a commandexecutor if the command is in your main class?
     
  10. Offline

    Totom3

  11. Offline

    xTigerRebornx

    IsThisNameTakenNope Post the full startup log so we can see if anything happens in there that may cause problems.
     
  12. xTigerRebornx Nothing relevant, starts up normally, but doesn't issue the command... and when I run the command, nothing irregular happens in console.

    That problem has been fixed(compilation errors) but now this line of code wont fire but all the other lines in the class do.
    Code:java
    1. Collection<ItemStack> drops = evt.getBlock().getDrops();
    2. for (ItemStack drop : drops) {
    3. for (int i = 0; i < Main.multiple; i++) {
    4. Bukkit.broadcastMessage("g");
    5. evt.getBlock().getWorld().dropItemNaturally(evt.getBlock().getLocation(), drop);
    6. }
    7. }
    8.  
    9. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  13. Offline

    Totom3

    IsThisNameTakenNope We need the full function. If it's not firing then it's because A. Some line above it ends the method or the loop, or B. your "drops" collection is empty. Test if drops is empty, add comments everywhere (to see where it doesn't fire) and post the full function!!!
     
Thread Status:
Not open for further replies.

Share This Page