more reorganizing and making things work

This commit is contained in:
YouHaveTrouble
2021-04-26 02:17:39 +02:00
parent 60260106a9
commit 862fa193e6
11 changed files with 233 additions and 185 deletions
+1
View File
@@ -53,6 +53,7 @@
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.28</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -8,6 +8,8 @@ import java.util.*;
public class ConfigCache {
//TODO probably rewrite this yet again
private final File configFile;
private final boolean canDoProtocolLib;
private final HashMap<String, CWGroup> groupList = new LinkedHashMap<>();
@@ -55,7 +57,7 @@ public class ConfigCache {
}
groups.putIfAbsent("default", new CWGroup("default", defaultCommands, defaultSubcommands).serialize());
//TODO find a way to update groups
data.putIfAbsent("groups", groups);
DumperOptions dumperOptions = new DumperOptions();
@@ -1,11 +1,13 @@
package eu.endermite.commandwhitelist.common.commands;
import com.mojang.brigadier.tree.LiteralCommandNode;
import eu.endermite.commandwhitelist.common.CWGroup;
import eu.endermite.commandwhitelist.common.ConfigCache;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.text.minimessage.MiniMessage;
public class CWCommand {
@@ -28,8 +30,8 @@ public class CWCommand {
return true;
}
public Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) {
Component component = Component.text("CommandWhitelist by YouHaveTrouble").decorate(TextDecoration.BOLD).color(NamedTextColor.BLUE)
public static Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) {
Component component = MiniMessage.markdown().parse("<rainbow><bold>CommandWhitelist by YouHaveTrouble")
.append(Component.newline());
component = component.append(Component.text("Hover over the command to see what it does!").color(NamedTextColor.AQUA)).decoration(TextDecoration.BOLD, false).append(Component.newline());
component = component.append(Component.text("/"+baseCommand+" help").color(NamedTextColor.AQUA).hoverEvent(HoverEvent.showText(Component.text("Displays this message"))));