Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 18, 2018 15:41:17 GMT
Hello i just made my first plugin, a guy on the server told me to post it here, so here it is! ARS: {AdvancedReportingSystem} goo.gl/4oG2iq
|
|
StevenNL2000
Forum Admin
Posts: 6,415
| Likes: 6,936
IGN: StevenNL2000
Timezone: UTC+01:00
Member is Staff. Need immediate assistance? Send a PM
|
Post by StevenNL2000 on May 18, 2018 19:07:59 GMT
You can concatenate the reason array without using a loop like this:
import java.util.Arrays;
String[] reasonarray = Arrays.copyOfRange(args, 1, args.length); String reason = String.join(" ", reasonarray);
|
|
Premintex
Club 4000 Member
Coward
Posts: 5,408
| Likes: 2,485
|
Post by Premintex on May 18, 2018 21:42:13 GMT
Nice
|
|
Fleek
Veteran Member
Posts: 3,548
|
Post by Fleek on May 18, 2018 22:05:24 GMT
You can concatenate the reason array without using a loop like this: import java.util.Arrays;
String[] reasonarray = Arrays.copyOfRange(args, 1, args.length); String reason = String.join(" ", reasonarray); Or you can just do this String reason = StringUtils.join(args, “ “, 1, args.length); However you should check it if it’s null.
|
|
StevenNL2000
Forum Admin
Posts: 6,415
| Likes: 6,936
IGN: StevenNL2000
Timezone: UTC+01:00
Member is Staff. Need immediate assistance? Send a PM
|
Post by StevenNL2000 on May 19, 2018 9:23:35 GMT
You can concatenate the reason array without using a loop like this: import java.util.Arrays;
String[] reasonarray = Arrays.copyOfRange(args, 1, args.length); String reason = String.join(" ", reasonarray); Or you can just do this String reason = StringUtils.join(args, “ “, 1, args.length); However you should check it if it’s null. I knew there had to be a one-liner I forgot about.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 19, 2018 12:30:44 GMT
Im pretty new to java, idk what this means but thanks for the reply. Also if you would like please rate it <3
|
|
Mafrans
Veteran Member
We assholes need to stick together, if you're a fellow asshole please pm me.
Posts: 1,760
| Likes: 1,703
|
Post by Mafrans on May 20, 2018 9:38:32 GMT
Always fun to see people start making plugins, we all had to start from somewhere I'd recommend looking into commandexecutables, they're going to help you immensely once your commands start taking a lot of space.
|
|
Lemon
Veteran Member
Insert status here.
Posts: 2,491
| Likes: 2,165
|
Post by Lemon on May 20, 2018 13:27:00 GMT
You can concatenate the reason array without using a loop like this: import java.util.Arrays;
String[] reasonarray = Arrays.copyOfRange(args, 1, args.length); String reason = String.join(" ", reasonarray); Or import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils;
String reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
|