From 009df4a0ad32ec03d6affc2063088ae24c5c6c81 Mon Sep 17 00:00:00 2001 From: riking Date: Tue, 3 Jun 2014 18:19:37 -0700 Subject: [PATCH] Turn manual array copies into System.arrayCopy --- .../disguise/commands/DisguisePlayerCommand.java | 4 +--- .../disguise/commands/DisguiseRadiusCommand.java | 4 +--- src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java | 4 +--- .../libraryaddict/disguise/utilities/BaseDisguiseCommand.java | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java index 720fb188..fff6ea23 100644 --- a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java @@ -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); diff --git a/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java index 54dc3fc6..52b8f44a 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java @@ -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); diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 5af4ff0b..41a65f96 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -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; } diff --git a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java b/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java index 9c55f7bf..6fb61f8e 100644 --- a/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java +++ b/src/me/libraryaddict/disguise/utilities/BaseDisguiseCommand.java @@ -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];