AutoRun Commands Plugin Help

Discussion in 'Plugin Development' started by isaytoast24, Sep 5, 2013.

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

    isaytoast24

    I need help with the autorun command plugin, When a player joins the server they get a commad pushed to them but I need it to apply to a random player, is there a bukkit command argument that says "random player"? like %random% or something:

    example: /teleport 500 %randomplayer%
    500 being the points it costs to teleport to the random player

    Does anyone have any ideas? It's one of the last things to do on my list.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  2. Offline

    Retherz_

    Bukkit.dispatchCommand(sender, commandLine);




    int r = new Random().nextInt(Bukkit.getOnlinePlayers().length);
    Player p = Bukkit.getOnlinePlayers()[r];

    p.performCommand("");
     
  3. Offline

    isaytoast24

    That calls for a random player to perform a command, I mean is there a command variable for "random player in the server"

    example: when they join the server, the console will automatically issue TO THEM /PvP attack %randomplayer%
    So they will get a random target

    I emphasise the TO THEM because my plugin works by if you kill someone you can redeem the head and the person who issued the kill command gets the head teleported to them, and I would like the head to disappear instead of them keeping it.

    Is there a variable like this?
     
  4. Offline

    Retherz_

    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/pvp attack + " p.getName()); did u try that?
     
Thread Status:
Not open for further replies.

Share This Page