Solved Question regarding @ macros

Discussion in 'Plugin Development' started by Zaaryus, Aug 2, 2014.

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


    When I try use an if statement and check if the string contains for example "@p", it doesn't work. Nothing is wrong with my command block code, because I just tested the command without any if statements checking for macro (and it works). So I'm wondering if @p is still fired in a bukkit command? How can I fix this and just get the "@p" from the argument? Here's a snippet from how my code works:
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    2. if(sender instanceof BlockCommandSender){
    3. BlockCommandSender cmd = (BlockCommandSender) sender;
    4. if(cmd.getName().equalsIgnoreCase("test")){
    5. if(args[0].contains("@p")){
    6. Bukkit.broadcastMessage("It works!");
    7. }
    8. }
    9. }
    10. }

    (This is just an example)
  2. Offline


    Zaaryus wouldn't it make sense that the command block replaces that before executing the command?
  3. Offline


    fireblast709 I understand that it does with vanilla commands, but it does this with custom bukkit commands too?

    EDIT: Wow, then I don't need to rewrite these functions for my plugin (which I already did).. Thanks, haha :rolleyes:
Thread Status:
Not open for further replies.

Share This Page