Skip to content

Commit 68395a5

Browse files
committed
Now using guava for string repetition instead of apache commons
Guava is already being shaded into BungeeCord so why not use it ¯\_(ツ)_/¯
1 parent 45e89bb commit 68395a5

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@
9898
</dependency>
9999

100100

101+
<!-- TODO Ditch this dependency, move to ConfigMe
102+
<dependency>
103+
<groupId>me.jaimemartz</groupId>
104+
<artifactId>faucet-bungee</artifactId>
105+
<version>1.0</version>
106+
<scope>compile</scope>
107+
</dependency>
108+
-->
109+
101110
<!-- TODO Replace with HTTP call to Spigot's API -->
102111
<dependency>
103112
<groupId>org.inventivetalent.update</groupId>

src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.jaimemartz.playerbalancer.commands;
22

3+
import com.google.common.base.Strings;
34
import com.jaimemartz.playerbalancer.PlayerBalancer;
45
import com.jaimemartz.playerbalancer.manager.PasteHelper;
56
import net.md_5.bungee.api.ChatColor;
67
import net.md_5.bungee.api.CommandSender;
78
import net.md_5.bungee.api.chat.ComponentBuilder;
89
import net.md_5.bungee.api.plugin.Command;
9-
import org.apache.commons.lang3.StringUtils;
1010

1111
public class MainCommand extends Command {
1212
private final PlayerBalancer plugin;
@@ -49,13 +49,13 @@ public void execute(final CommandSender sender, String[] args) {
4949
}
5050
}
5151
} else {
52-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
52+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
5353
sender.sendMessage(new ComponentBuilder("PlayerBalancer " + plugin.getDescription().getVersion()).color(ChatColor.GRAY).create());
5454
sender.sendMessage(new ComponentBuilder("Available commands:").color(ChatColor.GRAY).create());
5555
sender.sendMessage(new ComponentBuilder("/balancer").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Shows you this message").color(ChatColor.RED).create());
5656
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());
5757
sender.sendMessage(new ComponentBuilder("/balancer reload").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Reloads the plugin completely").color(ChatColor.RED).create());
58-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
58+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
5959
}
6060
}
6161
}

src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.jaimemartz.playerbalancer.commands;
22

3+
import com.google.common.base.Strings;
34
import com.jaimemartz.playerbalancer.PlayerBalancer;
45
import com.jaimemartz.playerbalancer.configuration.ConfigEntries;
56
import com.jaimemartz.playerbalancer.connection.ConnectionIntent;
@@ -13,7 +14,6 @@
1314
import net.md_5.bungee.api.chat.HoverEvent;
1415
import net.md_5.bungee.api.connection.ProxiedPlayer;
1516
import net.md_5.bungee.api.plugin.Command;
16-
import org.apache.commons.lang3.StringUtils;
1717

1818
import java.util.Arrays;
1919
import java.util.Map;
@@ -64,7 +64,7 @@ public void execute(CommandSender sender, String[] args) {
6464
String input = args[1];
6565
ServerSection section = plugin.getSectionManager().getByName(input);
6666
if (section != null) {
67-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
67+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
6868

6969
sender.sendMessage(new ComponentBuilder("Information of section: ")
7070
.color(ChatColor.GRAY)
@@ -201,7 +201,7 @@ public void execute(CommandSender sender, String[] args) {
201201
);
202202
}
203203

204-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
204+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
205205
} else {
206206
MessageUtils.send(sender, ConfigEntries.UNKNOWN_SECTION_MESSAGE.get());
207207
}
@@ -238,13 +238,13 @@ public void execute(CommandSender sender, String[] args) {
238238
}
239239
}
240240
} else {
241-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
241+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
242242
sender.sendMessage(new ComponentBuilder("Available commands:").color(ChatColor.GRAY).create());
243243
sender.sendMessage(new ComponentBuilder("/section").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Shows you this message").color(ChatColor.RED).create());
244244
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());
245245
sender.sendMessage(new ComponentBuilder("/section info <section>").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Tells you info about the specified section").color(ChatColor.RED).create());
246246
sender.sendMessage(new ComponentBuilder("/section connect <section> [player]").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Connects you or the specified player to that section").color(ChatColor.RED).create());
247-
sender.sendMessage(new ComponentBuilder(StringUtils.repeat('-', 53)).strikethrough(true).color(ChatColor.GRAY).create());
247+
sender.sendMessage(new ComponentBuilder(Strings.repeat("-", 53)).strikethrough(true).color(ChatColor.GRAY).create());
248248
}
249249
} else {
250250
sender.sendMessage(new ComponentBuilder("You do not have permission to execute this command!").color(ChatColor.RED).create());

0 commit comments

Comments
 (0)