So I am in need of setting some variables for a little private mod I am making for my friends. Could somebody explain but not spoonfeed me on how to do this? I already know how to get the chat commands working and what .java it goes in. All I need is some functions to use and how to use them.
Try Integer.parseInt(string) and Double.parseDouble(string). Using the yourString.substring(beginningIndex, endIndex) method on a string will help you cut out the actual numbers. You can also mess around with using the yourString.indexOf(string) method for the indexes in the substring method.
Get the message from chat as a String, and then use a Scanner object to get the values from it.
It works like this:
Scanner scanner = new Scanner(chatMessage);
// if you want to get an int
int i = scanner.nextInt();
// if you want a double
double d = scanner.nextDouble();
Keep in mind that the scanner works with tokens, so you will have to keep that in consideration when parsing the chat.
Message me for custom mod/plugin requests
It works like this:
Keep in mind that the scanner works with tokens, so you will have to keep that in consideration when parsing the chat.
Good luck!