Want to code a plugin that tps you to a player under y20

Discussion in 'Spigot Plugin Help' started by SpaceBob, May 12, 2016.

  1. Hey!

    I need to code a plugin where when you do /tpl if teleports you to a random player under y20. If someone could help that would be much appreciated!
  2. This is not where to get a dev to do it for you, (although you have the same age as me)
    Service & Recruitment Section magically excist for some reason
    • Agree Agree x 1
  3. I am only looking for a little help, not for the whole plugin to be coded.
  4. Ah sorry, i misunderstood the thread
    You can check if the random location is under y 20 if not, do it again, else tp them
    You should use a for loop for this
  5. Still, should go in the Spigot Plugin Development Help subforum.

    You can loop through all online players, check if the player's Y is under 20.
    If it's not, keep going, but if it is, teleport the player.
  6. If you need it to teleport you to a random player below y20 I would initialise a list for your target players then loop through all online players, check if they are under y20, if so then add them to the list, if not then continue. Once all online players have been looped through, use a random to get a random player from the target list and then teleport to them.