From c0e08f5db48212707b49c30131d67a68c51ec8a6 Mon Sep 17 00:00:00 2001 From: Jaime Martinez Rincon Date: Wed, 9 Aug 2017 13:14:51 +0200 Subject: [PATCH] Finished the manage command, now lets migrate the config system --- README.md | 2 +- .../commands/ManageCommand.java | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4df9dea..adb9872 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - [ ] Stop using inventivetalent's deprecated bungee-update - [ ] Create a spigot addon that adds connector signs and placeholders - [ ] Separate the types of connections in classes instead of being in ConnectionIntent -- [ ] Make the plugin API not be so dependent on a instance of PlayerBalancer +- [ ] Make the plugin API be not so dependent on a instance of PlayerBalancer - [ ] Separate connection providers in classes instead of being hardcoded in an enum - [ ] Make the feature `marker-descs` work per section - [ ] Add a identifier to get the servers of a section (auto complete) diff --git a/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java b/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java index 06a4c0b..6be2700 100644 --- a/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java +++ b/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java @@ -15,6 +15,7 @@ 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; public class ManageCommand extends Command { @@ -138,11 +139,16 @@ public class ManageCommand extends Command { .append(section.getCommand().getName()) .color(ChatColor.AQUA) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder("Extra Information: ") //todo implement this - .create() - ) - ) - .create() + new ComponentBuilder("Permission: ") + .color(ChatColor.GRAY) + .append(section.getCommand().getPermission().equals("") ? "None" : section.getCommand().getPermission()) + .color(ChatColor.AQUA) + .append("\nAliases: ") + .color(ChatColor.GRAY) + .append(Arrays.toString(section.getCommand().getAliases())) + .color(ChatColor.AQUA) + .create()) + ).create() ); } else { sender.sendMessage(new ComponentBuilder("Section Command: ") @@ -159,7 +165,6 @@ public class ManageCommand extends Command { .create() ); - //TODO show status when hovering over server section.getServers().forEach(server -> { ServerStatus status = plugin.getStatusManager().getStatus(server); sender.sendMessage(new ComponentBuilder("\u2022 Server: ") @@ -167,7 +172,19 @@ public class ManageCommand extends Command { .append(server.getName()) .color(ChatColor.AQUA) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ComponentBuilder("This is a test\nThis is a test").create())) //todo implement this + new ComponentBuilder("Accessible: ") + .color(ChatColor.GRAY) + .append(status.isAccessible() ? "yes" : "no") + .color(status.isAccessible() ? ChatColor.GREEN : ChatColor.RED) + .append("\nDescription: ") + .color(ChatColor.GRAY) + .append("\"") + .color(ChatColor.AQUA) + .append(status.getDescription()) + .color(ChatColor.WHITE) + .append("\"") + .color(ChatColor.AQUA) + .create())) .append(String.format(" (%d/%d) ", status.getOnline(), status.getMaximum()))