mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-09-11 07:08:05 +02:00
Now using guava for string repetition instead of apache commons
Guava is already being shaded into BungeeCord so why not use it ¯\_(ツ)_/¯
This commit is contained in:
parent
45e89bb8ae
commit
68395a5dfa
9
pom.xml
9
pom.xml
@ -98,6 +98,15 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TODO Ditch this dependency, move to ConfigMe
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.jaimemartz</groupId>
|
||||||
|
<artifactId>faucet-bungee</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- TODO Replace with HTTP call to Spigot's API -->
|
<!-- TODO Replace with HTTP call to Spigot's API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.inventivetalent.update</groupId>
|
<groupId>org.inventivetalent.update</groupId>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.jaimemartz.playerbalancer.commands;
|
package com.jaimemartz.playerbalancer.commands;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.jaimemartz.playerbalancer.PlayerBalancer;
|
import com.jaimemartz.playerbalancer.PlayerBalancer;
|
||||||
import com.jaimemartz.playerbalancer.manager.PasteHelper;
|
import com.jaimemartz.playerbalancer.manager.PasteHelper;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
public class MainCommand extends Command {
|
public class MainCommand extends Command {
|
||||||
private final PlayerBalancer plugin;
|
private final PlayerBalancer plugin;
|
||||||
@ -49,13 +49,13 @@ public class MainCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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("PlayerBalancer " + plugin.getDescription().getVersion()).color(ChatColor.GRAY).create());
|
||||||
sender.sendMessage(new ComponentBuilder("Available commands:").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").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 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("/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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.jaimemartz.playerbalancer.commands;
|
package com.jaimemartz.playerbalancer.commands;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.jaimemartz.playerbalancer.PlayerBalancer;
|
import com.jaimemartz.playerbalancer.PlayerBalancer;
|
||||||
import com.jaimemartz.playerbalancer.configuration.ConfigEntries;
|
import com.jaimemartz.playerbalancer.configuration.ConfigEntries;
|
||||||
import com.jaimemartz.playerbalancer.connection.ConnectionIntent;
|
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.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -64,7 +64,7 @@ public class ManageCommand extends Command {
|
|||||||
String input = args[1];
|
String input = args[1];
|
||||||
ServerSection section = plugin.getSectionManager().getByName(input);
|
ServerSection section = plugin.getSectionManager().getByName(input);
|
||||||
if (section != null) {
|
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: ")
|
sender.sendMessage(new ComponentBuilder("Information of section: ")
|
||||||
.color(ChatColor.GRAY)
|
.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 {
|
} else {
|
||||||
MessageUtils.send(sender, ConfigEntries.UNKNOWN_SECTION_MESSAGE.get());
|
MessageUtils.send(sender, ConfigEntries.UNKNOWN_SECTION_MESSAGE.get());
|
||||||
}
|
}
|
||||||
@ -238,13 +238,13 @@ public class ManageCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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("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").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 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 <section>").color(ChatColor.AQUA).append(" - ").color(ChatColor.GRAY).append("Tells you info about the specified section").color(ChatColor.RED).create());
|
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());
|
||||||
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());
|
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());
|
||||||
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 {
|
} else {
|
||||||
sender.sendMessage(new ComponentBuilder("You do not have permission to execute this command!").color(ChatColor.RED).create());
|
sender.sendMessage(new ComponentBuilder("You do not have permission to execute this command!").color(ChatColor.RED).create());
|
||||||
|
Loading…
Reference in New Issue
Block a user