Solved Clean way to check if player is in args.

Discussion in 'Spigot Plugin Development' started by Mr.Midnight, Jun 21, 2016.

  1. Was just wondering what's your preferred method of checking if the args is a certain length and getting the player in the args if so and doing something to him rather than yourself.

    For example

    For yourself = /Gamemode 1
    For others = /Gamemode 1 daPlayer
     
  2. If there are 2 arguments, get the first index of the arguments as the player. Otherwise, set the sender of the commands gamemode to the one specified.
     
    • Like Like x 1
  3. Ok, cool that's the way I do it. Was just looking for unique ways of doing it :3
     
  4. Haha, well that would be the simplest way.
     
    #4 GamerzKing, Jun 21, 2016
    Last edited: Jun 21, 2016
    • Agree Agree x 1
  5. I guess so ;)