So, I've searched around this forum a bit, in an attempt to find how to split a string this complicatedly... Basically, I can get it from the config, but I need to be able to get the item ID, amount, durability, and enchantment from the config. The format I was planning on using was id:amount:durability:enchantment. So, 276:1:50:3 would give the the user 1 iron sword at durability 50 with enchantment "3" (whatever that happens to be). It'd be nice to use different characters (@, |), but I think that will complicate things. (i.e. id:amount@durability|enchantment). Could anyone give me an example of how I'd split this into 4 parts? Thanks!
String[] s = string.split(":"); Edit: String string = "1:2:3:4"; String[] s = string.split(":"); s[0] would be "1", s[1] would be "2", s[2] would be "3", s[3] would be "4"
Yeah, I have to parse them... But that 's'. Is that representing the split string; how do I grab the 'parts'? I'd assume it's something like [2]..
You would use s[0] for the first number s[1] for the next, and so on, then you would do int item = Integet.parseInteger(s[0]); and go through them.