Added inheritance to the groups when created by TFM.

This commit is contained in:
Paul Reilly 2023-04-04 17:42:05 -05:00
parent dbb289db66
commit f474ce99fd
2 changed files with 15 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import net.luckperms.api.model.data.DataType;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.node.types.InheritanceNode;
import net.luckperms.api.node.types.PrefixNode;
import net.luckperms.api.node.types.WeightNode;
import net.md_5.bungee.api.ChatColor;
@ -40,6 +41,7 @@ public class DisplayableGroup implements Displayable
private final boolean hasDefaultLoginMessage;
public DisplayableGroup(String group,
String inheritance,
Component plural,
Component tag,
int weight,
@ -59,7 +61,14 @@ public class DisplayableGroup implements Displayable
cfg.thenAcceptAsync(g -> {
WeightNode weightNode = WeightNode.builder(weight).build();
PrefixNode prefixNode = PrefixNode.builder().prefix(FUtil.miniMessage(GroupProvider.OPEN.append(tag.color(color)).append(GroupProvider.CLOSE))).priority(1).build();
PrefixNode prefixNode = PrefixNode.builder()
.prefix(FUtil.miniMessage(GroupProvider.OPEN.append(tag.color(color)).append(GroupProvider.CLOSE)))
.priority(1)
.build();
if (inheritance != null) {
InheritanceNode inheritanceNode = InheritanceNode.builder(inheritance).build();
g.getData(DataType.NORMAL).add(inheritanceNode);
}
g.getData(DataType.NORMAL).add(prefixNode);
g.getData(DataType.NORMAL).add(weightNode);
}).join(); // Block until the group is created and loaded.

View File

@ -15,11 +15,11 @@ public interface GroupProvider<T extends DisplayableGroup>
Component OPEN = Component.text("[", NamedTextColor.DARK_GRAY);
Component CLOSE = Component.text("]", NamedTextColor.DARK_GRAY);
GroupProvider<DisplayableGroup> NON_OP = () -> new DisplayableGroup("non_op", Component.text("Non-Ops"), Component.empty(), 0, NamedTextColor.WHITE, null, false, false);
GroupProvider<DisplayableGroup> OP = () -> new DisplayableGroup("op", Component.text("Operators"), Component.text("Op"), 1, NamedTextColor.GREEN, null, false, false);
GroupProvider<DisplayableGroup> MASTER_BUILDER = () -> new DisplayableGroup("builder", Component.text("Master Builders"), Component.text("MB"), 2, NamedTextColor.DARK_AQUA, ChatColor.DARK_AQUA, true, true);
GroupProvider<DisplayableGroup> ADMIN = () -> new DisplayableGroup("admin", Component.text("Administrators"), Component.text("Admin"), 3, NamedTextColor.DARK_GREEN, ChatColor.DARK_GREEN, true, true);
GroupProvider<DisplayableGroup> SENIOR_ADMIN = () -> new DisplayableGroup("senior", Component.text("Senior Administrators"), Component.text("SrA"), 4, NamedTextColor.GOLD, ChatColor.GOLD, true, true);
GroupProvider<DisplayableGroup> NON_OP = () -> new DisplayableGroup("non_op", null,Component.text("Non-Ops"), Component.empty(), 0, NamedTextColor.WHITE, null, false, false);
GroupProvider<DisplayableGroup> OP = () -> new DisplayableGroup("op", "non_op", Component.text("Operators"), Component.text("Op"), 1, NamedTextColor.GREEN, null, false, false);
GroupProvider<DisplayableGroup> MASTER_BUILDER = () -> new DisplayableGroup("builder", "op", Component.text("Master Builders"), Component.text("MB"), 2, NamedTextColor.DARK_AQUA, ChatColor.DARK_AQUA, true, true);
GroupProvider<DisplayableGroup> ADMIN = () -> new DisplayableGroup("admin", "builder", Component.text("Administrators"), Component.text("Admin"), 3, NamedTextColor.DARK_GREEN, ChatColor.DARK_GREEN, true, true);
GroupProvider<DisplayableGroup> SENIOR_ADMIN = () -> new DisplayableGroup("senior", "admin", Component.text("Senior Administrators"), Component.text("SrA"), 4, NamedTextColor.GOLD, ChatColor.GOLD, true, true);
static User getUser(Player player)
{