getting command args in event

Discussion in 'Plugin Development' started by BizeaxPvP, Aug 10, 2019.

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

    BizeaxPvP

    im trying to get the command args in my event, how can i do this?

    Code:
    Code:
                if(item.getItemMeta().getDisplayName().equals(ChatColor.RED + "Default rank")) {
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user " + // args[0] here);
                    p.closeInventory();
                }
    
     
  2. Offline

    The_Xman249

    I'm not sure why you need this (Usually there are better ways to achieve what you plan on doing) . Reguardless , looking at your code shows me you want to get the args before you disbatch the command which is strange and you seem to want to get the arg you just put in.
     
  3. Offline

    KarimAKL

    @BizeaxPvP Could you explain a little more? You've already gotten 'args[0]' in your code.
     
  4. Offline

    BizeaxPvP

    this is an event, i have a command executor and i want to have my args from the command executor into my event method
     
  5. Offline

    KarimAKL

    @BizeaxPvP You need to save the arguments somehow. Maybe a list or map? It mostly depends on the information you need to have together with the arguments.
     
  6. Offline

    BizeaxPvP

    I want to get args[0] how can i do this?
     
  7. Offline

    Machine Maker

    Well you can save the value of args[0] to a map with the player's uuid as the key. That way when the event is triggered by the player, you can get the value for that players UUID.
     
Thread Status:
Not open for further replies.

Share This Page