Solved Getting a specific char from string

Discussion in 'Plugin Development' started by EnchantedMiners, Jul 19, 2015.

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

    EnchantedMiners

    Hellow guys, sorry if the following question will be noob or not, so i want to get from a string, a character which is %multiply_level% then get the argument that is followed by that character the string would look like this

    PHP:
    Commands:
      - 
    eco add %player% %multiply_level%3
    What that is suppost to do is get that command line from the arraylist and get the character then multiply the player level which can be 1 or 84 and multiply it by 3 or the number the string says
    any help is apresiated thanks.
     
  2. Offline

    Zombie_Striker

    @EnchantedMiners
    Yeah, this question is very nooby.

    the onCommand method has four main parts, CommandSender, which is the sender of the command, Command which is all the data about the command itself. First string, which is the command as a String, and a string array, which stores all the args (add , player, multiplylevel ect.).

    What you want to do is check if the command is "eco", and then check if the first arg (arg[0])is add, then get the players name for the second arg (arg[1]), and get the multiplier for the third (arg[2]).

    If you don't know what to do after this point (how to turn String to an Integer), then google your questions. These types of questions are common and you should be able to find at least 5 of the same questions posted somewhere.
     
  3. Offline

    EnchantedMiners

    @Zombie_Striker
    That wasn't what i meant but thanks anyways uhmm yeah asking for the question your thought i said would be nooby, i figure out how to solve my problem. thread solved
    .
     
Thread Status:
Not open for further replies.

Share This Page