Turn manual array copies into System.arrayCopy
This commit is contained in:
parent
d32a077359
commit
009df4a0ad
@ -38,9 +38,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
|
||||
return true;
|
||||
}
|
||||
String[] newArgs = new String[args.length - 1];
|
||||
for (int i = 0; i < newArgs.length; i++) {
|
||||
newArgs[i] = args[i + 1];
|
||||
}
|
||||
System.arraycopy(args, 1, newArgs, 0, newArgs.length);
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs);
|
||||
|
@ -86,9 +86,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
|
||||
radius = maxRadius;
|
||||
}
|
||||
String[] newArgs = new String[args.length - (starting + 1)];
|
||||
for (int i = 0; i < newArgs.length; i++) {
|
||||
newArgs[i] = args[i + (starting + 1)];
|
||||
}
|
||||
System.arraycopy(args, starting + 1, newArgs, 0, newArgs.length);
|
||||
Disguise disguise;
|
||||
try {
|
||||
disguise = parseDisguise(sender, newArgs);
|
||||
|
@ -152,9 +152,7 @@ public class FlagWatcher {
|
||||
|
||||
public ItemStack[] getArmor() {
|
||||
ItemStack[] armor = new ItemStack[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
armor[i] = items[i];
|
||||
}
|
||||
System.arraycopy(items, 0, armor, 0, 4);
|
||||
return armor;
|
||||
}
|
||||
|
||||
|
@ -265,9 +265,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
}
|
||||
// Copy strings to their new range
|
||||
String[] newArgs = new String[args.length - toSkip];
|
||||
for (int i = toSkip; i < args.length; i++) {
|
||||
newArgs[i - toSkip] = args[i];
|
||||
}
|
||||
System.arraycopy(args, toSkip, newArgs, 0, args.length - toSkip);
|
||||
args = newArgs;
|
||||
for (int i = 0; i < args.length; i += 2) {
|
||||
String methodName = args[i];
|
||||
|
Loading…
Reference in New Issue
Block a user