Turn manual array copies into System.arrayCopy

This commit is contained in:
riking 2014-06-03 18:19:37 -07:00
parent d32a077359
commit 009df4a0ad
4 changed files with 4 additions and 12 deletions

View File

@ -38,9 +38,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand {
return true; return true;
} }
String[] newArgs = new String[args.length - 1]; String[] newArgs = new String[args.length - 1];
for (int i = 0; i < newArgs.length; i++) { System.arraycopy(args, 1, newArgs, 0, newArgs.length);
newArgs[i] = args[i + 1];
}
Disguise disguise; Disguise disguise;
try { try {
disguise = parseDisguise(sender, newArgs); disguise = parseDisguise(sender, newArgs);

View File

@ -86,9 +86,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand {
radius = maxRadius; radius = maxRadius;
} }
String[] newArgs = new String[args.length - (starting + 1)]; String[] newArgs = new String[args.length - (starting + 1)];
for (int i = 0; i < newArgs.length; i++) { System.arraycopy(args, starting + 1, newArgs, 0, newArgs.length);
newArgs[i] = args[i + (starting + 1)];
}
Disguise disguise; Disguise disguise;
try { try {
disguise = parseDisguise(sender, newArgs); disguise = parseDisguise(sender, newArgs);

View File

@ -152,9 +152,7 @@ public class FlagWatcher {
public ItemStack[] getArmor() { public ItemStack[] getArmor() {
ItemStack[] armor = new ItemStack[4]; ItemStack[] armor = new ItemStack[4];
for (int i = 0; i < 4; i++) { System.arraycopy(items, 0, armor, 0, 4);
armor[i] = items[i];
}
return armor; return armor;
} }

View File

@ -265,9 +265,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} }
// Copy strings to their new range // Copy strings to their new range
String[] newArgs = new String[args.length - toSkip]; String[] newArgs = new String[args.length - toSkip];
for (int i = toSkip; i < args.length; i++) { System.arraycopy(args, toSkip, newArgs, 0, args.length - toSkip);
newArgs[i - toSkip] = args[i];
}
args = newArgs; args = newArgs;
for (int i = 0; i < args.length; i += 2) { for (int i = 0; i < args.length; i += 2) {
String methodName = args[i]; String methodName = args[i];