From 8e73eecd515b58f2d6340d7c0fe94a7b248914b4 Mon Sep 17 00:00:00 2001 From: games647 Date: Thu, 30 Nov 2017 09:36:27 +0100 Subject: [PATCH] Fix missing bungee repository (Fixes #5) --- pom.xml | 5 +++++ .../github/games647/colorconsole/common/CommonFormatter.java | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3b9bf54..cce5212 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,11 @@ sponge-repo https://repo.spongepowered.org/maven + + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + diff --git a/src/main/java/com/github/games647/colorconsole/common/CommonFormatter.java b/src/main/java/com/github/games647/colorconsole/common/CommonFormatter.java index b381a70..3f2b261 100644 --- a/src/main/java/com/github/games647/colorconsole/common/CommonFormatter.java +++ b/src/main/java/com/github/games647/colorconsole/common/CommonFormatter.java @@ -4,6 +4,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.ImmutableSet; +import io.netty.util.internal.ThreadLocalRandom; + import java.util.Arrays; import java.util.Collection; import java.util.Map; @@ -62,7 +64,6 @@ public class CommonFormatter { } public void initPluginColors(Iterable plugins, Map configColors, String def) { - Random random = new Random(); Color[] colors = Color.values(); //remove black, because it's often hard to read colors = Arrays.copyOfRange(colors, 1, colors.length); @@ -72,7 +73,7 @@ public class CommonFormatter { String styleCode = configColors.getOrDefault(plugin, def); if ("random".equalsIgnoreCase(styleCode)) { //ignore default - styleCode = colors[random.nextInt(colors.length - 1)].name(); + styleCode = colors[ThreadLocalRandom.current().nextInt(colors.length - 1)].name(); } colorBuilder.put(plugin, format(styleCode));