From 68395a5dfaea705ca109e2c5ce7557357124e240 Mon Sep 17 00:00:00 2001 From: Jaime Martinez Rincon Date: Wed, 9 Aug 2017 14:21:39 +0200 Subject: [PATCH] Now using guava for string repetition instead of apache commons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guava is already being shaded into BungeeCord so why not use it ¯\_(ツ)_/¯ --- pom.xml | 9 +++++++++ .../playerbalancer/commands/MainCommand.java | 6 +++--- .../playerbalancer/commands/ManageCommand.java | 10 +++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 471b188..2570818 100644 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,15 @@ + + org.inventivetalent.update diff --git a/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java b/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java index 27cdb7f..eaa144a 100644 --- a/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java +++ b/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java @@ -1,12 +1,12 @@ package com.jaimemartz.playerbalancer.commands; +import com.google.common.base.Strings; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.manager.PasteHelper; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.plugin.Command; -import org.apache.commons.lang3.StringUtils; public class MainCommand extends Command { private final PlayerBalancer plugin; @@ -49,13 +49,13 @@ public class MainCommand extends Command { } } } else { - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("PlayerBalancer " + plugin.getDescription().getVersion()).color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("Available commands:").color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("/balancer").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Shows you this message").color(ChatColor.RED).create()); sender.sendMessage(new ComponentBuilder("/balancer paste").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Creates a paste with the important files").color(ChatColor.RED).create()); sender.sendMessage(new ComponentBuilder("/balancer reload").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Reloads the plugin completely").color(ChatColor.RED).create()); - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); } } } \ No newline at end of file diff --git a/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java b/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java index 6be2700..ddbcc05 100644 --- a/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java +++ b/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java @@ -1,5 +1,6 @@ package com.jaimemartz.playerbalancer.commands; +import com.google.common.base.Strings; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.configuration.ConfigEntries; import com.jaimemartz.playerbalancer.connection.ConnectionIntent; @@ -13,7 +14,6 @@ import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Command; -import org.apache.commons.lang3.StringUtils; import java.util.Arrays; import java.util.Map; @@ -64,7 +64,7 @@ public class ManageCommand extends Command { String input = args[1]; ServerSection section = plugin.getSectionManager().getByName(input); if (section != null) { - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("Information of section: ") .color(ChatColor.GRAY) @@ -201,7 +201,7 @@ public class ManageCommand extends Command { ); } - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); } else { MessageUtils.send(sender, ConfigEntries.UNKNOWN_SECTION_MESSAGE.get()); } @@ -238,13 +238,13 @@ public class ManageCommand extends Command { } } } else { - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("Available commands:").color(ChatColor.GRAY).create()); sender.sendMessage(new ComponentBuilder("/section").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Shows you this message").color(ChatColor.RED).create()); sender.sendMessage(new ComponentBuilder("/section list").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Tells you which sections are configured in the plugin").color(ChatColor.RED).create()); sender.sendMessage(new ComponentBuilder("/section info
").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Tells you info about the specified section").color(ChatColor.RED).create()); sender.sendMessage(new ComponentBuilder("/section connect
[player]").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Connects you or the specified player to that section").color(ChatColor.RED).create()); - sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create()); + sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create()); } } else { sender.sendMessage(new ComponentBuilder("You do not have permission to execute this command!").color(ChatColor.RED).create());