diff options
author | Wesley Wolfe <weswolf@aol.com> | 2013-04-05 12:40:03 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-04-05 12:40:03 -0500 |
commit | e555c4d77ed60cdd23079a35dd4a158f9afcdeca (patch) | |
tree | 71eed6d37f34766b2328bbe9043197bb631b22d0 /src/main/java | |
parent | 408e3625ba16c1cdde3accf57df00b35cdd5f178 (diff) | |
download | bukkit-e555c4d77ed60cdd23079a35dd4a158f9afcdeca.tar bukkit-e555c4d77ed60cdd23079a35dd4a158f9afcdeca.tar.gz bukkit-e555c4d77ed60cdd23079a35dd4a158f9afcdeca.tar.lz bukkit-e555c4d77ed60cdd23079a35dd4a158f9afcdeca.tar.xz bukkit-e555c4d77ed60cdd23079a35dd4a158f9afcdeca.zip |
Use utility method for team-join display. Fixes BUKKIT-3997
The method to make a string from a collection of strings already exists
and should be used when adding multiple players to a team.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/FireworkEffect.java | 14 | ||||
-rw-r--r-- | src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java | 12 |
2 files changed, 2 insertions, 24 deletions
diff --git a/src/main/java/org/bukkit/FireworkEffect.java b/src/main/java/org/bukkit/FireworkEffect.java index 70e25b4b..5d1d2eab 100644 --- a/src/main/java/org/bukkit/FireworkEffect.java +++ b/src/main/java/org/bukkit/FireworkEffect.java @@ -59,7 +59,7 @@ public final class FireworkEffect implements ConfigurationSerializable { public static final class Builder { boolean flicker = false; boolean trail = false; - ImmutableList.Builder<Color> colors = ImmutableList.builder(); + final ImmutableList.Builder<Color> colors = ImmutableList.builder(); ImmutableList.Builder<Color> fadeColors = null; Type type = Type.BALL; @@ -130,10 +130,6 @@ public final class FireworkEffect implements ConfigurationSerializable { public Builder withColor(Color color) throws IllegalArgumentException { Validate.notNull(color, "Cannot have null color"); - if (colors == null) { - colors = ImmutableList.builder(); - } - colors.add(color); return this; @@ -154,10 +150,6 @@ public final class FireworkEffect implements ConfigurationSerializable { } ImmutableList.Builder<Color> list = this.colors; - if (list == null) { - list = this.colors = ImmutableList.builder(); - } - for (Color color : colors) { Validate.notNull(color, "Color cannot be null"); list.add(color); @@ -178,10 +170,6 @@ public final class FireworkEffect implements ConfigurationSerializable { Validate.notNull(colors, "Cannot have null colors"); ImmutableList.Builder<Color> list = this.colors; - if (list == null) { - list = this.colors = ImmutableList.builder(); - } - for (Object color : colors) { if (!(color instanceof Color)) { throw new IllegalArgumentException(color + " is not a Color in " + colors); diff --git a/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java b/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java index 6127f4b7..64816b62 100644 --- a/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java +++ b/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java @@ -382,17 +382,7 @@ public class ScoreboardCommand extends VanillaCommand { addedPlayers.add(offlinePlayer.getName()); } } - String[] playerArray = addedPlayers.toArray(new String[0]); - StringBuilder builder = new StringBuilder(); - for (int x = 0; x < playerArray.length; x++) { - if (x == playerArray.length - 1) { - builder.append(" and "); - } else if (x > 0) { - builder.append(", "); - } - builder.append(playerArray[x]); - } - sender.sendMessage("Added " + addedPlayers.size() + " player(s) to team " + team.getName() + ": " + builder.toString()); + sender.sendMessage("Added " + addedPlayers.size() + " player(s) to team " + team.getName() + ": " + stringCollectionToString(addedPlayers)); } } else if (args[1].equalsIgnoreCase("leave")) { if ((sender instanceof Player) ? args.length < 2 : args.length < 3) { |